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

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

[elpa] externals/denote a2229e03ff 09/12: Simplify 'denote-parse-date' n


From: ELPA Syncer
Subject: [elpa] externals/denote a2229e03ff 09/12: Simplify 'denote-parse-date' now that 'denote-valid-date-p' does the work
Date: Sun, 11 Feb 2024 03:57:54 -0500 (EST)

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

    Simplify 'denote-parse-date' now that 'denote-valid-date-p' does the work
---
 README.org | 11 +++++------
 denote.el  | 18 +++---------------
 2 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/README.org b/README.org
index 7b7f7af2e4..3f5fa2357f 100644
--- a/README.org
+++ b/README.org
@@ -3950,12 +3950,11 @@ might change them without further notice.
 
 #+findex: denote-parse-date
 + Function ~denote-parse-date~ :: Return =DATE= as an appropriate
-  value for the ~denote~ command. If =DATE= is a list, assume it is
-  consistent with ~current-date~ or related and return it as-is. If
-  =DATE= is a non-empty string, try to convert it with ~date-to-time~,
-  per ~denote-valid-date-p~. If =DATE= is none of the above, return
-  ~current-time~. [ The ~denote-valid-date-p~ is the new name of
-  ~denote--valid-date~ as part of {{{development-version}}}. ]
+  value for the ~denote~ command. Pass =DATE= through
+  ~denote-valid-date-p~ and use its return value. If either that or
+  =DATE= is nil, return ~current-time~. [ The ~denote-valid-date-p~ is
+  the new name of ~denote--valid-date~, with enhanced functionality.
+  Done as part of {{{development-version}}}. ]
 
 #+findex: denote-directory
 + Function ~denote-directory~ :: Return path of the variable
diff --git a/denote.el b/denote.el
index a73fa17036..2f59cffac2 100644
--- a/denote.el
+++ b/denote.el
@@ -1876,21 +1876,9 @@ If DATE is nil, return nil."
 
 (defun denote-parse-date (date)
   "Return DATE as an appropriate value for the `denote' command.
-
-- If DATE is non-nil and a list, assume it is consistent with
-  `current-date' or related and return it as-is.
-
-- If DATE is a non-empty string, try to convert it with
-  `date-to-time'.
-
-- If DATE is none of the above, return `current-time'."
-  (cond
-   ((and date (listp date))
-    date)
-   ((and (stringp date) (not (string-empty-p date)))
-    (denote--valid-date date))
-   (t
-    (current-time))))
+Pass DATE through `denote-valid-date-p' and use its return value.
+If either that or DATE is nil, return `current-time'."
+  (or (denote-valid-date-p date)) (current-time))
 
 (defun denote--buffer-file-names ()
   "Return file names of Denote buffers."



reply via email to

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