branch: externals/denote commit c020d25a21e5b76da86f18780512e57c07b31f23 Author: Jean-Philippe Gagné Guay <jeanphilippe...@gmail.com> Commit: Jean-Philippe Gagné Guay <jeanphilippe...@gmail.com>
Fix denote-link--ol-resolve-link-to-target Clicking on a link in a note should open the linked note, even if it is in a parent directory or a subdirectory. --- denote-link.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/denote-link.el b/denote-link.el index 9b92a24468..83f6026c5a 100644 --- a/denote-link.el +++ b/denote-link.el @@ -553,11 +553,12 @@ inserts links with just the identifier." With optional PATH-ID return a cons cell consisting of the path and the identifier." (let* ((search (and (string-match "::\\(.*\\)\\'" link) - (match-string 1 link))) - (id (if (and (stringp search) (not (string-empty-p search))) + (match-string 1 link))) + (id (if (and (stringp search) (not (string-empty-p search))) (substring link 0 (match-beginning 0)) link)) - (path (expand-file-name (file-name-completion id (denote-directory))))) + (path (cl-find-if (lambda (f) (string-prefix-p id (file-name-nondirectory f))) + (denote--directory-files :absolute)))) (cond (path-id (cons (format "%s" path) (format "%s" id)))