Fixes to history-keeping

master
Brady McDonough 2 years ago
parent 8e1eabcddc
commit 079a3e60b4

@ -49,15 +49,14 @@
;;; Code:
;; TODOS: Buffer kill hook not triggered on exit?
;; Split buffer update into clock and graph sections
;; TODOS: Split buffer update into clock and graph sections
;; - As it is, pausing the timer can't draw a full buffer and ends up
;; erasing the previous time graph
;; The buffer could render in smoother, just set points don't render empty data
;; Center the clock-countdown display
;; Add time brackets to time graph
;;
;; ERROR:
;;
;; ERROR: Check on the logic of push-current, needs predicates rather than lazy if conditions
;; history field is not populating
;; BUG: Break timer displays wrong time and sign
;;
@ -279,7 +278,7 @@ registered" sym-name)
(defun tacc-info-initial ()
"Returns the initial state of tacc-info"
(copy-alist `((history . ())
(copy-alist `((history . (nil))
(cycle . 0)
(work-ts . nil)
(break-ts . nil)
@ -427,7 +426,7 @@ registered" sym-name)
(defun tacc-push-current ()
"Push the current period into the record"
(let* ((stack (assoc 'history tacc-info))
(let* ((stack-place (assoc 'history tacc-info))
(work-place (assoc 'work-ts tacc-info))
(break-place (assoc 'break-ts tacc-info))
(end-place (assoc 'end-ts tacc-info))
@ -443,7 +442,7 @@ registered" sym-name)
(end . ,end)
(state . work)
(tag . ,tag))
stack)))
(cdr stack-place))))
(if break-cond
(let ((ts (time-to-seconds (cdr break-place)))
(end (time-to-seconds (cdr end-place))))
@ -451,7 +450,7 @@ registered" sym-name)
(end . ,end)
(state . break)
(tag . ,tag))
stack))))
(cdr stack-place)))))
(setcdr work-place nil)
(setcdr break-place nil)
(setcdr end-place nil)))
@ -537,14 +536,14 @@ registered" sym-name)
(set-marker .clock-end (point-max))
(tacc-insert-between
.clock-start .clock-end
(tacc-clock-render 'work 1 0))
" ")
(insert "\n")
(set-marker .graph-start (point))
(set-marker .graph-end (point-max))
(tacc-insert-between
.graph-start .graph-end
" Tag: \n"
(tacc-graph-bar-render width 0.0 0.0 1.0)))))))
" "))))))
(defun tacc-clock-glyph (state)
@ -687,7 +686,7 @@ Returns the current tag if no prompt is made"
(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"
"Increments the cycle counter if the current state is a \-break"
(if (eq state 'break)
(let* ((cycle-place (assoc 'cycle tacc-info))
(cycle (cdr cycle-place)))
@ -760,7 +759,7 @@ Returns the current tag if no prompt is made"
(defun tacc-kill-emacs-confirm ()
"Ask for confirmation if a timer is still running"
(if (and (tacc-session?) ;; Redundant, but more re-use this way
(if (and (tacc-session?) ;; Redundant check in end-session, but nicer this way
(yes-or-no-p "You still have a work timer running, are you sure you want\
to quit emacs?"))
(tacc-end-session)

Loading…
Cancel
Save