Fixes to history-keeping

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

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

Loading…
Cancel
Save