Define :help-echo function for Org links

Thanks to Julian Hoch for asking about this. It was done via a private
channel and I am sharing the information with permission.
This commit is contained in:
Protesilaos Stavrou 2024-09-09 09:05:54 +03:00
parent d5cf6222d5
commit 23bc9dbca3
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA

View file

@ -4942,6 +4942,14 @@ backend."
((eq format 'md) (format "[%s](%s)" desc path))
(t path))))
(defun denote-link-ol-help-echo (_window _object position)
"Echo the full file path of the identifier at POSITION."
(when-let ((htmlize-link (get-text-property position 'htmlize-link))
(string (plist-get htmlize-link :uri))
(identifier (replace-regexp-in-string "denote:\\(.*?\\)\\(#.*\\)?" "\\1" string))
(path (denote-get-path-by-id identifier)))
path))
;; The `eval-after-load' part with the quoted lambda is adapted from
;; Elfeed: <https://github.com/skeeto/elfeed/>.
@ -4957,6 +4965,7 @@ backend."
"denote"
:follow #'denote-link-ol-follow
:face 'denote-faces-link
:help-echo #'denote-link-ol-help-echo
:complete #'denote-link-ol-complete
:store #'denote-link-ol-store
:export #'denote-link-ol-export)))))