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

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

[elpa] externals/denote a5ecae13cf 04/17: Obsolete denote-parse-date


From: ELPA Syncer
Subject: [elpa] externals/denote a5ecae13cf 04/17: Obsolete denote-parse-date
Date: Sun, 10 Nov 2024 00:57:51 -0500 (EST)

branch: externals/denote
commit a5ecae13cf7622d8bd5beac92151ac10a0c239ce
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>

    Obsolete denote-parse-date
---
 README.org               |  6 ------
 denote-journal-extras.el | 14 +++++++-------
 denote.el                | 19 +++++++++++--------
 3 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/README.org b/README.org
index 6dae35b058..574b3df034 100644
--- a/README.org
+++ b/README.org
@@ -5577,12 +5577,6 @@ might change them without further notice.
   or ~date-to-time~ .Those functions signal an error if =DATE= is a
   value they do not recognise. If =DATE= is nil, return nil.
 
-#+findex: denote-parse-date
-+ Function ~denote-parse-date~ :: Return =DATE= as an appropriate
-  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~.
-
 #+findex: denote-directory
 + Function ~denote-directory~ :: Return path of the variable
   ~denote-directory~ as a proper directory, also because it accepts a
diff --git a/denote-journal-extras.el b/denote-journal-extras.el
index e9b3164997..15287f92a3 100644
--- a/denote-journal-extras.el
+++ b/denote-journal-extras.el
@@ -150,9 +150,9 @@ date selection module.
 
 When called from Lisp DATE is a string and has the same format as
 that covered in the documentation of the `denote' function.  It
-is internally processed by `denote-parse-date'."
+is internally processed by `denote-valid-date-p'."
   (interactive (list (when current-prefix-arg (denote-date-prompt))))
-  (let ((internal-date (denote-parse-date date))
+  (let ((internal-date (or (denote-valid-date-p date) (current-time)))
         (denote-directory (denote-journal-extras-directory)))
     (denote
      (denote-journal-extras-daily--title-format internal-date)
@@ -163,7 +163,7 @@ is internally processed by `denote-parse-date'."
 
 (defun denote-journal-extras--entry-today (&optional date)
   "Return list of files matching a journal for today or optional DATE.
-DATE has the same format as that returned by `denote-parse-date'."
+DATE has the same format as that returned by `denote-valid-date-p'."
   (let* ((identifier (format "%sT[0-9]\\{6\\}" (format-time-string "%Y%m%d" 
date)))
          (files (denote-directory-files identifier))
          (keyword (concat "_" (regexp-quote denote-journal-extras-keyword))))
@@ -183,12 +183,12 @@ DATE has the same format as that returned by 
`denote-parse-date'."
 With optional DATE, do it for that date, else do it for today.  DATE is
 a string and has the same format as that covered in the documentation of
 the `denote' function.  It is internally processed by
-`denote-parse-date'.
+`denote-valid-date-p'.
 
 If there are multiple journal entries for the date, prompt for one among
 them using minibuffer completion.  If there is only one, return it.  If
 there is no journal entry, create it."
-  (let* ((internal-date (denote-parse-date date))
+  (let* ((internal-date (or (denote-valid-date-p date) (current-time)))
          (files (denote-journal-extras--entry-today internal-date)))
     (cond
      ((length> files 1)
@@ -218,7 +218,7 @@ date selection module.
 
 When called from Lisp, DATE is a string and has the same format
 as that covered in the documentation of the `denote' function.
-It is internally processed by `denote-parse-date'."
+It is internally processed by `denote-valid-date-p'."
   (interactive
    (list
     (when current-prefix-arg
@@ -242,7 +242,7 @@ date selection module.
 
 When called from Lisp, DATE is a string and has the same format
 as that covered in the documentation of the `denote' function.
-It is internally processed by `denote-parse-date'.
+It is internally processed by `denote-valid-date-p'.
 
 With optional ID-ONLY as a prefix argument create a link that
 consists of just the identifier.  Else try to also include the
diff --git a/denote.el b/denote.el
index 24a45666b7..37af20db03 100644
--- a/denote.el
+++ b/denote.el
@@ -2213,6 +2213,11 @@ where the former does not read dates without a time 
component."
   'denote-valid-date-p
   "2.3.0")
 
+(define-obsolete-function-alias
+  'denote-parse-date
+  'denote-valid-date-p
+  "3.2.0")
+
 (defun denote-valid-date-p (date)
   "Return DATE as a valid date.
 A valid DATE is a value that can be parsed by either
@@ -2230,13 +2235,6 @@ 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-parse-date (date)
-  "Return DATE as an appropriate value for the `denote' command.
-Pass DATE through `denote-valid-date-p' and use its return value.
-If either that or DATE is nil or an empty string, return
-`current-time'."
-  (or (denote-valid-date-p date) (current-time)))
-
 (defun denote--id-to-date (identifier)
   "Convert IDENTIFIER string to YYYY-MM-DD."
   (if (denote-identifier-p identifier)
@@ -2510,7 +2508,7 @@ instead of that of the parameter."
          (title (or title ""))
          (file-type (denote--valid-file-type (or file-type denote-file-type)))
          (keywords (denote-keywords-sort keywords))
-         (date (denote-parse-date date))
+         (date (denote-valid-date-p date))
          (directory (if (and directory (denote--dir-in-denote-directory-p 
directory))
                         (file-name-as-directory directory)
                       (denote-directory)))
@@ -2559,6 +2557,11 @@ When called from Lisp, all arguments are optional.
   (interactive (denote--creation-get-note-data-from-prompts))
   (pcase-let* ((`(,title ,keywords ,file-type ,directory ,date ,template 
,signature)
                 (denote--creation-prepare-note-data title keywords file-type 
directory date template signature))
+               ;; TODO: When the following line is removed, Denote should
+               ;; create a note without a date/id.  However, some features
+               ;; will not completely work (fontification, linking, etc.).
+               ;; They need to be reviewed before making this available.
+               (date (or date (current-time)))
                (id (denote--find-first-unused-id (denote-get-identifier date)))
                (note-path (denote--prepare-note title keywords date id 
directory file-type template signature)))
     (denote--keywords-add-to-history keywords)



reply via email to

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