Cleaned up , also pom*i*doro

Brady McDonough 3 years ago
parent 4d63057d52
commit bf7707a8b9

@ -3,7 +3,7 @@
;; Author: Brady McDonough <me@bradymcd.ca>
;; URL: git.bradymcd.ca/brady/tacc
;; Keywords: tools, time, pomodoro, accountability
;; Keywords: tools, time, pomidoro, accountability
;; Version: 0.0.1
;;
@ -89,7 +89,7 @@
(+ secs (* 60 mins)))
(defcustom tacc-work-seconds (m:s 30 0)
"The length of a base pomodoro round"
"The length of a base pomidoro round"
:type 'integer :group 'tacc)
(defcustom tacc-work-seconds-increment 0
@ -383,28 +383,34 @@ Note, if there is no tacc-buffer then you shouldn't be touching tacc-info"
(defun tacc-push-current ()
"Push the current period into the record"
(let* ((stack (assoc 'history tacc-info))
(work-ts (assoc 'work-ts tacc-info))
(break-ts (assoc 'break-ts tacc-info))
(end-ts (assoc 'end-ts tacc-info))
(tag (alist-get 'tag tacc-info)))
(if work-ts
(push `((ts . ,work-ts)
(end . ,(if (cdr break-ts)
(time-seconds (cdr break-ts))
(cdr end-ts)))
(state . work)
(tag . ,tag))
(cdr stack)))
(if break-ts
(push `((ts . ,(cdr break-ts))
(end . ,(cdr end-ts))
(state . break)
(tag . ,tag))
(cdr stack)))
(setcdr work-ts nil)
(setcdr break-ts nil)
(setcdr end-ts nil)))
(let* ((stack (assoc 'history tacc-info))
(work-place (assoc 'work-ts tacc-info))
(break-place (assoc 'break-ts tacc-info))
(end-place (assoc 'end-ts tacc-info))
(tag (alist-get 'tag tacc-info "")))
(let ((work-cond (if (cdr work-place) 't nil))
(break-cond (if (cdr break-place) 't nil)))
(if work-cond
(let ((ts (time-to-seconds (cdr work-place)))
(end (time-to-seconds (if break-cond
(cdr break-place)
(cdr end-place)))))
(push `((ts . ,ts)
(end . ,end)
(state . work)
(tag . ,tag))
stack)))
(if break-cond
(let ((ts (time-to-seconds (cdr break-place)))
(end (time-to-seconds (cdr end-ts))))
(push `((ts . ,ts)
(end . ,end)
(state . break)
(tag . ,tag))
stack))))
(setcdr work-place nil)
(setcdr break-place nil)
(setcdr end-ts nil)))
(defun tacc-kill-buffer-confirm ()
"Ask for confirmation if a timer is still running"

Loading…
Cancel
Save