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 ;;; tacc.el --- A pomidoro timer supporting tags and customizable export
;; Author: Brady McDonough <me@bradymcd.ca> ;; Author: Brady McDonough <me@bradymcd.ca>
;; URL: git.bradymcd.ca/tacc ;; URL: git.bradymcd.ca/brady/tacc
;; Keywords: tools, time, pomodoro, accountability ;; Keywords: tools, time, pomodoro, accountability
;; Version: 0.0.1 ;; Version: 0.0.1
;; ;;
@ -52,13 +52,11 @@
;; TODOS: ;; TODOS:
;; ERROR: mapconcat doesn't seem to respect lexical binding which leaves me unable to use a closure for a ticker ;; 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 ;; 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". ;; 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 ;; 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: 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 ;; Check on the logic of push-current, needs predicates rather than lazy if conditions
;; Strictly before printing the graph bar and it gets fed a quadruple, constantly changes ;; I'm not calling anything to destroy the buffer on desched
;; Optional ;; Optional
(require 'icicles nil t) (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)) (set-marker .clock-end (point-max))
(tacc-insert-between (tacc-insert-between
.clock-start .clock-end .clock-start .clock-end
(let ((ts (current-time))) (tacc-clock-render 'work 0 1 0))
(tacc-clock-render 'work ts ts ts)))
(insert (tacc-spacer-render width)) (insert (tacc-spacer-render width))
(set-marker .graph-start (point)) (set-marker .graph-start (point))
(set-marker .graph-end (point-max)) (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) (defun tacc-clock-render (state start countdown now)
"Draw the clock" "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-fmt (if overwork "+%M:%S" "-%M:%S"))
(count-face (cond (overwork 'tacc-overwork) (count-face (cond (overwork 'tacc-overwork)
((eq state 'pause) 'tacc-clock-pause) ((eq state 'pause) 'tacc-clock-pause)
@ -552,14 +549,20 @@ float"
(tacc-insert-between (tacc-insert-between
.graph-start .graph-end .graph-start .graph-end
(let-alist tacc-info (let-alist tacc-info
(concat (tacc-tag-render .tag)
(tacc-tag-render .tag) (let* ((start-s (time-to-seconds start-ts))
(let* ((end (if (> now est-ts) now est-ts)) (est-s (time-to-seconds est-ts))
(total (- end .work-ts)) (count-s (time-to-seconds countdown))
(work-prop (/ (- (if .break-ts .break-ts now) .work-ts) total)) (now-s (time-to-seconds now))
(break-prop (/ (if .break-ts (- now .break-ts) 0) total)) (end-s (if (< est-s now-s) now-s est-s))
(void-prop (- 1 (+ work-prop break-prop)))) (work-s (time-to-seconds .work-ts))
(tacc-graph-bar-render width work-prop break-prop void-prop))))))) (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))))))
(defun tacc-new-graph-bar-render () (defun tacc-new-graph-bar-render ()
(tacc-render-with-buffer (tacc-render-with-buffer
@ -589,9 +592,9 @@ float"
(alist-get 'tag tacc-info) (alist-get 'tag tacc-info)
nil)) nil))
(completions (append (flatten-tree (completions (append (flatten-tree
(apply 'eval (if tacc-tag-completion-functions (apply 'funcall (if tacc-tag-completion-functions
tacc-tag-completion-functions tacc-tag-completion-functions
`(,(lambda () ""))))) `(,(lambda () "")))))
tacc-tag-history))) tacc-tag-history)))
(completing-read (concat "Enter a tag name" (completing-read (concat "Enter a tag name"
(if (< (length last-tag) 0) (if (< (length last-tag) 0)
@ -698,7 +701,7 @@ Returns the current tag if no prompt is made"
(tacc-push-current) (tacc-push-current)
(tacc-save-record (assoc 'history tacc-info)) (tacc-save-record (assoc 'history tacc-info))
(setcdr (assoc 'state tacc-info) 'stop) (setcdr (assoc 'state tacc-info) 'stop)
(kill-buffer)) (kill-buffer (tacc-buffer)))
;; 09 Hooks setup ;; 09 Hooks setup
(add-hook 'after-init-hook 'tacc-load-tag-history) (add-hook 'after-init-hook 'tacc-load-tag-history)

Loading…
Cancel
Save