branch: externals/denote
commit e86ab9a04ea9ea347f209ec35a83f08ce5868be4
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Make denote-get-path-by-id accept any file with an identifier
This is its intended purpose. The user was already able to, say,
create 'denote:' links to jpg files but 'denote-get-path-by-id' was
refusing to resolve the path.
Thanks to user relict007 for reporting the problem and discussing it
with me in issue 135 on the GitHub mirror:
<https://github.com/protesilaos/denote/issues/135>.
---
README.org | 2 +-
denote.el | 9 +++------
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/README.org b/README.org
index a174425f4a..f191cb6b4e 100644
--- a/README.org
+++ b/README.org
@@ -3851,7 +3851,7 @@ Denote is meant to be a collective effort. Every bit of
help matters.
Johan Bolmsjö, Kaushal Modi, M. Hadi Timachi, Mirko Hernandez, Paul
van Gelder, Peter Prevos, Shreyas Ragavan, Stefan Thesing, Summer
Emacs, Sven Seebeck, Taoufik, Viktor Haag, Yi Liu, Ypot, atanasj,
- drcxd, hpgisler, pRot0ta1p, rbenit68, sienic, sundar bp.
+ drcxd, hpgisler, pRot0ta1p, rbenit68, relict007, sienic, sundar bp.
Special thanks to Peter Povinec who helped refine the file-naming
scheme, which is the cornerstone of this project.
diff --git a/denote.el b/denote.el
index 0b060670ce..5b4a784b8e 100644
--- a/denote.el
+++ b/denote.el
@@ -771,12 +771,9 @@ whatever matches `denote-excluded-directories-regexp'."
(defun denote-get-path-by-id (id)
"Return absolute path of ID string in `denote-directory-files'."
(seq-find
- (lambda (f)
- (and (string-prefix-p id (file-name-nondirectory f))
- ;; The directory can contain exported html and other
- ;; derivative files that have the same name sans extetion as
- ;; the note.
- (denote-file-is-note-p f)))
+ (lambda (file)
+ (and (denote-file-has-identifier-p file)
+ (string-prefix-p id (file-name-nondirectory file))))
(denote-directory-files)))
(define-obsolete-function-alias