From 2dad0ced49cff99e43a15b6ddcb04715cfe743c0 Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Sun, 14 Aug 2022 18:36:57 +0500 Subject: [PATCH] fix: removed lambdas from transient --- pomm-third-time.el | 29 +++++++++++++++++------------ pomm.el | 3 ++- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/pomm-third-time.el b/pomm-third-time.el index e8e4361..97536ac 100644 --- a/pomm-third-time.el +++ b/pomm-third-time.el @@ -115,6 +115,7 @@ This is an alist with the following keys: (defun pomm-third-time--do-reset () "Reset the Third Time timer state." + (interactive) (when pomm-third-time--timer (cancel-timer pomm-third-time--timer) (setq pomm-third-time--timer nil)) @@ -190,7 +191,7 @@ If the variable is nil, the function does nothing." (transient-define-prefix pomm-third-time-reset () ["Are you sure you want to reset the Third Time timer?" - ("y" "Yes" (lambda () (interactive) (pomm-third-time--do-reset))) + ("y" "Yes" pomm-third-time--do-reset) ("n" "No" transient-quit-one)]) (defun pomm-third-time--dispatch-current-sound () @@ -378,19 +379,23 @@ Take a look at the `pomm-third-time' function for more details." "Check if the timer is running." (eq (alist-get 'status pomm-third-time--state) 'running)) +(defun pomm-third-time--stop () + "Stop the running Third Time timer." + (interactive) + (unless (pomm-third-time--can-stop-p) + (user-error "The timer is not running!")) + (pomm-third-time--store-current-to-history) + (setf (alist-get 'status pomm-third-time--state) 'stopped + (alist-get 'current pomm-third-time--state) nil + (alist-get 'last-changed-time pomm-third-time--state) + (time-convert nil 'integer)) + (run-hooks 'pomm-third-time-on-status-changed-hook) + (when pomm-reset-context-on-iteration-end + (setf (alist-get 'context pomm-third-time--state) nil))) + (transient-define-prefix pomm-third-time-stop () ["This will reset the accumulated break time. Continue?" - ("y" "Yes" (lambda () (interactive) - (unless (pomm-third-time--can-stop-p) - (user-error "The timer is not running!")) - (pomm-third-time--store-current-to-history) - (setf (alist-get 'status pomm-third-time--state) 'stopped - (alist-get 'current pomm-third-time--state) nil - (alist-get 'last-changed-time pomm-third-time--state) - (time-convert nil 'integer)) - (run-hooks 'pomm-third-time-on-status-changed-hook) - (when pomm-reset-context-on-iteration-end - (setf (alist-get 'context pomm-third-time--state) nil)))) + ("y" "Yes" pomm-third-time--stop) ("n" "No" transient-quit-one)]) (defun pomm-third-time-switch () diff --git a/pomm.el b/pomm.el index 8e15542..0a7e9a4 100644 --- a/pomm.el +++ b/pomm.el @@ -242,6 +242,7 @@ Updated by `pomm-update-mode-line-string'.") (defun pomm--do-reset () "Reset the pomodoro timer state." + (interactive) (when pomm--timer (cancel-timer pomm--timer) (setq pomm--timer nil)) @@ -316,7 +317,7 @@ variable doesn't exist, function does nothing." (transient-define-prefix pomm-reset () ["Are you sure you want to reset the Pomodoro timer?" - ("y" "Yes" (lambda () (interactive) (pomm--do-reset))) + ("y" "Yes" pomm--do-reset) ("n" "No" transient-quit-one)]) (defun pomm--maybe-play-sound (kind)