Skip to content

Commit 127981e

Browse files
committed
feat: Optionally clear history with `work-timer-end'
Previously, `work-timer-end' would optionally not clear the history. I find this new behavior more intuitive.
1 parent a3ed547 commit 127981e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

work-timer.el

+5-5
Original file line numberDiff line numberDiff line change
@@ -639,10 +639,10 @@ sexps to calculate the value."
639639
(run-hooks 'work-timer-cycle-finish-hook)))
640640

641641
;;;###autoload
642-
(defun work-timer-end (arg)
643-
"End the current timer and clear history.
644-
If called with ARG, just end the current timer without clearing
645-
history."
642+
(defun work-timer-end (&optional clear-history)
643+
"End the current timer.
644+
If CLEAR-HISTORY is non-nil (e.g. command called with `prefix-arg'), also
645+
clear `work-timer-history'."
646646
(interactive "^P")
647647
(when (timerp work-timer-current-timer)
648648
(cancel-timer work-timer-current-timer))
@@ -654,7 +654,7 @@ history."
654654
work-timer-pause-time nil
655655
work-timer-pauses nil
656656
global-mode-string (remove 'work-timer-mode-line-string global-mode-string))
657-
(unless arg (setq work-timer-history nil))
657+
(when clear-history (setq work-timer-history nil))
658658
(force-mode-line-update t)
659659
(work-timer--log "(work-timer-end) Timer ended"))
660660

0 commit comments

Comments
 (0)