Use denote-link-markdown-follow only if there is a link

Otherwise, we are breaking general markdown-mode functionality.

Thanks to pmenair for bringing this matter to my attention in issue
290: <https://github.com/protesilaos/denote/issues/290>.
This commit is contained in:
Protesilaos Stavrou 2024-03-14 15:50:39 +02:00
parent 1718cac272
commit fa8bda2cab
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA
2 changed files with 4 additions and 4 deletions

View file

@ -5339,7 +5339,7 @@ Denote is meant to be a collective effort. Every bit of help matters.
Monnier, Stefan Thesing, Thibaut Benjamin, Tomasz Hołubowicz, Vedang
Manerikar, Wesley Harvey, Zhenxu Xu, arsaber101, ezchi, jarofromel,
leinfink (Henrik), l-o-l-h (Lincoln), mattyonweb, maxbrieiev,
mentalisttraceur, relict007.
mentalisttraceur, pmenair, relict007.
+ Ideas and/or user feedback :: Abin Simon, Aditya Yadav, Alan
Schmitt, Aleksandr Vityazev, Alex Hirschfeld, Alfredo Borrás, Ashton

View file

@ -3954,9 +3954,9 @@ positions, limit the process to the region in-between."
(defun denote-link-markdown-follow (link)
"Function to open Denote file present in LINK.
To be assigned to `markdown-follow-link-functions'."
(string-match denote-id-regexp link)
(funcall denote-link-button-action
(denote-get-path-by-id (match-string 0 link))))
(when (ignore-errors (string-match denote-id-regexp link))
(funcall denote-link-button-action
(denote-get-path-by-id (match-string 0 link)))))
(eval-after-load 'markdown-mode
'(add-hook 'markdown-follow-link-functions #'denote-link-markdown-follow))