[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 8a8be90200 1/9: Relax conditionality for adding
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 8a8be90200 1/9: Relax conditionality for adding links |
Date: |
Sat, 13 Aug 2022 03:57:29 -0400 (EDT) |
branch: externals/denote
commit 8a8be90200bb90edff5149cd7153c40536864a5e
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Relax conditionality for adding links
The idea is to be able to create a 'denote:' link to any file that has a
Denote identifier and is in the 'denote-directory'.
There still are some refinements to be made, though they belong to
separate commits.
Thanks to Peter Prevos for discussing this on the mailing list:
<https://lists.sr.ht/~protesilaos/denote/%3C87fsi1m5ze.fsf@prevos.net%3E>.
---
denote.el | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/denote.el b/denote.el
index 59ed2ad722..76cc843914 100644
--- a/denote.el
+++ b/denote.el
@@ -446,6 +446,11 @@ trailing hyphen."
;; Can this ever be t given the above?
(not (string-match-p "[#~]\\'" file)))))
+(defun denote--file-has-identifier-p (file)
+ "Return non-nil if FILE has a Denote identifier."
+ (let ((file-name (file-name-nondirectory file)))
+ (string-match-p denote--id-regexp (format "\\`%s" file-name))))
+
(defun denote--file-supported-extension-p (file)
"Return non-nil if FILE has supported extension."
(string-match-p (format "%s\\(.gpg\\)?\\'" denote--extension-regexp) file))
@@ -494,11 +499,11 @@ FILE must be an absolute path."
(defun denote--directory-files-matching-regexp (regexp)
"Return list of files matching REGEXP.
-The match is performed against the file name relative to the
-variable `denote-directory'."
+Files are those which satisfy `denote--file-has-identifier-p' and
+`denote--file-name-relative-to-denote-directory'."
(seq-filter
(lambda (f)
- (and (denote--only-note-p f)
+ (and (denote--file-has-identifier-p f)
(string-match-p regexp
(denote--file-name-relative-to-denote-directory f))))
(denote--directory-files)))
@@ -632,7 +637,7 @@ If optional KEY is non-nil, return the key instead."
"Prompt for regular file in variable `denote-directory'."
(read-file-name "Select note: " (denote-directory) nil nil nil
(lambda (f)
- (or (denote--only-note-p f)
+ (or (denote--file-has-identifier-p f)
(file-directory-p f)))))
(defun denote--retrieve-files-in-output (files)
- [elpa] externals/denote updated (75cbaaf3a1 -> 5482ce6dad), ELPA Syncer, 2022/08/13
- [elpa] externals/denote ff1aca7fc6 4/9: Simplify denote--directory-files-matching-regexp, ELPA Syncer, 2022/08/13
- [elpa] externals/denote 8a8be90200 1/9: Relax conditionality for adding links,
ELPA Syncer <=
- [elpa] externals/denote f6501c6d42 7/9: Fix regexp for denote--{title, keywords}-key-regexp, ELPA Syncer, 2022/08/13
- [elpa] externals/denote 7877d4c77c 8/9: Fix denote--migrate-type-files detection of old keywords when only one tag, ELPA Syncer, 2022/08/13
- [elpa] externals/denote 5482ce6dad 9/9: Update the manual's Acknowledgements, ELPA Syncer, 2022/08/13
- [elpa] externals/denote 0b8a24ca0c 2/9: Add helper to check regular+writable file, ELPA Syncer, 2022/08/13
- [elpa] externals/denote 4934870625 3/9: Tweak how links are formatted (due to 8a8be90), ELPA Syncer, 2022/08/13
- [elpa] externals/denote 1981a16aeb 5/9: Relax denote--directory-files conditionality, ELPA Syncer, 2022/08/13
- [elpa] externals/denote a07851218d 6/9: Fix confirmation message for denote-migrate-old-markdown-yaml-tags, ELPA Syncer, 2022/08/13