[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tmr fb57e9163f 3/7: Add tmr-confirm configuration optio
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tmr fb57e9163f 3/7: Add tmr-confirm configuration option |
Date: |
Wed, 29 Jun 2022 07:58:00 -0400 (EDT) |
branch: externals/tmr
commit fb57e9163f4697c68db16b34a8aff5e5b50b2af2
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add tmr-confirm configuration option
- I prefer uniform behavior for one and multiple timers, in particular
if destructive operations are involved.
- Setting tmr-confirm=t also helps Embark support if we use embark--restart.
Without this setting if we we have two timers, invoke tmr-cancel, cancel
the
second via embark-act, then the restart of the command will also
automatically
cancel the second.
- The alternative would be to not add such an option and remove the special
handling for single timers. But I see that some users may prefer the
behavior
enabled by tmr-confirm=nil.
---
tmr.el | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/tmr.el b/tmr.el
index 8b3167c26b..3a6cc87010 100644
--- a/tmr.el
+++ b/tmr.el
@@ -67,6 +67,12 @@ If nil, don't play any sound."
file
(const :tag "Off" nil)))
+(defcustom tmr-confirm t
+ "Confirm timer operations.
+If set to nil and if there is only a single timer,
+the operation is performed without confirmation."
+ :type 'boolean)
+
(defcustom tmr-timer-created-functions
(list #'tmr-print-message-for-created-timer)
"Functions to execute when a timer is created.
@@ -269,13 +275,12 @@ cancelling the original one."
(format " (%s remaining)" (tmr--format-remaining timer))))
(defun tmr--read-timer (&optional active)
- "Let the user choose a timer among all timers.
-Return the selected timer. If there is a single timer, use that.
-If there are multiple timers, prompt for one with completion. If
-there are no timers, return nil.
+ "Let the user choose a timer among all (or ACTIVE) timers.
-If optional ACTIVE is non-nil, limit the list of timers to those
-that are still running."
+Return the selected timer. If there is a single timer and
+`tmr-confirm' is nil, use that. If there are multiple timers,
+prompt for one with completion. If there are no timers, throw an
+error."
(or
(run-hook-with-args-until-success 'tmr--read-timer-hook)
(pcase
@@ -283,7 +288,7 @@ that are still running."
(seq-remove #'tmr--timer-finishedp tmr--timers)
tmr--timers)
('nil (user-error "No timers available"))
- (`(,timer) timer)
+ ((and `(,timer) (guard (not tmr-confirm))) timer)
(timers
(let* ((timer-list (mapcar
(lambda (x)
- [elpa] externals/tmr updated (aa521d5ce6 -> 7fae717b1b), ELPA Syncer, 2022/06/29
- [elpa] externals/tmr 88a16c9ac5 2/7: Add tmr-remove for uniformity with other commands, ELPA Syncer, 2022/06/29
- [elpa] externals/tmr fb57e9163f 3/7: Add tmr-confirm configuration option,
ELPA Syncer <=
- [elpa] externals/tmr b1aa243d90 1/7: Fix completion table, handle null completion, ELPA Syncer, 2022/06/29
- [elpa] externals/tmr 71f34405cb 4/7: tmr--read-timer: Add PROMPT argument, ELPA Syncer, 2022/06/29
- [elpa] externals/tmr 7fae717b1b 7/7: Remove unused macros from README.org, ELPA Syncer, 2022/06/29
- [elpa] externals/tmr 4ea7d30ef4 5/7: Update documentation to reflect current state, ELPA Syncer, 2022/06/29
- [elpa] externals/tmr 323da8d075 6/7: Make the README.org metadata easier to read, ELPA Syncer, 2022/06/29