From 5ae038d2f5f8fbd08a8183367223493e998eae8a Mon Sep 17 00:00:00 2001 From: Brady McDonough Date: Wed, 2 Aug 2023 21:47:13 -0600 Subject: [PATCH] Replaced old state check --- tacc.el | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tacc.el b/tacc.el index 8c1932e..56adfc7 100644 --- a/tacc.el +++ b/tacc.el @@ -448,14 +448,14 @@ Note, if there is no tacc-buffer then you shouldn't be touching tacc-info" (defun tacc-kill-buffer-confirm () "Ask for confirmation if a timer is still running" - (if (tacc-running?) + (if (tacc-session?) (yes-or-no-p "Are you sure you want to kill the timer buffer? This will\ end the current timer session as well.") t)) (defun tacc-buffer-cleanup () "Save and cleanup the timer state if a timer is still live" - (if (tacc-running?) + (if (tacc-session?) (progn (tacc-deschedule) (tacc-push-current)))) @@ -660,7 +660,7 @@ Returns the current tag if no prompt is made" (defun tacc-set-tag () "Sets a tag for live timer sessions going forward" (interactive) - (if (tacc-running?) + (if (tacc-session?) (setcdr (assoc 'tag tacc-info) (tacc-tag-prompt)) (message "There isn't a live timer session to tag"))) @@ -674,7 +674,7 @@ Returns the current tag if no prompt is made" (defun tacc-timer-state-forward () "Move the tacc timer state forward" (interactive) - (if (tacc-running?) + (if (tacc-live?) (let* ((state-place (assoc 'state tacc-info)) (state (cdr state-place)) (work-ts (assoc 'work-ts tacc-info)) @@ -695,7 +695,7 @@ Returns the current tag if no prompt is made" (defun tacc-timer-state-skip () "Move the tacc timer state to a new work cycle" (interactive) - (if (tacc-running?) + (if (tacc-live?) (let* ((state-place (assoc 'state tacc-info)) (work-ts (assoc 'work-ts tacc-info)) (end-ts (assoc 'end-ts tacc-info)) @@ -721,7 +721,7 @@ Returns the current tag if no prompt is made" (defun tacc-hold-timer () "Pause/unpause the tacc timer session" (interactive) - (if (tacc-running?) + (if (tacc-session?) (let ((state (alist-get 'state tacc-info))) (if (eq state 'pause) (tacc-unpause-timer) @@ -732,11 +732,13 @@ Returns the current tag if no prompt is made" (defun tacc-end-timer () "Ends the current timer session, runs serialization and kills the buffer" (interactive) - (tacc-deschedule) - (tacc-push-current) - (tacc-save-record (assoc 'history tacc-info)) - (setcdr (assoc 'state tacc-info) 'stop) - (kill-buffer (tacc-buffer))) + (if (tacc-session?) + (progn + (tacc-deschedule) + (tacc-push-current) + (tacc-save-record (assoc 'history tacc-info)) + (setcdr (assoc 'state tacc-info) 'stop) + (kill-buffer (tacc-buffer))))) ;; 09 Hooks setup (add-hook 'after-init-hook 'tacc-load-tag-history)