Function: shr-urlify

shr-urlify is a byte-compiled function defined in shr.el.gz.

Signature

(shr-urlify START URL &optional TITLE)

Source Code

;; Defined in /usr/src/emacs/lisp/net/shr.el.gz
(defun shr-urlify (start url &optional title)
  (shr-add-font start (point) 'shr-link)
  (add-text-properties
   start (point)
   (list 'shr-url url
         'button t
         'category 'shr                ; For button.el button buffers.
	 'help-echo (let ((parsed (url-generic-parse-url
                                   (or (ignore-errors
                                         (decode-coding-string
                                          (url-unhex-string url)
                                          'utf-8 t))
				       url)))
                          iri)
                      ;; If we have an IDNA domain, then show the
                      ;; decoded version in the mouseover to let the
                      ;; user know that there's something possibly
                      ;; fishy.
                      (when (url-host parsed)
                        (setf (url-host parsed)
                              (puny-encode-domain (url-host parsed))))
                      (setq iri (url-recreate-url parsed))
		      (if title
                          (format "%s (%s)" iri title)
                        iri))
	 'follow-link t
         ;; Make separate regions not `eq' so that they'll get
         ;; separate mouse highlights.
	 'mouse-face (list 'highlight)))
  (when (< start (point))
    (add-text-properties start (1+ start) '(shr-tab-stop t)))
  ;; Don't overwrite any keymaps that are already in the buffer (i.e.,
  ;; image keymaps).
  (while (and start
              (< start (point)))
    (let ((next (next-single-property-change start 'keymap nil (point))))
      (if (get-text-property start 'keymap)
          (setq start next)
        (put-text-property start (or next (point)) 'keymap shr-map)))))