emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/denote 59ccadd7a4 1/4: Harden the conditionality of den


From: ELPA Syncer
Subject: [elpa] externals/denote 59ccadd7a4 1/4: Harden the conditionality of denote--valid-file-type
Date: Fri, 1 Dec 2023 03:57:51 -0500 (EST)

branch: externals/denote
commit 59ccadd7a4be22eb4625ef2d7fab01ea8019af4f
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Harden the conditionality of denote--valid-file-type
---
 denote.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/denote.el b/denote.el
index 3fb3faba96..1f102ce806 100644
--- a/denote.el
+++ b/denote.el
@@ -1617,12 +1617,16 @@ TEMPLATE, and SIGNATURE should be valid for note 
creation."
                         (expand-file-name directory))))
 
 (defun denote--valid-file-type (filetype)
-  "Return a valid filetype given the argument FILETYPE.
+  "Return a valid filetype symbol given the argument FILETYPE.
 If none is found, the first element of `denote-file-types' is
 returned."
-  (if (memq filetype (mapcar 'car denote-file-types))
-      filetype
-    (caar denote-file-types)))
+  (let ((type (cond
+               ((stringp filetype) (intern filetype))
+               ((symbolp filetype) filetype)
+               (t (error "The `%s' is neither a string nor a symbol" 
filetype)))))
+    (if (memq type (denote--file-type-keys))
+        type
+      (caar denote-file-types))))
 
 (defun denote--date-add-current-time (date)
   "Add current time to DATE, if necessary.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]