[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tmr bf63d033f2 1/2: tmr: accept no-hooks arg in tmr-can
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tmr bf63d033f2 1/2: tmr: accept no-hooks arg in tmr-cancel |
Date: |
Sun, 15 May 2022 04:58:01 -0400 (EDT) |
branch: externals/tmr
commit bf63d033f25d18ecab9f31455f11f47ec74f1d2c
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
tmr: accept no-hooks arg in tmr-cancel
There are some cases where we call tmr-cancel from Lisp and do not want
to print a message about it or perform any other function.
---
tmr.el | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tmr.el b/tmr.el
index 1230eeaac5..1ca6fd124c 100644
--- a/tmr.el
+++ b/tmr.el
@@ -266,16 +266,20 @@ Populated by `tmr' and then operated on by `tmr-cancel'.")
(cl-find creation-date tmr--timers :key #'tmr--timer-creation-date))
;;;###autoload
-(defun tmr-cancel (timer)
+(defun tmr-cancel (timer &optional no-hooks)
"Cancel TIMER object set with `tmr' command.
Interactively, let the user choose which timer to cancel with
-completion."
- (interactive (list (tmr--read-timer :active)))
+completion.
+
+With optional NO-HOOKS refrain from calling
+`tmr-timer-cancelled-functions'."
+ (interactive (list (tmr--read-timer :active) current-prefix-arg))
(if (not timer)
(user-error "No `tmr' to cancel")
(cancel-timer (tmr--timer-timer-object timer))
(setq tmr--timers (cl-delete timer tmr--timers))
- (run-hook-with-args 'tmr-timer-cancelled-functions timer)))
+ (unless no-hooks
+ (run-hook-with-args 'tmr-timer-cancelled-functions timer))))
(defun tmr--read-timer (&optional active)
"Let the user choose a timer among all timers.