branch: externals/tmr commit 91a4947f60b677ea897b2642efdd01b06ea49d00 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Add function to test if there are running timers Thanks to Eugene Mikhaylov for suggesting this idea in issue 9: <https://github.com/protesilaos/tmr/issues/9>. --- README.org | 2 +- tmr.el | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.org b/README.org index cca6d87ba7..c3710dae29 100644 --- a/README.org +++ b/README.org @@ -465,7 +465,7 @@ TMR is meant to be a collective effort. Every bit of help matters. Mendler, Steven Allen. + Contributions to the code or manual :: Christian Tietze, Ed Tavinor, - Mirko Hernandez, Nathan R. DeGruchy. + Eugene Mikhaylov, Mirko Hernandez, Nathan R. DeGruchy. * GNU Free Documentation License :PROPERTIES: diff --git a/tmr.el b/tmr.el index 62817e3cee..31c4710285 100644 --- a/tmr.el +++ b/tmr.el @@ -1008,9 +1008,13 @@ they are set to reasonable default values." ;;;; Ask if there are timers before exiting Emacs +(defun tmr-running-timers-p () + "Return non-nil if there are running timers." + (and tmr--timers (seq-remove #'tmr--timer-finishedp tmr--timers))) + (defun tmr-kill-emacs-query-function () "Ask before exiting Emacs if there are any active TMR timers." - (if (not (and tmr--timers (seq-remove #'tmr--timer-finishedp tmr--timers))) + (if (not (tmr-running-timers-p)) t (tmr-tabulated-view (get-buffer-create "*tmr-tabulated-view*")