Function: denote-fontify-links

denote-fontify-links is a byte-compiled function defined in denote.el.

Signature

(denote-fontify-links LIMIT)

Documentation

Provide font-lock matcher to fontify links up to LIMIT.

Source Code

;; Defined in ~/.emacs.d/elpa/denote-4.2.3/denote.el
;; Implementation based on the function `org-activate-links'.
(defun denote-fontify-links (limit)
  "Provide font-lock matcher to fontify links up to LIMIT."
  (pcase-let ((`(,type . ,query) (denote-fontify-links--get-data nil)))
    (when (and type query)
      (catch 'exit
        (while (re-search-forward query limit t)
          (let* ((start (match-beginning 0))
                 (end (match-end 0))
                 (visible-start (or (match-beginning 2) start))
                 (visible-end (or (match-end 2) end))
                 (query (match-string-no-properties 1)))
            (let* ((properties `( mouse-face highlight
                                  keymap ,denote-fontify-links-map
                                  denote-link-query-part ,query
                                  help-echo query
                                  htmlize-link (:uri ,query)
                                  font-lock-multiline t))
                   (non-sticky-props
                    '(rear-nonsticky (mouse-face highlight keymap invisible help-echo htmlize-link)))
                   (face-property (denote-get-link-face query))
                   (hidden (append '(invisible 'denote-fontified-link) properties)))
              (remove-text-properties start end '(invisible nil))
              (add-text-properties start visible-start hidden)
              (add-face-text-property start end face-property)
              (add-text-properties visible-start visible-end properties)
              (add-text-properties visible-end end hidden)
              (dolist (pos (list end visible-start visible-end))
                (add-text-properties (1- pos) pos non-sticky-props)))
            (throw 'exit t)))
        nil))))