From 5994fefce6852ff115d97e34525c3ba7dea62366 Mon Sep 17 00:00:00 2001 From: Brady McDonough Date: Wed, 2 Aug 2023 11:15:17 -0600 Subject: [PATCH] Beefed up invariant --- tacc.el | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tacc.el b/tacc.el index f28079d..eba06b8 100644 --- a/tacc.el +++ b/tacc.el @@ -49,7 +49,8 @@ ;;; Code: -;; TODOS: +;; TODOS: tacc-running? needs to be replaced by tacc-session? and tacc-live? depending on context +;; ;; ERROR: timer shutdown seems to leave things in a wrong state and buffer doesn't die properly ;; Check on the logic of push-current, needs predicates rather than lazy if conditions ;; I'm not calling anything to destroy the buffer on desched @@ -287,7 +288,6 @@ registered" sym-name) "Timer object controlling tacc's second-by-second update") ;; 05.2 State checks -;; TODO: tacc-running? needs to be replaced by tacc-session? and tacc-live? depending on context (defun tacc-buffer () @@ -316,7 +316,7 @@ registered" sym-name) (defun tacc-session? () "Checks if tacc session info indicates there should be session information" - (tacc-running-state? (alist-get 'state tacc-info))) + (tacc-session-state? (alist-get 'state tacc-info))) (defun tacc-history? () "Checks if tacc session has history information" @@ -328,10 +328,14 @@ registered" sym-name) "Returns t if tacc is in a legal state for mutating tacc-info Note, if there is no tacc-buffer then you shouldn't be touching tacc-info" (if (bufferp (tacc-buffer)) - (if (and (tacc-running?) - (tacc-live?)) - t) - (signal 'tacc-error-illegal-buffer-state (tacc-buffer)))) + (if (tacc-live?) + (if (tacc-live-state?) + t + (signal 'tacc-error-illegal-buffer-state (tacc-buffer))) ;; Timer running without logical knowledge + (if (tacc-session-state?) + t + (signal 'tacc-error-illegal-buffer-state (tacc-buffer)))) ;; Buffer live without logical reason + (signal 'tacc-error-illegal-buffer-state (tacc-buffer)))) ;; We shouldn't be calling this when the buffer is dead ;; 05.3 Predicates and helpers (defun tacc-chime-p (countdown-ts)