Function: quickurl-grab-url

quickurl-grab-url is a byte-compiled function defined in quickurl.el.gz.

Signature

(quickurl-grab-url)

Documentation

Attempt to grab a word/URL pair from point in the current buffer.

Point should be somewhere on the URL and the word is taken to be the thing that is returned from calling quickurl-grab-lookup-function once a backward-word has been issued at the start of the URL.

It is assumed that the URL is either "unguarded" or is wrapped inside an
<URL:...> wrapper.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/quickurl.el.gz
(defun quickurl-grab-url ()
  "Attempt to grab a word/URL pair from point in the current buffer.

Point should be somewhere on the URL and the word is taken to be the thing
that is returned from calling `quickurl-grab-lookup-function' once a
`backward-word' has been issued at the start of the URL.

It is assumed that the URL is either \"unguarded\" or is wrapped inside an
<URL:...> wrapper."
  (let ((url (thing-at-point 'url)))
    (when url
      (save-excursion
        (beginning-of-thing 'url)
        ;; `beginning-of-thing' doesn't take you to the start of a marked-up
        ;; URL, only to the start of the URL within the "markup". So, we
        ;; need to do a little more work to get to where we want to be.
        (when (thing-at-point-looking-at thing-at-point-markedup-url-regexp)
          (search-backward "<URL:"))
        (backward-word-strictly 1)
        (let ((word (funcall quickurl-grab-lookup-function)))
          (when word
            (quickurl-make-url
             ;; The grab function may return the word with properties. I don't
             ;; want the properties. I couldn't find a method of stripping
             ;; them from a "string" so this will have to do. If you know of
             ;; a better method of doing this I'd love to know.
             (with-temp-buffer
               (insert word)
               (buffer-substring-no-properties (point-min) (point-max)))
             url)))))))