Compare commits
10 Commits
dev
...
third-time
Author | SHA1 | Date |
---|---|---|
contrapunctus | 2cca269d33 | |
contrapunctus | 855b802612 | |
contrapunctus | 8b4cd461d8 | |
contrapunctus | 8fc0e5718e | |
contrapunctus | 16061d0f85 | |
contrapunctus | d6cbeeba9e | |
contrapunctus | 6553346be1 | |
contrapunctus | 267f17e57d | |
contrapunctus | a8f213bbd2 | |
contrapunctus | 65d6f8ddd6 |
|
@ -35,6 +35,35 @@
|
||||||
:group 'chronometrist)
|
:group 'chronometrist)
|
||||||
;; group:1 ends here
|
;; group:1 ends here
|
||||||
|
|
||||||
|
;; [[file:chronometrist-third.org::*working-hours][working-hours:1]]
|
||||||
|
(defcustom chronometrist-third-working-hours nil
|
||||||
|
"User's working hours for today.
|
||||||
|
This can be nil, a list of one or more ISO-8601 timestamp pairs,
|
||||||
|
or a function which takes no arguments and returns such a list.
|
||||||
|
|
||||||
|
Setting this has no effect at the moment."
|
||||||
|
:type '(choice (const :tag "No defined working hours" nil)
|
||||||
|
(repeat :tag "Time ranges"
|
||||||
|
(cons :tag "Range"
|
||||||
|
(string :tag "Start")
|
||||||
|
(string :tag "Stop")))
|
||||||
|
function)
|
||||||
|
:group 'chronometrist-third)
|
||||||
|
;; working-hours:1 ends here
|
||||||
|
|
||||||
|
;; [[file:chronometrist-third.org::*working-hours][working-hours:1]]
|
||||||
|
(defun chronometrist-third-working-hours (default-hours)
|
||||||
|
"Return the user's working hours based on DEFAULT-HOURS.
|
||||||
|
For the possible values of DEFAULT-HOURS, see the variable
|
||||||
|
`chronometrist-third-working-hours' ."
|
||||||
|
(cond ((and (proper-list-p default-hours)
|
||||||
|
(seq-every-p #'consp default-hours))
|
||||||
|
default-hours)
|
||||||
|
((functionp default-hours)
|
||||||
|
(chronometrist-third-working-hours (funcall default-hours)))
|
||||||
|
(t nil)))
|
||||||
|
;; working-hours:1 ends here
|
||||||
|
|
||||||
;; [[file:chronometrist-third.org::*divisor][divisor:1]]
|
;; [[file:chronometrist-third.org::*divisor][divisor:1]]
|
||||||
(defcustom chronometrist-third-divisor 3
|
(defcustom chronometrist-third-divisor 3
|
||||||
"Number to determine accumulation of break time relative to work time."
|
"Number to determine accumulation of break time relative to work time."
|
||||||
|
@ -139,10 +168,10 @@ and stopped when they clock in."
|
||||||
(setq chronometrist-third-break-time (if (> new-break 0) new-break 0))
|
(setq chronometrist-third-break-time (if (> new-break 0) new-break 0))
|
||||||
(alert
|
(alert
|
||||||
(if (zerop chronometrist-third-break-time)
|
(if (zerop chronometrist-third-break-time)
|
||||||
(format "You have used up all %s of your break time (%s break)"
|
(format "You have used up all %s of your break time\n(%s break)"
|
||||||
(format-seconds chronometrist-third-duration-format old-break)
|
(format-seconds chronometrist-third-duration-format old-break)
|
||||||
used-break-string)
|
used-break-string)
|
||||||
(format "You have used %s of your break time (%s left)"
|
(format "You have used %s of your break time\n(%s left)"
|
||||||
used-break-string
|
used-break-string
|
||||||
(format-seconds chronometrist-third-duration-format chronometrist-third-break-time)))))))
|
(format-seconds chronometrist-third-duration-format chronometrist-third-break-time)))))))
|
||||||
;; clock-in:1 ends here
|
;; clock-in:1 ends here
|
||||||
|
@ -155,7 +184,7 @@ break time is up."
|
||||||
(let* ((latest-work-duration (chronometrist-interval (chronometrist-latest-record (chronometrist-active-backend))))
|
(let* ((latest-work-duration (chronometrist-interval (chronometrist-latest-record (chronometrist-active-backend))))
|
||||||
(break-time-increment (/ latest-work-duration chronometrist-third-divisor)))
|
(break-time-increment (/ latest-work-duration chronometrist-third-divisor)))
|
||||||
(cl-incf chronometrist-third-break-time break-time-increment)
|
(cl-incf chronometrist-third-break-time break-time-increment)
|
||||||
(alert (format "You have gained %s of break time (%s total)"
|
(alert (format "You have gained %s of break time\n(%s total)"
|
||||||
(format-seconds chronometrist-third-duration-format break-time-increment)
|
(format-seconds chronometrist-third-duration-format break-time-increment)
|
||||||
(format-seconds chronometrist-third-duration-format chronometrist-third-break-time)))
|
(format-seconds chronometrist-third-duration-format chronometrist-third-break-time)))
|
||||||
;; start alert timer(s)
|
;; start alert timer(s)
|
||||||
|
|
|
@ -47,6 +47,39 @@
|
||||||
:group 'chronometrist)
|
:group 'chronometrist)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
** TODO working-hours :custom:variable:
|
||||||
|
Supporting multiple ranges per day may be a little overkill - from my reading of the Third Time post, my understanding is that each day has one large working hours range which includes all breaks. That would mean you really /don't/ want more than one range...
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defcustom chronometrist-third-working-hours nil
|
||||||
|
"User's working hours for today.
|
||||||
|
This can be nil, a list of one or more ISO-8601 timestamp pairs,
|
||||||
|
or a function which takes no arguments and returns such a list.
|
||||||
|
|
||||||
|
Setting this has no effect at the moment."
|
||||||
|
:type '(choice (const :tag "No defined working hours" nil)
|
||||||
|
(repeat :tag "Time ranges"
|
||||||
|
(cons :tag "Range"
|
||||||
|
(string :tag "Start")
|
||||||
|
(string :tag "Stop")))
|
||||||
|
function)
|
||||||
|
:group 'chronometrist-third)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** working-hours :procedure:
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun chronometrist-third-working-hours (default-hours)
|
||||||
|
"Return the user's working hours based on DEFAULT-HOURS.
|
||||||
|
For the possible values of DEFAULT-HOURS, see the variable
|
||||||
|
`chronometrist-third-working-hours' ."
|
||||||
|
(cond ((and (proper-list-p default-hours)
|
||||||
|
(seq-every-p #'consp default-hours))
|
||||||
|
default-hours)
|
||||||
|
((functionp default-hours)
|
||||||
|
(chronometrist-third-working-hours (funcall default-hours)))
|
||||||
|
(t nil)))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
** divisor :custom:variable:
|
** divisor :custom:variable:
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defcustom chronometrist-third-divisor 3
|
(defcustom chronometrist-third-divisor 3
|
||||||
|
@ -163,10 +196,10 @@ and stopped when they clock in."
|
||||||
(setq chronometrist-third-break-time (if (> new-break 0) new-break 0))
|
(setq chronometrist-third-break-time (if (> new-break 0) new-break 0))
|
||||||
(alert
|
(alert
|
||||||
(if (zerop chronometrist-third-break-time)
|
(if (zerop chronometrist-third-break-time)
|
||||||
(format "You have used up all %s of your break time (%s break)"
|
(format "You have used up all %s of your break time\n(%s break)"
|
||||||
(format-seconds chronometrist-third-duration-format old-break)
|
(format-seconds chronometrist-third-duration-format old-break)
|
||||||
used-break-string)
|
used-break-string)
|
||||||
(format "You have used %s of your break time (%s left)"
|
(format "You have used %s of your break time\n(%s left)"
|
||||||
used-break-string
|
used-break-string
|
||||||
(format-seconds chronometrist-third-duration-format chronometrist-third-break-time)))))))
|
(format-seconds chronometrist-third-duration-format chronometrist-third-break-time)))))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
@ -180,7 +213,7 @@ break time is up."
|
||||||
(let* ((latest-work-duration (chronometrist-interval (chronometrist-latest-record (chronometrist-active-backend))))
|
(let* ((latest-work-duration (chronometrist-interval (chronometrist-latest-record (chronometrist-active-backend))))
|
||||||
(break-time-increment (/ latest-work-duration chronometrist-third-divisor)))
|
(break-time-increment (/ latest-work-duration chronometrist-third-divisor)))
|
||||||
(cl-incf chronometrist-third-break-time break-time-increment)
|
(cl-incf chronometrist-third-break-time break-time-increment)
|
||||||
(alert (format "You have gained %s of break time (%s total)"
|
(alert (format "You have gained %s of break time\n(%s total)"
|
||||||
(format-seconds chronometrist-third-duration-format break-time-increment)
|
(format-seconds chronometrist-third-duration-format break-time-increment)
|
||||||
(format-seconds chronometrist-third-duration-format chronometrist-third-break-time)))
|
(format-seconds chronometrist-third-duration-format chronometrist-third-break-time)))
|
||||||
;; start alert timer(s)
|
;; start alert timer(s)
|
||||||
|
|
Reference in New Issue