From f46b9b41c0efc566a5d67f834f9e9e3417476496 Mon Sep 17 00:00:00 2001 From: Brady McDonough Date: Sat, 28 Jan 2023 15:47:13 -0700 Subject: [PATCH] fixup! Made core state structure buffer local, more idiomatic and denested logic Final structural errors cleared --- tacc.el | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tacc.el b/tacc.el index 4206a25..9ee274b 100644 --- a/tacc.el +++ b/tacc.el @@ -417,12 +417,12 @@ Note, if there is no tacc-buffer then you shouldn't be touching tacc-info" (+ len (if (<= ticker rem) 1 0))))) (defun gradient-string (width chars) - (mapconcat ((let ((ticker 0)) + (mapconcat (let ((ticker 0)) (lambda (c) (let ((rem (mod width (length chars))) (len (/ width (length chars)))) (make-string (progn (setf ticker (1+ ticker)) (+ len (if (<= ticker rem) 1 0))) - c))))) + c)))) chars "")) (defun tacc-header-render (width) @@ -534,18 +534,18 @@ float" (tacc-render-with-buffer (tacc-insert-between .clock-start .clock-end - (let-alist tacc-info) + (let-alist tacc-info (tacc-clock-render state .work-ts .end-ts now))) (tacc-insert-between .graph-start .graph-end (tacc-current-tag-render) - (let-alist tacc-info) + (let-alist tacc-info (let* ((end (if (> now .end-ts) now .end-ts)) (total (- end .work-ts)) (work-prop (/ (- (if .break-ts .break-ts now) .work-ts) total)) (break-prop (/ (if .break-ts (- now .break-ts) 0) total)) (void-prop (- 1 (+ work-prop break-prop)))) - (tacc-graph-bar-render width work-prop break-prop void-prop)))) + (tacc-graph-bar-render width work-prop break-prop void-prop)))))) (defun tacc-new-graph-bar-render () (tacc-render-with-buffer @@ -572,7 +572,7 @@ float" (defun tacc-tag-prompt () "Prompt for a tag and return the user's input" (let ((last-tag (if (bufferp (tacc-buffer)) - (alist-get 'tag tacc-info)) + (alist-get 'tag tacc-info) nil)) (completions (append (flatten-tree (apply 'eval (if tacc-tag-completion-functions @@ -587,7 +587,7 @@ float" 'stringp nil nil - 'tacc-tag-history)) + 'tacc-tag-history))) (defun tacc-tag-prompt-soft () "Prompt for a tag unless the user doesn't want us to @@ -665,12 +665,11 @@ Returns the current tag if no prompt is made" "Pause/unpause the tacc timer session" (interactive) (if (tacc-running?) - (tacc-with-buffer - (let ((state (alist-get 'state tacc-info))) - (if (eq state 'pause) - (tacc-unpause-timer) - (tacc-pause-timer)))) - (message "There isn't a live timer session to pause/unpause"))) + (let ((state (alist-get 'state tacc-info))) + (if (eq state 'pause) + (tacc-unpause-timer) + (tacc-pause-timer)))) + (message "There isn't a live timer session to pause/unpause")) (defun tacc-end-timer () "Ends the current timer session, runs serialization and kills the buffer"