[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 459955287d 3/5: Add denote--extensions and refac
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 459955287d 3/5: Add denote--extensions and refactor denote--file-supported-extension-p |
Date: |
Mon, 15 Aug 2022 02:57:32 -0400 (EDT) |
branch: externals/denote
commit 459955287d1dcdbfbc301e8e73bf50b45371716e
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Add denote--extensions and refactor denote--file-supported-extension-p
---
denote.el | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/denote.el b/denote.el
index 0503732ee0..2918edf9a5 100644
--- a/denote.el
+++ b/denote.el
@@ -452,7 +452,13 @@ trailing hyphen."
(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))
+ (let* ((extensions (denote--extensions))
+ (valid-extensions (append extensions
+ (mapcar (lambda (e) (concat e ".gpg"))
+ extensions))))
+ (seq-some
+ (lambda (e) (string-suffix-p e file))
+ valid-extensions)))
(defun denote--file-regular-writable-p (file)
"Return non-nil if FILE is regular and writable."
@@ -742,6 +748,13 @@ Based on FILE-TYPE."
Based on FILE-TYPE."
(plist-get (alist-get file-type denote-file-types)
:keywords-value-reverse-function))
+(defun denote--extensions ()
+ "Return all extensions in `denote-file-type'."
+ (delete-dups
+ (mapcar (lambda (type)
+ (plist-get (cdr type) :extension))
+ denote-file-types)))
+
(defun denote--get-title-line-from-front-matter (title file-type)
"Retrieve title line from front matter based on FILE-TYPE.
Format TITLE in the title line. The returned line does not