Simplify 'denote-parse-date' now that 'denote-valid-date-p' does the work

This commit is contained in:
Protesilaos Stavrou 2024-02-11 10:36:30 +02:00
parent 07e8d0bf90
commit a2229e03ff
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA
2 changed files with 8 additions and 21 deletions

View file

@ -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

View file

@ -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."