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

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

[elpa] externals/denote 8256c85df9 5/7: Rename denote--file-type-symbol


From: ELPA Syncer
Subject: [elpa] externals/denote 8256c85df9 5/7: Rename denote--file-type-symbol to denote--valid-file-type
Date: Thu, 11 Aug 2022 02:57:33 -0400 (EDT)

branch: externals/denote
commit 8256c85df98cc6de2adf9447639a4c3e4723fe4d
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Rename denote--file-type-symbol to denote--valid-file-type
    
    - denote--valid-file-type takes a filetype argument (string or symbol)
    and returns a valid filetype symbol.
---
 denote.el | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/denote.el b/denote.el
index 2e9e690133..a76c62b8ce 100644
--- a/denote.el
+++ b/denote.el
@@ -781,7 +781,7 @@ provided by `denote'.  FILETYPE is one of the values of
       ('text (format denote-text-front-matter title date
                      (denote--format-front-matter-keywords keywords 'text)
                      id denote-text-front-matter-delimiter))
-      (_ (format denote-org-front-matter title date
+      ('org (format denote-org-front-matter title date
                  (denote--format-front-matter-keywords keywords 'org) id)))))
 
 (defun denote--path (title keywords dir id file-type)
@@ -844,14 +844,15 @@ and TEMPLATE should be valid for note creation."
                               (expand-file-name directory)))
     directory))
 
-(defun denote--file-type-symbol (filetype)
-  "Return FILETYPE as a symbol."
-  (cond
-   ((stringp filetype)
-    (intern filetype))
-   ((symbolp filetype)
-    filetype)
-   (t (user-error "`%s' is not a symbol or string" filetype))))
+(defun denote--valid-file-type (filetype)
+  "Return a valid filetype given the argument FILETYPE."
+  (unless (or (symbolp filetype) (stringp filetype))
+    (user-error "`%s' is not a symbol or string" filetype))
+  (when (stringp filetype)
+    (setq filetype (intern filetype)))
+  (if (memq filetype '(text org markdown-toml markdown-yaml))
+      filetype
+    'org))
 
 (defun denote--date-add-current-time (date)
   "Add current time to DATE, if necessary.
@@ -951,7 +952,7 @@ When called from Lisp, all arguments are optional.
          ('template (aset args 5 (denote--template-prompt)))))
      (append args nil)))
   (let* ((title (or title ""))
-         (file-type (denote--file-type-symbol (or file-type denote-file-type)))
+         (file-type (denote--valid-file-type (or file-type denote-file-type)))
          (date (if (or (null date) (string-empty-p date))
                    (current-time)
                  (denote--valid-date date)))



reply via email to

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