Function: denote-fontify-links-mode

denote-fontify-links-mode is an autoloaded, interactive and byte-compiled function defined in denote.el.

Signature

(denote-fontify-links-mode &optional ARG)

Documentation

Fontify Denote links in plain text buffers.

Do so only when the current buffer is a Denote note and the major mode is not org-mode or markdown-mode (or any major mode derived therefrom).

This is a minor mode. If called interactively, toggle the Denote-Fontify-Links mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate denote-fontify-links-mode(var)/denote-fontify-links-mode(fun).

The mode's hook is called both when the mode is enabled and when it is disabled.

Key Bindings

Aliases

denote-fontify-links-mode-maybe (obsolete since 4.2.0)

Source Code

;; Defined in ~/.emacs.d/elpa/denote-4.2.3/denote.el
;;;###autoload
(define-minor-mode denote-fontify-links-mode
  "Fontify Denote links in plain text buffers.
Do so only when the current buffer is a Denote note and the major mode
is not `org-mode' or `markdown-mode' (or any major mode derived
therefrom)."
  :init-value nil
  :global nil
  :group 'denote
  (require 'thingatpt)
  (if (and buffer-file-name
           (not (derived-mode-p 'org-mode 'markdown-mode))
           (denote-file-is-in-denote-directory-p buffer-file-name)
           (denote-file-has-supported-extension-p buffer-file-name)
           (denote-file-has-denoted-filename-p buffer-file-name))
      (progn
        (if denote-fontify-links-mode
            (progn
              (add-to-invisibility-spec 'denote-fontified-link)
              (denote-fontify-links--set-data)
              (font-lock-add-keywords nil '((denote-fontify-links)))
              (setq-local thing-at-point-provider-alist
                          (append thing-at-point-provider-alist
                                  '((url . denote--get-link-file-path-at-point)))))
          (remove-from-invisibility-spec 'denote-fontified-link)
          (kill-local-variable 'denote-fontify-links--data)
          (font-lock-remove-keywords nil '((denote-fontify-links)))
          (setq-local thing-at-point-provider-alist
                      (delete
                       '(url . denote--get-link-file-path-at-point)
                       thing-at-point-provider-alist)))
        (font-lock-update))
    ;; NOTE 2026-01-02: If we do not set the value here, then it is
    ;; toggled on/off even though the above `if' never reaches its
    ;; THEN branch.
    (setq denote-fontify-links-mode nil)
    ;; NOTE 2026-01-02: In interactive use, we get a message that the
    ;; mode is disabled if we call it in non-supported buffers.  I
    ;; tried to `let' bind the `inhibit-message' but that did not
    ;; work.  So I am doing this instead...
    (when (called-interactively-p 'interactive)
      (message "`denote-fontify-links-mode' works only in plain text buffers inside the `denote-directory'"))))