|
|
|
@ -53,7 +53,10 @@
|
|
|
|
;; 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: tacc-tick is returning a (wrong-number-of-arguments) error.
|
|
|
|
;; ERROR: tag doesn't print, countdown is ???
|
|
|
|
;; 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
|
|
|
|
|
|
|
|
|
|
|
|
;; Optional
|
|
|
|
;; Optional
|
|
|
|
(require 'icicles nil t)
|
|
|
|
(require 'icicles nil t)
|
|
|
|
@ -271,15 +274,18 @@ registered" sym-name)
|
|
|
|
(graph-start . ,(copy-marker 0))
|
|
|
|
(graph-start . ,(copy-marker 0))
|
|
|
|
(graph-end . ,(copy-marker 0)))))
|
|
|
|
(graph-end . ,(copy-marker 0)))))
|
|
|
|
|
|
|
|
|
|
|
|
(defun cycle-ticker ()
|
|
|
|
;; ERROR: It seems like this style of ticker doesn't work and I don't have time to look into it
|
|
|
|
"A closure with an internal count, only increments when fed 'break timer state"
|
|
|
|
;; more deeply. As far as I can tell I've copied the reference examples pretty closely.
|
|
|
|
(let ((ticker 0))
|
|
|
|
;; In the meantime a "dumber" solution that works is being used
|
|
|
|
(lambda (&optional state)
|
|
|
|
;; (defun cycle-ticker ()
|
|
|
|
(cond ((eq state 'break) (setq ticker (1+ ticker)))
|
|
|
|
;; "A closure with an internal count, only increments when fed 'break timer state"
|
|
|
|
( 't ticker)))))
|
|
|
|
;; (let ((ticker 0))
|
|
|
|
|
|
|
|
;; (lambda (&optional state)
|
|
|
|
(defvar tacc-info '((history . ())
|
|
|
|
;; (cond ((eq state 'break) (setq ticker (1+ ticker)))
|
|
|
|
(cycle . ,(cycle-ticker))
|
|
|
|
;; ( 't ticker)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defvar tacc-info `((history . ())
|
|
|
|
|
|
|
|
(cycle . 0)
|
|
|
|
(work-ts . nil)
|
|
|
|
(work-ts . nil)
|
|
|
|
(break-ts . nil)
|
|
|
|
(break-ts . nil)
|
|
|
|
(end-ts . nil)
|
|
|
|
(end-ts . nil)
|
|
|
|
@ -352,24 +358,23 @@ Note, if there is no tacc-buffer then you shouldn't be touching tacc-info"
|
|
|
|
"Time marches on. Called every second while a tacc timer is running"
|
|
|
|
"Time marches on. Called every second while a tacc timer is running"
|
|
|
|
(let* ((now (current-time))
|
|
|
|
(let* ((now (current-time))
|
|
|
|
(state (alist-get 'state tacc-info))
|
|
|
|
(state (alist-get 'state tacc-info))
|
|
|
|
(cycle (funcall (alist-get 'cycle tacc-info) 't))
|
|
|
|
(cycle (alist-get 'cycle tacc-info))
|
|
|
|
(work-ts (alist-get 'work-ts tacc-info))
|
|
|
|
(work-ts (alist-get 'work-ts tacc-info))
|
|
|
|
(break-ts (alist-get 'break-ts tacc-info))
|
|
|
|
(break-ts (alist-get 'break-ts tacc-info))
|
|
|
|
(start-ts (tacc-start-ts state work-ts break-ts))
|
|
|
|
(start-ts (tacc-start-ts state work-ts break-ts))
|
|
|
|
(est (tacc-est-ts state cycle work-ts break-ts))
|
|
|
|
(est (tacc-est-ts state cycle work-ts break-ts))
|
|
|
|
(countdown (time-subtract est now)))
|
|
|
|
(countdown (time-subtract est now)))
|
|
|
|
(tacc-timer-buffer-update state start-ts est countdown now)
|
|
|
|
(tacc-timer-buffer-update state start-ts est countdown now)
|
|
|
|
(if (functionp tacc-play-sound-file)
|
|
|
|
(if (functionp tacc-play-sound-file)
|
|
|
|
(cond ((tacc-chime-p countdown)
|
|
|
|
(cond ((tacc-chime-p countdown)
|
|
|
|
(funcall tacc-play-sound-file tacc-sound-chime))
|
|
|
|
(funcall tacc-play-sound-file tacc-sound-chime))
|
|
|
|
(t (funcall tacc-play-sound-file tacc-sound-tick))))))
|
|
|
|
(t (funcall tacc-play-sound-file tacc-sound-tick))))))
|
|
|
|
|
|
|
|
|
|
|
|
(defun tacc-schedule ()
|
|
|
|
(defun tacc-schedule ()
|
|
|
|
"Note the time and schedule the first tick"
|
|
|
|
"Note the time and schedule the first tick"
|
|
|
|
(setcdr (assoc 'state tacc-info) 'work)
|
|
|
|
(setcdr (assoc 'state tacc-info) 'work)
|
|
|
|
(setcdr (assoc 'work-ts tacc-info) (current-time))
|
|
|
|
(setcdr (assoc 'work-ts tacc-info) (current-time))
|
|
|
|
(setq tacc-timer (run-with-timer 't 1 'tacc-tick
|
|
|
|
(setq tacc-timer (run-with-timer 't 1 'tacc-tick)))
|
|
|
|
:timer-max-repeats 1)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun tacc-deschedule ()
|
|
|
|
(defun tacc-deschedule ()
|
|
|
|
"Deschedule the timer"
|
|
|
|
"Deschedule the timer"
|
|
|
|
@ -619,6 +624,13 @@ Returns the current tag if no prompt is made"
|
|
|
|
(setcdr (assoc 'tag tacc-info) (tacc-tag-prompt)))
|
|
|
|
(setcdr (assoc 'tag tacc-info) (tacc-tag-prompt)))
|
|
|
|
(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)
|
|
|
|
|
|
|
|
"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)))
|
|
|
|
|
|
|
|
(setcdr cycle-place (1+ cycle)))))
|
|
|
|
|
|
|
|
|
|
|
|
(defun tacc-timer-state-forward ()
|
|
|
|
(defun tacc-timer-state-forward ()
|
|
|
|
"Move the tacc timer state forward"
|
|
|
|
"Move the tacc timer state forward"
|
|
|
|
(interactive)
|
|
|
|
(interactive)
|
|
|
|
@ -637,8 +649,7 @@ Returns the current tag if no prompt is made"
|
|
|
|
(setcdr work-ts ts)
|
|
|
|
(setcdr work-ts ts)
|
|
|
|
(setcdr state-place 'work)
|
|
|
|
(setcdr state-place 'work)
|
|
|
|
(tacc-new-graph-bar-render)))
|
|
|
|
(tacc-new-graph-bar-render)))
|
|
|
|
(funcall (alist-get 'cycle tacc-info) state)
|
|
|
|
(tacc-cycle-increment state))
|
|
|
|
)
|
|
|
|
|
|
|
|
(message "There is no timer to advance")))
|
|
|
|
(message "There is no timer to advance")))
|
|
|
|
|
|
|
|
|
|
|
|
(defun tacc-timer-state-skip ()
|
|
|
|
(defun tacc-timer-state-skip ()
|
|
|
|
@ -652,7 +663,7 @@ Returns the current tag if no prompt is made"
|
|
|
|
(ts (current-time)))
|
|
|
|
(ts (current-time)))
|
|
|
|
(setcdr end-ts ts)
|
|
|
|
(setcdr end-ts ts)
|
|
|
|
(tacc-push-current)
|
|
|
|
(tacc-push-current)
|
|
|
|
(funcall (alist-get 'cycle tacc-info) 'break)
|
|
|
|
(tacc-cycle-increment 'break)
|
|
|
|
(setcdr work-ts ts)
|
|
|
|
(setcdr work-ts ts)
|
|
|
|
(setcdr state-place 'work)
|
|
|
|
(setcdr state-place 'work)
|
|
|
|
(tacc-new-graph-bar-render))))
|
|
|
|
(tacc-new-graph-bar-render))))
|
|
|
|
|