branch: externals/denote commit 5aeb714ae90cf05cc50b5968384401bd8d2c2a53 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Change how denote-fontify-links-mode handles thingatpt dependency This builds on top of the new fontification feature provided by Abdul-Lateef Haji-Ali in pull request 344 (commit 4d12452): <https://github.com/protesilaos/denote/pull/344>. --- denote.el | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/denote.el b/denote.el index ed8990434d..ac9dc67b90 100644 --- a/denote.el +++ b/denote.el @@ -4283,23 +4283,26 @@ To be used as a `thing-at' provider." (when-let (id (get-text-property (point) 'denote-link-id)) (concat "file:" (denote-get-path-by-id id)))) +(defvar thing-at-point-provider-alist) + (define-minor-mode denote-fontify-links-mode - "A minor mode to fontify and fold denote links." + "A minor mode to fontify and fold Denote links." :init-value nil + :global nil :group 'denote + (require 'thingatpt) (if denote-fontify-links-mode - (progn (font-lock-add-keywords nil '(denote-fontify-links)) - (with-eval-after-load 'thingatpt - (make-local-variable 'thing-at-point-provider-alist) - (add-to-list 'thing-at-point-provider-alist + (progn + (font-lock-add-keywords nil '(denote-fontify-links)) + (make-local-variable 'thing-at-point-provider-alist) + (add-to-list 'thing-at-point-provider-alist '(url . denote--get-link-file-path-at-point))) (font-lock-remove-keywords nil '(denote-fontify-links)) - (with-eval-after-load 'thingatpt - (set 'thing-at-point-provider-alist - (cl-remove - '(url . denote--get-link-url-at-point) - (symbol-value 'thing-at-point-provider-alist) - :test 'equal)))) + (set 'thing-at-point-provider-alist + (cl-remove + '(url . denote--get-link-file-path-at-point) + (symbol-value 'thing-at-point-provider-alist) + :test 'equal))) (font-lock-update)) ;;;;; Backlinks' buffer