|
|
|
@ -49,6 +49,17 @@
|
|
|
|
;;; Code:
|
|
|
|
;;; Code:
|
|
|
|
;;; -*- lexical-binding: t -*-
|
|
|
|
;;; -*- lexical-binding: t -*-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; 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
|
|
|
|
|
|
|
|
|
|
|
|
;; Optional
|
|
|
|
;; Optional
|
|
|
|
(require 'icicles nil t)
|
|
|
|
(require 'icicles nil t)
|
|
|
|
|
|
|
|
|
|
|
|
@ -109,37 +120,37 @@
|
|
|
|
:prefix "tacc-")
|
|
|
|
:prefix "tacc-")
|
|
|
|
|
|
|
|
|
|
|
|
(defface tacc-graph-work
|
|
|
|
(defface tacc-graph-work
|
|
|
|
'((t (:inherit 'success)))
|
|
|
|
'((t :inherit success))
|
|
|
|
"For work graph bars"
|
|
|
|
"For work graph bars"
|
|
|
|
:group 'tacc-faces)
|
|
|
|
:group 'tacc-faces)
|
|
|
|
|
|
|
|
|
|
|
|
(defface tacc-graph-break
|
|
|
|
(defface tacc-graph-break
|
|
|
|
'((t (:inherit 'warning)))
|
|
|
|
'((t :inherit warning))
|
|
|
|
"For break graph bars"
|
|
|
|
"For break graph bars"
|
|
|
|
:group 'tacc-faces)
|
|
|
|
:group 'tacc-faces)
|
|
|
|
|
|
|
|
|
|
|
|
(defface tacc-graph-void
|
|
|
|
(defface tacc-graph-void
|
|
|
|
'((t (:inherit 'shadow)))
|
|
|
|
'((t :inherit shadow))
|
|
|
|
"For filler graph bars"
|
|
|
|
"For filler graph bars"
|
|
|
|
:group 'tacc-faces)
|
|
|
|
:group 'tacc-faces)
|
|
|
|
|
|
|
|
|
|
|
|
(defface tacc-clock
|
|
|
|
(defface tacc-clock
|
|
|
|
'((t (:height 3.0)))
|
|
|
|
'((t :height 3.0))
|
|
|
|
"For the clock and timer"
|
|
|
|
"For the clock and timer"
|
|
|
|
:group 'tacc-faces)
|
|
|
|
:group 'tacc-faces)
|
|
|
|
|
|
|
|
|
|
|
|
(defface tacc-clock-pause
|
|
|
|
(defface tacc-clock-pause
|
|
|
|
'((t (:inherit (tacc-clock ansi-slow-blink))))
|
|
|
|
'((t :inherit (tacc-clock italic ansi-slow-blink)))
|
|
|
|
"For the timer while the timer isn't running"
|
|
|
|
"For the timer while the timer isn't running"
|
|
|
|
:group 'tacc-faces)
|
|
|
|
:group 'tacc-faces)
|
|
|
|
|
|
|
|
|
|
|
|
(defface tacc-overwork
|
|
|
|
(defface tacc-overwork
|
|
|
|
'((t (:inherit (tacc-clock error))))
|
|
|
|
'((t :inherit (tacc-clock error)))
|
|
|
|
"for the timer whenever we are in overwork"
|
|
|
|
"for the timer whenever we are in overwork"
|
|
|
|
:group 'tacc-faces)
|
|
|
|
:group 'tacc-faces)
|
|
|
|
|
|
|
|
|
|
|
|
(defface tacc-tag
|
|
|
|
(defface tacc-tag
|
|
|
|
'((t (:inherit 'link-visited)))
|
|
|
|
'((t :inherit link-visited))
|
|
|
|
"The face the tag is printed in"
|
|
|
|
"The face the tag is printed in"
|
|
|
|
:group 'tacc-faces)
|
|
|
|
:group 'tacc-faces)
|
|
|
|
|
|
|
|
|
|
|
|
@ -259,21 +270,24 @@ registered" sym-name)
|
|
|
|
(define-derived-mode tacc-timer-mode
|
|
|
|
(define-derived-mode tacc-timer-mode
|
|
|
|
special-mode tacc-buffer-name
|
|
|
|
special-mode tacc-buffer-name
|
|
|
|
"Major mode for the tacc timer"
|
|
|
|
"Major mode for the tacc timer"
|
|
|
|
(setq-local lexical-binding t
|
|
|
|
(setq-local show-trailing-whitespace nil
|
|
|
|
tacc-locs `((clock-start . ,(copy-marker 0))
|
|
|
|
tacc-locs `((clock-start . ,(copy-marker 0))
|
|
|
|
(clock-end . ,(copy-marker 0))
|
|
|
|
(clock-end . ,(copy-marker 0))
|
|
|
|
(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)
|
|
|
|
@ -315,8 +329,8 @@ Note, if there is no tacc-buffer then you shouldn't be touching tacc-info"
|
|
|
|
(defun tacc-chime-p (countdown-ts)
|
|
|
|
(defun tacc-chime-p (countdown-ts)
|
|
|
|
"Should I play a chime on this second?"
|
|
|
|
"Should I play a chime on this second?"
|
|
|
|
(if (time-less-p countdown-ts 0)
|
|
|
|
(if (time-less-p countdown-ts 0)
|
|
|
|
(mod (time-to-seconds countdown-ts)
|
|
|
|
(= 0 (mod (time-to-seconds countdown-ts)
|
|
|
|
tacc-chime-interval)))
|
|
|
|
tacc-chime-interval))))
|
|
|
|
|
|
|
|
|
|
|
|
(defun tacc-work-period (cycle)
|
|
|
|
(defun tacc-work-period (cycle)
|
|
|
|
"How long is the current work period?"
|
|
|
|
"How long is the current work period?"
|
|
|
|
@ -335,9 +349,10 @@ Note, if there is no tacc-buffer then you shouldn't be touching tacc-info"
|
|
|
|
(defun tacc-est-ts (state cycle work-ts break-ts)
|
|
|
|
(defun tacc-est-ts (state cycle work-ts break-ts)
|
|
|
|
"Given the state and cycle, how long is the current time segment?"
|
|
|
|
"Given the state and cycle, how long is the current time segment?"
|
|
|
|
(let ((start-ts (tacc-start-ts state work-ts break-ts)))
|
|
|
|
(let ((start-ts (tacc-start-ts state work-ts break-ts)))
|
|
|
|
|
|
|
|
(time-add start-ts
|
|
|
|
(if (eq state 'work)
|
|
|
|
(if (eq state 'work)
|
|
|
|
(tacc-work-period cycle)
|
|
|
|
(tacc-work-period cycle)
|
|
|
|
(tacc-break-period cycle))))
|
|
|
|
(tacc-break-period cycle)))))
|
|
|
|
|
|
|
|
|
|
|
|
;; 05.3 State manipulation
|
|
|
|
;; 05.3 State manipulation
|
|
|
|
|
|
|
|
|
|
|
|
@ -345,14 +360,14 @@ 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)))
|
|
|
|
(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 now )
|
|
|
|
(tacc-timer-buffer-update state start-ts est countdown now)
|
|
|
|
(if 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))))))
|
|
|
|
@ -361,8 +376,7 @@ Note, if there is no tacc-buffer then you shouldn't be touching tacc-info"
|
|
|
|
"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"
|
|
|
|
@ -382,7 +396,7 @@ Note, if there is no tacc-buffer then you shouldn't be touching tacc-info"
|
|
|
|
(cdr break-ts)
|
|
|
|
(cdr break-ts)
|
|
|
|
(cdr end-ts)))
|
|
|
|
(cdr end-ts)))
|
|
|
|
(state . work)
|
|
|
|
(state . work)
|
|
|
|
(tag . ,(cdr tag)))
|
|
|
|
(tag . ,tag))
|
|
|
|
(cdr stack)))
|
|
|
|
(cdr stack)))
|
|
|
|
(if break-ts
|
|
|
|
(if break-ts
|
|
|
|
(push `((ts . ,(cdr break-ts))
|
|
|
|
(push `((ts . ,(cdr break-ts))
|
|
|
|
@ -417,13 +431,14 @@ Note, if there is no tacc-buffer then you shouldn't be touching tacc-info"
|
|
|
|
(+ len (if (<= ticker rem) 1 0)))))
|
|
|
|
(+ len (if (<= ticker rem) 1 0)))))
|
|
|
|
|
|
|
|
|
|
|
|
(defun gradient-string (width chars)
|
|
|
|
(defun gradient-string (width chars)
|
|
|
|
(mapconcat ((let ((ticker 0))
|
|
|
|
;; (mapconcat (let ((ticker 0)
|
|
|
|
(lambda (c) (let ((rem (mod width (length chars)))
|
|
|
|
;; (rem (mod width (length chars)))
|
|
|
|
(len (/ width (length chars))))
|
|
|
|
;; (len (/ width (length chars))))
|
|
|
|
(make-string (progn (setf ticker (1+ ticker))
|
|
|
|
;; (lambda (c)
|
|
|
|
(+ len (if (<= ticker rem) 1 0)))
|
|
|
|
;; (make-string (+ len (if (<= (setq ticker (1+ ticker)) rem) 1 0))
|
|
|
|
c)))))
|
|
|
|
;; c)))
|
|
|
|
chars ""))
|
|
|
|
;; chars ""))
|
|
|
|
|
|
|
|
(make-string width (aref chars 0)))
|
|
|
|
|
|
|
|
|
|
|
|
(defun tacc-header-render (width)
|
|
|
|
(defun tacc-header-render (width)
|
|
|
|
"Returns a string for the header of the tacc timer"
|
|
|
|
"Returns a string for the header of the tacc timer"
|
|
|
|
@ -490,69 +505,68 @@ Note, if there is no tacc-buffer then you shouldn't be touching tacc-info"
|
|
|
|
|
|
|
|
|
|
|
|
(defun tacc-clock-glyph (state)
|
|
|
|
(defun tacc-clock-glyph (state)
|
|
|
|
"Returns the correct play or pause glyph for each state"
|
|
|
|
"Returns the correct play or pause glyph for each state"
|
|
|
|
(cond ((eq state 'work) tacc-run-glyph)
|
|
|
|
(string (cond ((eq state 'work) tacc-run-glyph)
|
|
|
|
((eq state 'break) tacc-run-glyph)
|
|
|
|
((eq state 'break) tacc-run-glyph)
|
|
|
|
((eq state 'pause) tacc-pause-glyph)
|
|
|
|
((eq state 'pause) tacc-pause-glyph)
|
|
|
|
((eq state 'stop) tacc-pause-glyph)))
|
|
|
|
((eq state 'stop) tacc-pause-glyph))))
|
|
|
|
|
|
|
|
|
|
|
|
(defun tacc-clock-render (state start est now)
|
|
|
|
(defun tacc-clock-render (state start countdown now)
|
|
|
|
"Draw the clock"
|
|
|
|
"Draw the clock"
|
|
|
|
(let* ((elapsed (time-subtract now start))
|
|
|
|
(let* ((overwork (time-less-p countdown 0))
|
|
|
|
(overwork (time-less-p elapsed est))
|
|
|
|
|
|
|
|
(countdown (if overwork (time-subtract elapsed est)
|
|
|
|
|
|
|
|
(time-subtract est elapsed)))
|
|
|
|
|
|
|
|
(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)
|
|
|
|
('t 'tacc-clock))))
|
|
|
|
('t 'tacc-clock))))
|
|
|
|
(concat
|
|
|
|
(concat
|
|
|
|
(propertize (format-time-string "%T" now) 'tacc-clock)
|
|
|
|
(propertize (format-time-string "%T" now) 'face 'tacc-clock)
|
|
|
|
(propertize (format-time-string count-fmt count-face))
|
|
|
|
(propertize (format-time-string count-fmt countdown) 'face count-face)
|
|
|
|
(propertize (tacc-clock-glyph state) 'tacc-clock))))
|
|
|
|
(propertize (tacc-clock-glyph state) 'face 'tacc-clock))))
|
|
|
|
|
|
|
|
|
|
|
|
(defun tacc-current-tag-render ()
|
|
|
|
|
|
|
|
"Draw the tag name"
|
|
|
|
|
|
|
|
(concat "Tag: " (propertize (alist-get 'tag tacc-info "<None>")
|
|
|
|
|
|
|
|
'tacc-tag)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun tacc-graph-bar-render (width work break void)
|
|
|
|
(defun tacc-graph-bar-render (width work break void)
|
|
|
|
"Return a graph bar width characters wide with the given proportions as \
|
|
|
|
"Return a graph bar width characters wide with the given proportions as \
|
|
|
|
float"
|
|
|
|
float"
|
|
|
|
(let ((width (- width 2)))
|
|
|
|
(let ((width (- width 5)))
|
|
|
|
(concat
|
|
|
|
(concat
|
|
|
|
" "
|
|
|
|
" "
|
|
|
|
(propertize (make-string (round (* width work)) tacc-graph-char)
|
|
|
|
(propertize (make-string (round (* width work)) tacc-graph-char)
|
|
|
|
'tacc-graph-work)
|
|
|
|
'face 'tacc-graph-work)
|
|
|
|
(propertize (make-string (round (* width break)) tacc-graph-char)
|
|
|
|
(propertize (make-string (round (* width break)) tacc-graph-char)
|
|
|
|
'tacc-graph-break)
|
|
|
|
'face 'tacc-graph-break)
|
|
|
|
(propertize (make-string (round (* width void)) tacc-graph-char)
|
|
|
|
(propertize (make-string (round (* width void)) tacc-graph-char)
|
|
|
|
'tacc-graph-void)
|
|
|
|
'face 'tacc-graph-void)
|
|
|
|
" \n")))
|
|
|
|
" \n")))
|
|
|
|
|
|
|
|
|
|
|
|
(defun tacc-timer-buffer-update (state now)
|
|
|
|
(defun tacc-tag-render (tag)
|
|
|
|
|
|
|
|
(concat " Tag: "
|
|
|
|
|
|
|
|
(propertize (if (string= tag "") "<None>" tag)
|
|
|
|
|
|
|
|
'face 'tacc-tag)
|
|
|
|
|
|
|
|
"\n"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun tacc-timer-buffer-update (state start-ts est-ts countdown now)
|
|
|
|
"Update the timer buffer rendering"
|
|
|
|
"Update the timer buffer rendering"
|
|
|
|
(tacc-render-with-buffer
|
|
|
|
(tacc-render-with-buffer
|
|
|
|
(tacc-insert-between
|
|
|
|
(tacc-insert-between
|
|
|
|
.clock-start .clock-end
|
|
|
|
.clock-start .clock-end
|
|
|
|
(let-alist tacc-info)
|
|
|
|
(let-alist tacc-info
|
|
|
|
(tacc-clock-render state .work-ts .end-ts now)))
|
|
|
|
(tacc-clock-render state start-ts countdown now)))
|
|
|
|
(tacc-insert-between
|
|
|
|
(tacc-insert-between
|
|
|
|
.graph-start .graph-end
|
|
|
|
.graph-start .graph-end
|
|
|
|
(tacc-current-tag-render)
|
|
|
|
(let-alist tacc-info
|
|
|
|
(let-alist tacc-info)
|
|
|
|
(concat
|
|
|
|
(let* ((end (if (> now .end-ts) now .end-ts))
|
|
|
|
(tacc-tag-render .tag)
|
|
|
|
|
|
|
|
(let* ((end (if (> now est-ts) now est-ts))
|
|
|
|
(total (- end .work-ts))
|
|
|
|
(total (- end .work-ts))
|
|
|
|
(work-prop (/ (- (if .break-ts .break-ts now) .work-ts) total))
|
|
|
|
(work-prop (/ (- (if .break-ts .break-ts now) .work-ts) total))
|
|
|
|
(break-prop (/ (if .break-ts (- now .break-ts) 0) total))
|
|
|
|
(break-prop (/ (if .break-ts (- now .break-ts) 0) total))
|
|
|
|
(void-prop (- 1 (+ work-prop break-prop))))
|
|
|
|
(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 ()
|
|
|
|
(defun tacc-new-graph-bar-render ()
|
|
|
|
(tacc-render-with-buffer
|
|
|
|
(tacc-render-with-buffer
|
|
|
|
(save-restriction
|
|
|
|
(save-restriction
|
|
|
|
(narrow-to-region .graph-start .graph-start)
|
|
|
|
(narrow-to-region .graph-start .graph-start)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(goto-char (point-min))
|
|
|
|
(insert (tacc-current-tag-render)
|
|
|
|
(insert (tacc-tag-render .tag)
|
|
|
|
(tacc-graph-bar-render width 0 0 1)
|
|
|
|
(tacc-graph-bar-render width 0 0 1)
|
|
|
|
"\n")
|
|
|
|
"\n")
|
|
|
|
(set-marker .graph-start (point-min))
|
|
|
|
(set-marker .graph-start (point-min))
|
|
|
|
@ -572,7 +586,7 @@ float"
|
|
|
|
(defun tacc-tag-prompt ()
|
|
|
|
(defun tacc-tag-prompt ()
|
|
|
|
"Prompt for a tag and return the user's input"
|
|
|
|
"Prompt for a tag and return the user's input"
|
|
|
|
(let ((last-tag (if (bufferp (tacc-buffer))
|
|
|
|
(let ((last-tag (if (bufferp (tacc-buffer))
|
|
|
|
(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 'eval (if tacc-tag-completion-functions
|
|
|
|
@ -587,7 +601,7 @@ float"
|
|
|
|
'stringp
|
|
|
|
'stringp
|
|
|
|
nil
|
|
|
|
nil
|
|
|
|
nil
|
|
|
|
nil
|
|
|
|
'tacc-tag-history))
|
|
|
|
'tacc-tag-history)))
|
|
|
|
|
|
|
|
|
|
|
|
(defun tacc-tag-prompt-soft ()
|
|
|
|
(defun tacc-tag-prompt-soft ()
|
|
|
|
"Prompt for a tag unless the user doesn't want us to
|
|
|
|
"Prompt for a tag unless the user doesn't want us to
|
|
|
|
@ -612,6 +626,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)
|
|
|
|
@ -630,8 +651,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 ()
|
|
|
|
@ -645,7 +665,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))))
|
|
|
|
@ -665,12 +685,11 @@ Returns the current tag if no prompt is made"
|
|
|
|
"Pause/unpause the tacc timer session"
|
|
|
|
"Pause/unpause the tacc timer session"
|
|
|
|
(interactive)
|
|
|
|
(interactive)
|
|
|
|
(if (tacc-running?)
|
|
|
|
(if (tacc-running?)
|
|
|
|
(tacc-with-buffer
|
|
|
|
|
|
|
|
(let ((state (alist-get 'state tacc-info)))
|
|
|
|
(let ((state (alist-get 'state tacc-info)))
|
|
|
|
(if (eq state 'pause)
|
|
|
|
(if (eq state 'pause)
|
|
|
|
(tacc-unpause-timer)
|
|
|
|
(tacc-unpause-timer)
|
|
|
|
(tacc-pause-timer))))
|
|
|
|
(tacc-pause-timer))))
|
|
|
|
(message "There isn't a live timer session to pause/unpause")))
|
|
|
|
(message "There isn't a live timer session to pause/unpause"))
|
|
|
|
|
|
|
|
|
|
|
|
(defun tacc-end-timer ()
|
|
|
|
(defun tacc-end-timer ()
|
|
|
|
"Ends the current timer session, runs serialization and kills the buffer"
|
|
|
|
"Ends the current timer session, runs serialization and kills the buffer"
|
|
|
|
|