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

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

[elpa] externals/tmr 407da662a2 10/10: tmr: make tmr-clone prompt option


From: ELPA Syncer
Subject: [elpa] externals/tmr 407da662a2 10/10: tmr: make tmr-clone prompt optionally
Date: Sun, 15 May 2022 02:58:19 -0400 (EDT)

branch: externals/tmr
commit 407da662a235c8884dfc9e48ddabf1c54e01978f
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    tmr: make tmr-clone prompt optionally
---
 tmr.el | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/tmr.el b/tmr.el
index 96237029ab..1230eeaac5 100644
--- a/tmr.el
+++ b/tmr.el
@@ -393,12 +393,24 @@ user uses a prefix argument (\\[universal-argument])."
   (tmr time description))
 
 ;;;###autoload
-(defun tmr-clone (timer)
-  "Create a new timer by cloning TIMER."
-  (interactive (list (tmr--read-timer)))
-  (tmr (tmr--read-duration
-        (format "%ss" (tmr--timer-duration timer)))
-       (tmr--timer-description timer)))
+(defun tmr-clone (timer &optional prompt)
+  "Create a new timer by cloning TIMER.
+With optional PROMPT, such as a prefix argument, ask for
+confirmation about the duration and the description.  The
+description is asked only if TIMER had one.
+
+Without a PROMPT, clone TIMER outright."
+  (interactive (list (tmr--read-timer) current-prefix-arg))
+  (let ((description (tmr--timer-description timer)))
+    (cond
+     (prompt
+      (tmr
+       (tmr--read-duration (format "%s" (tmr--timer-input timer)))
+       (when description (tmr--description-prompt description))))
+     (t
+      (tmr
+       (format "%s" (tmr--timer-input timer))
+       (tmr--timer-description timer))))))
 
 (provide 'tmr)
 ;;; tmr.el ends here



reply via email to

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