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

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

[elpa] externals/denote 1d68f35021 3/7: Rework denote--date-prompt


From: ELPA Syncer
Subject: [elpa] externals/denote 1d68f35021 3/7: Rework denote--date-prompt
Date: Sat, 20 Aug 2022 21:57:31 -0400 (EDT)

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

    Rework denote--date-prompt
    
    When org-read-date is used and the seconds are 00, add the current
    seconds to the time returned by org-read-date.
---
 denote.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/denote.el b/denote.el
index 6cf7c3d532..4d0af88729 100644
--- a/denote.el
+++ b/denote.el
@@ -1131,10 +1131,13 @@ here for clarity."
 (defun denote--date-prompt ()
   "Prompt for date."
   (if denote-date-prompt-use-org-read-date
-      (let* ((org-time (org-read-date nil t))
-             (current-seconds (string-to-number
-                               (format-time-string "%S" (current-time))))
-             (time (time-add org-time current-seconds)))
+      (let* ((time (org-read-date nil t))
+             (org-time-seconds (format-time-string "%S" time))
+             (cur-time-seconds (format-time-string "%S" (current-time))))
+        ;; When the user does not input a time, org-read-date defaults to 00 
for seconds.
+        ;; When the seconds are 00, we add the current seconds to avoid 
identifier collisions.
+        (when (string-equal "00" org-time-seconds)
+          (setq time (time-add time (string-to-number cur-time-seconds))))
         (format-time-string "%Y-%m-%d %H:%M:%S" time))
     (read-string
      "DATE and TIME for note (e.g. 2022-06-16 14:30): "



reply via email to

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