From 4449a1cc9eae315562a144500301dd85033a14a6 Mon Sep 17 00:00:00 2001 From: Brady McDonough Date: Sun, 5 Mar 2023 14:25:47 -0700 Subject: [PATCH] Corrected kill hook behaviour --- tacc.el | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/tacc.el b/tacc.el index 07693ac..1c51770 100644 --- a/tacc.el +++ b/tacc.el @@ -270,16 +270,6 @@ registered" sym-name) (graph-start . ,(copy-marker 0)) (graph-end . ,(copy-marker 0))))) -;; ERROR: It seems like this style of ticker doesn't work and I don't have time to look into it -;; more deeply. As far as I can tell I've copied the reference examples pretty closely. -;; In the meantime a "dumber" solution that works is being used -;; (defun cycle-ticker () -;; "A closure with an internal count, only increments when fed 'break timer state" -;; (let ((ticker 0)) -;; (lambda (&optional state) -;; (cond ((eq state 'break) (setq ticker (1+ ticker))) -;; ( 't ticker))))) - (defun tacc-info-initial () "Returns the initial state of tacc-info" `((history . ()) @@ -415,7 +405,8 @@ Note, if there is no tacc-buffer then you shouldn't be touching tacc-info" "Ask for confirmation if a timer is still running" (if (tacc-running?) (yes-or-no-p "Are you sure you want to kill the timer buffer? This will\ - end the current timer session as well."))) + end the current timer session as well.") + t)) (defun tacc-buffer-cleanup () "Save and cleanup the timer state if a timer is still live" @@ -480,6 +471,7 @@ Note, if there is no tacc-buffer then you shouldn't be touching tacc-info" tacc-display-buffer-window-settings)))) (with-current-buffer buffer (tacc-timer-mode) + (make-local-variable 'kill-buffer-query-functions) (add-hook 'kill-buffer-query-functions 'tacc-kill-buffer-confirm) (let ((width (window-total-width window 'floor)) (inhibit-read-only t)) @@ -623,8 +615,8 @@ Returns the current tag if no prompt is made" "Sets a tag for live timer sessions going forward" (interactive) (if (tacc-running?) - (setcdr (assoc 'tag tacc-info) (tacc-tag-prompt))) - (message "There isn't a live timer session to tag")) + (setcdr (assoc 'tag tacc-info) (tacc-tag-prompt)) + (message "There isn't a live timer session to tag"))) (defun tacc-cycle-increment (state) "Increments the cycle counter if the current state is a 'break"