branch: externals/denote commit add8f657bb69f75c60945a13e7d2ed03fc4fc196 Merge: 01618516ff c020d25a21 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: GitHub <nore...@github.com>
Merge pull request #25 from ggjp/subdir-support Fix denote-link--ol-resolve-link-to-target --- 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)))