don't try to find forward links in non-text files

If a file extension is not in 'denote-file-types', we have no way of
parsing or finding outgoing links in it. This change checks for the
file extension early on in 'when-let*' block and avoids opening the
file which is a relatively costly operation (and would fail finding
links anyway).
This commit is contained in:
relict007 2023-05-15 08:08:55 +05:30 committed by Protesilaos Stavrou
parent 5b395c2d98
commit 7dc8f4bf7b
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA

View file

@ -2849,6 +2849,7 @@ whitespace-only), insert an ID-ONLY link."
"Return list of links in current or optional FILE.
Also see `denote-link-return-backlinks'."
(when-let* ((current-file (or file (buffer-file-name)))
((denote-file-has-supported-extension-p current-file))
(file-type (denote-filetype-heuristics current-file))
(regexp (denote--link-in-context-regexp file-type))
(links (with-current-buffer (find-file-noselect current-file)