fixup! Made core state structure buffer local, more idiomatic and denested logic

Final structural errors cleared
master
Brady McDonough 3 years ago
parent 6daad48dad
commit f46b9b41c0

@ -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"

Loading…
Cancel
Save