Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
contrapunctus | 1479686212 | |
contrapunctus | 8513119243 |
|
@ -539,7 +539,7 @@ Variable - chronometrist-date-re
|
|||
@item
|
||||
Variable - chronometrist-time-re-ui
|
||||
@item
|
||||
Variable - chronometrist-task-list
|
||||
Internal Variable - chronometrist--task-list
|
||||
@item
|
||||
Internal Variable - chronometrist--fs-watch
|
||||
@item
|
||||
|
|
|
@ -219,7 +219,7 @@ Each of these has a corresponding function to clear it and fill it with values -
|
|||
1. Variable - chronometrist-empty-time-string
|
||||
2. Variable - chronometrist-date-re
|
||||
3. Variable - chronometrist-time-re-ui
|
||||
4. Variable - chronometrist-task-list
|
||||
4. Internal Variable - chronometrist--task-list
|
||||
5. Internal Variable - chronometrist--fs-watch
|
||||
6. Function - chronometrist-current-task ()
|
||||
7. Function - chronometrist-format-time (seconds &optional (blank " "))
|
||||
|
|
|
@ -40,7 +40,7 @@ This is distinct from `chronometrist-time-re-file' (which see) -
|
|||
`chronometrist-time-re-ui' is meant for the user interface, and
|
||||
must correspond to the output from `chronometrist-format-time'.")
|
||||
|
||||
(defvar chronometrist-task-list nil
|
||||
(defvar chronometrist--task-list nil
|
||||
"List of tasks in `chronometrist-file', as returned by `chronometrist-tasks-from-table'.")
|
||||
|
||||
(defvar chronometrist--fs-watch nil
|
||||
|
|
|
@ -45,7 +45,7 @@ The return value is seconds, as an integer."
|
|||
TS must be a ts struct (see `ts.el')
|
||||
|
||||
Return value is seconds as an integer."
|
||||
(->> chronometrist-task-list
|
||||
(->> chronometrist--task-list
|
||||
(--map (chronometrist-task-time-one-day it ts))
|
||||
(-reduce #'+)
|
||||
(truncate)))
|
||||
|
|
|
@ -99,7 +99,7 @@ The first date is the first occurrence of
|
|||
"Create entries to be displayed in the `chronometrist-report' buffer."
|
||||
(let* ((week-dates (chronometrist-report-date->week-dates))) ;; uses today if chronometrist-report--ui-date is nil
|
||||
(setq chronometrist-report--ui-week-dates week-dates)
|
||||
(cl-loop for task in chronometrist-task-list collect
|
||||
(cl-loop for task in chronometrist--task-list collect
|
||||
(let* ((durations (--map (chronometrist-task-time-one-day task (chronometrist-date it))
|
||||
week-dates))
|
||||
(duration-strings (mapcar #'chronometrist-format-time
|
||||
|
|
|
@ -142,7 +142,7 @@ reduced to the desired range using
|
|||
active-percent
|
||||
average-time)))
|
||||
(list task content)))
|
||||
chronometrist-task-list))
|
||||
chronometrist--task-list))
|
||||
|
||||
(defun chronometrist-statistics-entries ()
|
||||
"Create entries to be displayed in the buffer created by `chronometrist-statistics'."
|
||||
|
|
|
@ -132,6 +132,25 @@ The default is \"*\""
|
|||
The default is midnight, i.e. \"00:00:00\"."
|
||||
:type 'string)
|
||||
|
||||
(defcustom chronometrist-task-list nil
|
||||
"List of tasks in addition to those found in `chronometrist-file'.
|
||||
Each element can either be the task name as a string, or a list
|
||||
in the form -
|
||||
\(\"NAME\" [:KEYWORD VALUE]*)
|
||||
|
||||
Chronometrist currently recognizes the following keywords -
|
||||
|
||||
:hide - if VALUE is non-nil, do not display this task in
|
||||
`chronometrist', `chronometrist-report', and
|
||||
`chronometrist-statistics' buffers.
|
||||
|
||||
:before-in, :after-in, :before-out, :after-out - VALUE must be a
|
||||
list. For this task, use the given value in place of
|
||||
`chronometrist-before-in-functions',
|
||||
`chronometrist-after-in-functions',
|
||||
`chronometrist-before-out-functions', or
|
||||
`chronometrist-after-out-functions'.")
|
||||
|
||||
(defvar chronometrist--task-history nil)
|
||||
(defvar chronometrist--point nil)
|
||||
|
||||
|
@ -180,7 +199,7 @@ Return the value returned by Fₙ."
|
|||
;; latter should refresh from a file.
|
||||
;; (chronometrist-events-populate)
|
||||
;; (chronometrist-events-clean)
|
||||
(->> (-sort #'string-lessp chronometrist-task-list)
|
||||
(->> (-sort #'string-lessp chronometrist--task-list)
|
||||
(--map-indexed
|
||||
(let* ((task it)
|
||||
(index (number-to-string (1+ it-index)))
|
||||
|
@ -401,7 +420,7 @@ Argument _FS-EVENT is ignored."
|
|||
(--> (chronometrist-loop-file for plist in chronometrist-file collect (plist-get plist :name))
|
||||
(cl-remove-duplicates it :test #'equal)
|
||||
(sort it #'string-lessp)
|
||||
(setq chronometrist-task-list it)))
|
||||
(setq chronometrist--task-list it)))
|
||||
(setq chronometrist--file-state
|
||||
(list :last (chronometrist-file-hash :before-last nil)
|
||||
:rest (chronometrist-file-hash nil :before-last t)))
|
||||
|
@ -487,17 +506,35 @@ is the name of the task to be clocked out of.")
|
|||
(defvar chronometrist-file-change-hook nil
|
||||
"Functions to be run after `chronometrist-file' is changed on disk.")
|
||||
|
||||
(defvar chronometrist--task-hook nil)
|
||||
|
||||
(defun chronometrist-run-hooks (task hook)
|
||||
(let ((fn (if (eq hook :before-out)
|
||||
#'run-hook-with-args-until-failure
|
||||
#'run-hook-with-args))
|
||||
(var (case hook
|
||||
(:before-in 'chronometrist-before-in-functions)
|
||||
(:after-in 'chronometrist-after-in-functions)
|
||||
(:before-out 'chronometrist-before-out-functions)
|
||||
(:after-out 'chronometrist-after-out-functions))))
|
||||
(if (--> (assoc task chronometrist-task-list #'equal)
|
||||
(rest it)
|
||||
(plist-get it hook)
|
||||
(setq chronometrist--task-hook it))
|
||||
(funcall fn 'chronometrist--task-hook task)
|
||||
(funcall fn var task))))
|
||||
|
||||
(defun chronometrist-run-functions-and-clock-in (task)
|
||||
"Run hooks and clock in to TASK."
|
||||
(run-hook-with-args 'chronometrist-before-in-functions task)
|
||||
(chronometrist-run-hooks task :before-in)
|
||||
(chronometrist-in task)
|
||||
(run-hook-with-args 'chronometrist-after-in-functions task))
|
||||
(chronometrist-run-hooks task :after-in))
|
||||
|
||||
(defun chronometrist-run-functions-and-clock-out (task)
|
||||
"Run hooks and clock out of TASK."
|
||||
(when (run-hook-with-args-until-failure 'chronometrist-before-out-functions task)
|
||||
(when (chronometrist-run-hooks task :before-out)
|
||||
(chronometrist-out)
|
||||
(run-hook-with-args 'chronometrist-after-out-functions task)))
|
||||
(chronometrist-run-hooks task :after-out)))
|
||||
|
||||
;; ## MAJOR-MODE ##
|
||||
(defvar chronometrist-mode-map
|
||||
|
|
Reference in New Issue