branch: externals/denote commit 77ecfa0805977483bfa44b8bf221b7bfde66113e Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Make denote-id-to-date public --- README.org | 4 ++++ denote.el | 15 ++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.org b/README.org index 4cddb8c50d..b304f64958 100644 --- a/README.org +++ b/README.org @@ -5094,6 +5094,10 @@ The following sections cover the specifics. ~denote-directory~ accepts a directory-local value for what we call "silos" ([[#h:15719799-a5ff-4e9a-9f10-4ca03ef8f6c5][Maintain separate directories for notes]]). +#+findex: denote-id-to-date ++ Function ~denote-id-to-date~ :: Convert =IDENTIFIER= to a date + string of the form =YYYY-MM-DD=. [ Made public as part of {{{development-version}}}. ] + ** Predefined note values for developers or advanced users :PROPERTIES: :CUSTOM_ID: h:a8b9082c-8bd5-492d-8da7-4f41ee493d59 diff --git a/denote.el b/denote.el index 78c702c421..6e19e459de 100644 --- a/denote.el +++ b/denote.el @@ -2720,7 +2720,12 @@ If DATE is nil or an empty string, return nil." (t ; non-empty strings (e.g. "2024-01-01", "2024-01-01 12:00", etc.) (date-to-time (denote--date-add-current-time date))))) -(defun denote--id-to-date (identifier) +(define-obsolete-function-alias + 'denote--id-to-date + 'denote-id-to-date + "4.1.0") + +(defun denote-id-to-date (identifier) "Convert IDENTIFIER string to YYYY-MM-DD." (if (denote-identifier-p identifier) (replace-regexp-in-string @@ -4870,14 +4875,14 @@ active, use it as the description." ;; but I think we are okay with a hardcoded value. (cons ?I (or (when-let* ((id (denote-retrieve-filename-identifier file)) (_ (denote-valid-date-p id))) - (format-time-string "%A, %e %B %Y" (date-to-time (denote--id-to-date id)))) + (format-time-string "%A, %e %B %Y" (date-to-time (denote-id-to-date id)))) "")) (cons ?D (cond ((denote-retrieve-front-matter-title-value file type)) ((denote-retrieve-filename-title file)) ((when-let* ((id (denote-retrieve-filename-identifier file))) (if (denote-valid-date-p id) - (format-time-string "%A, %e %B %Y" (date-to-time (denote--id-to-date id))) + (format-time-string "%A, %e %B %Y" (date-to-time (denote-id-to-date id))) id))) (t ""))) (cons ?d (or (denote-retrieve-filename-identifier file) "")) @@ -6586,7 +6591,7 @@ buffer will be used, if available." ;; but I think we are okay with a hardcoded value. (cons ?I (or (when-let* ((id (denote-retrieve-filename-identifier file)) (_ (denote-valid-date-p id))) - (format-time-string "%A, %e %B %Y" (date-to-time (denote--id-to-date id)))) + (format-time-string "%A, %e %B %Y" (date-to-time (denote-id-to-date id)))) "")) (cons ?d (or (denote-retrieve-filename-identifier file) "")) (cons ?D (cond @@ -6594,7 +6599,7 @@ buffer will be used, if available." ((denote-retrieve-filename-title file)) ((when-let* ((id (denote-retrieve-filename-identifier file))) (if (denote-valid-date-p id) - (format-time-string "%A, %e %B %Y" (date-to-time (denote--id-to-date id))) + (format-time-string "%A, %e %B %Y" (date-to-time (denote-id-to-date id))) id))) (t ""))) (cons ?s (or (denote-retrieve-filename-signature file) ""))