Many small errors in waiting fixed, I'm too used to lazy if conditions

master
Brady McDonough 3 years ago
parent 05dced0844
commit a6635e36d0

@ -1,7 +1,7 @@
;;; tacc.el --- A pomidoro timer supporting tags and customizable export
;; Author: Brady McDonough <me@bradymcd.ca>
;; URL: git.bradymcd.ca/tacc
;; URL: git.bradymcd.ca/brady/tacc
;; Keywords: tools, time, pomodoro, accountability
;; Version: 0.0.1
;;
@ -52,13 +52,11 @@
;; TODOS:
;; ERROR: mapconcat doesn't seem to respect lexical binding which leaves me unable to use a closure for a ticker
;; For now the code which relies on this will be noop'd
;; ERROR: tacc-tick is returning a (wrong-number-of-arguments) error.
;; ERROR: tag doesn't print,
;; BUG : Countdown was ??? because 0 doesn't default to zero but "now".
;; That does leave an edgecase in the countdown display I'll need to explicitly check for
;; ERROR: timer shutdown seems to leave things in a wrong state and buffer doesn't die properly
;; ERROR: Current error is a wrong argument error where we're expecting a marker or position
;; Strictly before printing the graph bar and it gets fed a quadruple, constantly changes
;; 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
;; Optional
(require 'icicles nil t)
@ -492,8 +490,7 @@ Note, if there is no tacc-buffer then you shouldn't be touching tacc-info"
(set-marker .clock-end (point-max))
(tacc-insert-between
.clock-start .clock-end
(let ((ts (current-time)))
(tacc-clock-render 'work ts ts ts)))
(tacc-clock-render 'work 0 1 0))
(insert (tacc-spacer-render width))
(set-marker .graph-start (point))
(set-marker .graph-end (point-max))
@ -512,7 +509,7 @@ Note, if there is no tacc-buffer then you shouldn't be touching tacc-info"
(defun tacc-clock-render (state start countdown now)
"Draw the clock"
(let* ((overwork (time-less-p countdown 0))
(let* ((overwork (time-less-p countdown 1))
(count-fmt (if overwork "+%M:%S" "-%M:%S"))
(count-face (cond (overwork 'tacc-overwork)
((eq state 'pause) 'tacc-clock-pause)
@ -552,14 +549,20 @@ float"
(tacc-insert-between
.graph-start .graph-end
(let-alist tacc-info
(concat
(tacc-tag-render .tag)
(let* ((end (if (> now est-ts) now est-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))
(let* ((start-s (time-to-seconds start-ts))
(est-s (time-to-seconds est-ts))
(count-s (time-to-seconds countdown))
(now-s (time-to-seconds now))
(end-s (if (< est-s now-s) now-s est-s))
(work-s (time-to-seconds .work-ts))
(break-s (time-to-seconds .break-ts))
(total (- end-s work-s))
(work-prop (/ (- (if (numberp break-s) break-s now-s) work-s) total))
(break-prop (/ (if (numberp break-s) (- now-s break-s) 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
@ -589,7 +592,7 @@ float"
(alist-get 'tag tacc-info)
nil))
(completions (append (flatten-tree
(apply 'eval (if tacc-tag-completion-functions
(apply 'funcall (if tacc-tag-completion-functions
tacc-tag-completion-functions
`(,(lambda () "")))))
tacc-tag-history)))
@ -698,7 +701,7 @@ Returns the current tag if no prompt is made"
(tacc-push-current)
(tacc-save-record (assoc 'history tacc-info))
(setcdr (assoc 'state tacc-info) 'stop)
(kill-buffer))
(kill-buffer (tacc-buffer)))
;; 09 Hooks setup
(add-hook 'after-init-hook 'tacc-load-tag-history)

Loading…
Cancel
Save