From cdcc059b26e4c922d94bb67521c6c87e84fa5642 Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Sun, 13 Feb 2022 17:07:18 +0530 Subject: [PATCH 01/14] Add notes on multiple intervals/time deduction --- TODO.org | 3 +++ 1 file changed, 3 insertions(+) diff --git a/TODO.org b/TODO.org index d2cb667..6121749 100644 --- a/TODO.org +++ b/TODO.org @@ -855,6 +855,9 @@ With different checks, for different levels of speed/thoroughness - #+END_SRC It doesn't do anything not already possible in the current formats. At best, it removes some duplication when the same task is "paused" and "resumed". ++ Sometimes you pause and resume a task and don't want to split your key-values between >1 intervals (to avoid messing up completion suggestions for the future). An alternative means to the same end could be to add a key like =:deduct ""= or =:deduct ("" . "")=. + - This will also make it easier to support formats like [[https://klog.jotaen.net/][klog]], which support this feature. + - It will probably complicate all data consuming code, though...think of =chronometrist-details= 🤔 ** "event records" - records with only a timestamp :feature: :PROPERTIES: From fe9ed8c7f01d80abcd1846aa82a0f9df680298d3 Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Mon, 14 Feb 2022 09:00:31 +0530 Subject: [PATCH 02/14] Add customizable alerts idea --- TODO.org | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/TODO.org b/TODO.org index 6121749..79281d4 100644 --- a/TODO.org +++ b/TODO.org @@ -737,7 +737,9 @@ for )" #+END_SRC * STARTED customizable duration output :feature: -See branch =format-seconds=. +:PROPERTIES: +:branch: format-seconds +:END: 1. [X] define =chronometrist-duration-formats= to hold duration formats for different use cases in Chronometrist. 2. [ ] define customization type for =chronometrist-duration-formats= to create user-friendly Custom interface 3. [ ] make non-tabular parts of Chronometrist buffers adapt to column widths, to accomodate changes in duration formats @@ -933,6 +935,11 @@ Additional rules: + /Avoid taking other unearned breaks/ if possible — so try to do personal tasks during normal or big breaks, or before/after your work day. #+END_QUOTE +Example flow +1. work for 30m +2. clock out - add 10m to =break-time= +3. clock in after a 5m break - subtract 5m from =break-time= + 1. [X] =chronometrist-third-fraction= 2. [X] =chronometrist-third-break-time= 3. [X] on clock out, increment =break-time= and start timed notification @@ -950,8 +957,23 @@ Extras 3. handle user edits to the database * last record modified - ? * remove last record - ? + * example - interval extended + 1. work 10 minutes and clock out - +3m break time + 2. edit stop time to add +20 minutes of work (30m total) + * compare with old data in hash table - decrement break time added by old plist, increment break time added by new plist -Example flow -1. work for 30m -2. clock out - add 10m to =break-time= -3. clock in after a 5m break - subtract 5m from =break-time= +* Customizable alerts +:PROPERTIES: +:CREATED: 2022-02-14T08:22:36+0530 +:END: +=chronometrist-third= and =chronometrist-goal= have nearly identical alert code; additionally, users cannot customize the alert style per-alert without basically rewriting the alert functions. + +Convert =chronometrist-third-alert-functions= and =chronometrist-goal-alert-functions= to customizable alists whose entries take the form =(SYMBOL FUNCTION ALERT-FN &rest ALERT-ARGS)=, where ++ =SYMBOL= uniquely identifies the alert, ++ =FUNCTION= is a function calling =chronometrist-*-run-at-time= and =ALERT-FN=, and ++ =ALERT-ARGS= are passed to =ALERT-FN=. + +=ALERT-FN= will usually be =alert=, and =ALERT-ARGS= will usually be keyword arguments passed to =alert=. +Similar to how they behave now, these packages will start/stop functions for all entries provided in these alists. (So the user can still control which alerts are run.) + +Also define =chronometrist--timer-alist=, which associates =symbol= with a timer object. From e7fd4df27e56611084e9f778aa6e8c3d8fef1948 Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Mon, 14 Feb 2022 09:00:54 +0530 Subject: [PATCH 03/14] Split Third Time section into headings --- TODO.org | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/TODO.org b/TODO.org index 79281d4..dd5a4dc 100644 --- a/TODO.org +++ b/TODO.org @@ -935,11 +935,12 @@ Additional rules: + /Avoid taking other unearned breaks/ if possible — so try to do personal tasks during normal or big breaks, or before/after your work day. #+END_QUOTE -Example flow +** Example flow 1. work for 30m 2. clock out - add 10m to =break-time= 3. clock in after a 5m break - subtract 5m from =break-time= +** Tasks 1. [X] =chronometrist-third-fraction= 2. [X] =chronometrist-third-break-time= 3. [X] on clock out, increment =break-time= and start timed notification @@ -951,7 +952,7 @@ Example flow * [ ] Hook function which prompts for work hours whenever you first clock in on a date. If work hours are defined in the custom variable, ask whether to use them - on negative answer, prompt for today's work hours. If work hours are not defined, prompt for today's work hours. 7. [ ] Displaying/recording breaks. Probably done implicitly - when work hours are defined, any time not spent working can be interpreted as break time. -Extras +** Extras 1. persist =break-time= between Emacs sessions 2. audible alerts 3. handle user edits to the database From a5c709253f785babe924fb6b7528464bcee2d86f Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Mon, 14 Feb 2022 13:05:02 +0530 Subject: [PATCH 04/14] Add CUSTOM_ID, macro idea --- TODO.org | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/TODO.org b/TODO.org index dd5a4dc..81a5db5 100644 --- a/TODO.org +++ b/TODO.org @@ -966,10 +966,11 @@ Additional rules: * Customizable alerts :PROPERTIES: :CREATED: 2022-02-14T08:22:36+0530 +:CUSTOM_ID: customizable-alerts :END: =chronometrist-third= and =chronometrist-goal= have nearly identical alert code; additionally, users cannot customize the alert style per-alert without basically rewriting the alert functions. -Convert =chronometrist-third-alert-functions= and =chronometrist-goal-alert-functions= to customizable alists whose entries take the form =(SYMBOL FUNCTION ALERT-FN &rest ALERT-ARGS)=, where +Convert =chronometrist-third-alert-functions= and =chronometrist-goal-alert-functions= to customizable alists[fn:4] whose entries take the form =(SYMBOL FUNCTION ALERT-FN &rest ALERT-ARGS)=, where + =SYMBOL= uniquely identifies the alert, + =FUNCTION= is a function calling =chronometrist-*-run-at-time= and =ALERT-FN=, and + =ALERT-ARGS= are passed to =ALERT-FN=. @@ -978,3 +979,5 @@ Convert =chronometrist-third-alert-functions= and =chronometrist-goal-alert-func Similar to how they behave now, these packages will start/stop functions for all entries provided in these alists. (So the user can still control which alerts are run.) Also define =chronometrist--timer-alist=, which associates =symbol= with a timer object. + +[fn:4] Actually, make a macro to define such alists, since the docstrings are likely to be near-identical. From 2eed71ad8565169a3639b79bebdad951ffc7c7ff Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Mon, 14 Feb 2022 20:47:12 +0530 Subject: [PATCH 05/14] Add 'canned key-values' idea --- TODO.org | 1 + 1 file changed, 1 insertion(+) diff --git a/TODO.org b/TODO.org index 81a5db5..b767c5d 100644 --- a/TODO.org +++ b/TODO.org @@ -860,6 +860,7 @@ It doesn't do anything not already possible in the current formats. At best, it + Sometimes you pause and resume a task and don't want to split your key-values between >1 intervals (to avoid messing up completion suggestions for the future). An alternative means to the same end could be to add a key like =:deduct ""= or =:deduct ("" . "")=. - This will also make it easier to support formats like [[https://klog.jotaen.net/][klog]], which support this feature. - It will probably complicate all data consuming code, though...think of =chronometrist-details= 🤔 + - An alternative idea could be to define a custom variable to hold the user's key values. If this variable is defined, it would be used instead of generating suggestions from past key-values. That way, such situations will not affect key-value suggestions. ** "event records" - records with only a timestamp :feature: :PROPERTIES: From d88619b15fd42102aeaa4b86fe4eaefd1f3cb256 Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Mon, 14 Feb 2022 22:13:00 +0530 Subject: [PATCH 06/14] Update TODO for alert macro --- TODO.org | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TODO.org b/TODO.org index b767c5d..5856815 100644 --- a/TODO.org +++ b/TODO.org @@ -964,10 +964,11 @@ Additional rules: 2. edit stop time to add +20 minutes of work (30m total) * compare with old data in hash table - decrement break time added by old plist, increment break time added by new plist -* Customizable alerts +* STARTED Customizable alerts [50%] :PROPERTIES: :CREATED: 2022-02-14T08:22:36+0530 :CUSTOM_ID: customizable-alerts +:branch: alert-macro :END: =chronometrist-third= and =chronometrist-goal= have nearly identical alert code; additionally, users cannot customize the alert style per-alert without basically rewriting the alert functions. @@ -981,4 +982,7 @@ Similar to how they behave now, these packages will start/stop functions for all Also define =chronometrist--timer-alist=, which associates =symbol= with a timer object. +1. [X] write macro +2. [ ] use in =chronometrist-goal= and =chronometrist-third= + [fn:4] Actually, make a macro to define such alists, since the docstrings are likely to be near-identical. From 27ebc824fa90a239aab55cbbde3030ede80fbb6f Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Tue, 15 Feb 2022 01:26:15 +0530 Subject: [PATCH 07/14] Correct :nexport: tag --- elisp/chronometrist-key-values.org | 2 +- elisp/chronometrist-spark.org | 2 +- elisp/chronometrist-third.org | 2 +- elisp/chronometrist.org | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/elisp/chronometrist-key-values.org b/elisp/chronometrist-key-values.org index 37a4767..1d11d78 100644 --- a/elisp/chronometrist-key-values.org +++ b/elisp/chronometrist-key-values.org @@ -741,7 +741,7 @@ Return t, to permit use in `chronometrist-before-out-functions'." ;;; chronometrist-key-values.el ends here #+END_SRC -* Local variables :NOEXPORT: +* Local variables :noexport: # Local Variables: # eval: (when (package-installed-p 'literate-elisp) (require 'literate-elisp) (literate-elisp-load (buffer-file-name))) # End: diff --git a/elisp/chronometrist-spark.org b/elisp/chronometrist-spark.org index cb645cf..c06ff16 100644 --- a/elisp/chronometrist-spark.org +++ b/elisp/chronometrist-spark.org @@ -171,7 +171,7 @@ SCHEMA should be a vector as specified by `tabulated-list-format'." ;;; chronometrist-spark.el ends here #+END_SRC -* Local variables :NOEXPORT: +* Local variables :noexport: # Local Variables: # eval: (when (package-installed-p 'literate-elisp) (require 'literate-elisp) (literate-elisp-load (buffer-file-name))) # End: diff --git a/elisp/chronometrist-third.org b/elisp/chronometrist-third.org index 6841004..4c40bb0 100644 --- a/elisp/chronometrist-third.org +++ b/elisp/chronometrist-third.org @@ -206,7 +206,7 @@ break time is up." ;;; chronometrist-third.el ends here #+END_SRC -* Local variables :NOEXPORT: +* Local variables :noexport: # Local Variables: # my-org-src-default-lang: "emacs-lisp" # eval: (when (package-installed-p 'literate-elisp) (require 'literate-elisp) (literate-elisp-load (buffer-file-name))) diff --git a/elisp/chronometrist.org b/elisp/chronometrist.org index 176cc47..032fef1 100644 --- a/elisp/chronometrist.org +++ b/elisp/chronometrist.org @@ -2851,7 +2851,7 @@ Return value is either a list in the form collect plist)) #+END_SRC -***** TODO active-days :reader:method:NOEXPORT: +***** TODO active-days :reader:method:noexport: #+BEGIN_SRC emacs-lisp :tangle no (cl-defmethod chronometrist-active-days ((backend chronometrist-plist-group-backend) task &key start end) (cl-check-type task string) @@ -2876,7 +2876,7 @@ We apply the same hack as in the [[hack-note-plist-group-insert][insert]] method t)) #+END_SRC -***** count-records :reader:method:NOEXPORT: +***** count-records :reader:method:noexport: #+BEGIN_SRC emacs-lisp :tangle no (cl-defmethod chronometrist-count-records ((backend chronometrist-plist-group-backend))) #+END_SRC @@ -4763,7 +4763,7 @@ Return value is a list as specified by `tabulated-list-entries'." ;;; chronometrist.el ends here #+END_SRC -* Local variables :NOEXPORT: +* Local variables :noexport: Evaluate this to be able to insert the package prefix via =nameless-insert-name=, at the cost of having all =nameless-aliases= break (= less readable code). #+BEGIN_SRC emacs-lisp :load no :tangle no From 456fe451abea3e5a53f5470b1bfca34dd45f4dec Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Tue, 15 Feb 2022 12:32:07 +0530 Subject: [PATCH 08/14] Add heading tags --- TODO.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO.org b/TODO.org index 5856815..cefa47e 100644 --- a/TODO.org +++ b/TODO.org @@ -964,7 +964,7 @@ Additional rules: 2. edit stop time to add +20 minutes of work (30m total) * compare with old data in hash table - decrement break time added by old plist, increment break time added by new plist -* STARTED Customizable alerts [50%] +* STARTED Customizable alerts [50%] :feature:code: :PROPERTIES: :CREATED: 2022-02-14T08:22:36+0530 :CUSTOM_ID: customizable-alerts From 4638b040ff3d1128b6a7db132cd255c0c45a837d Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Tue, 15 Feb 2022 12:35:31 +0530 Subject: [PATCH 09/14] Use headings for new backend items --- TODO.org | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/TODO.org b/TODO.org index cefa47e..9c76ba1 100644 --- a/TODO.org +++ b/TODO.org @@ -799,12 +799,18 @@ protocol implementation progress 20. [ ] [superclass] chronometrist-timer * New backends :feature: -1. Org time tracking -2. timeclock -3. [[https://klog.jotaen.net/][klog]] -4. SQLite -5. https://github.com/projecthamster/hamster - + https://github.com/projecthamster/hamster/wiki/Our-datamodel +** Org time tracking +** timeclock +See docstring of =timeclock-log-data= + +** [[https://klog.jotaen.net/][klog]] +:PROPERTIES: +:CUSTOM_ID: new-backends-klog +:END: +** SQLite +** Project Hamster +https://github.com/projecthamster/hamster ++ https://github.com/projecthamster/hamster/wiki/Our-datamodel * Functions doing similar things :code: 1. =task-time-one-day= @@ -858,7 +864,7 @@ With different checks, for different levels of speed/thoroughness - It doesn't do anything not already possible in the current formats. At best, it removes some duplication when the same task is "paused" and "resumed". + Sometimes you pause and resume a task and don't want to split your key-values between >1 intervals (to avoid messing up completion suggestions for the future). An alternative means to the same end could be to add a key like =:deduct ""= or =:deduct ("" . "")=. - - This will also make it easier to support formats like [[https://klog.jotaen.net/][klog]], which support this feature. + - This will also make it easier to support formats like [[#new-backends-klog][klog]], which support this feature. - It will probably complicate all data consuming code, though...think of =chronometrist-details= 🤔 - An alternative idea could be to define a custom variable to hold the user's key values. If this variable is defined, it would be used instead of generating suggestions from past key-values. That way, such situations will not affect key-value suggestions. From b222ecc35f4f25c3f2f51f8247f22eb2177fc6c9 Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Tue, 15 Feb 2022 12:48:19 +0530 Subject: [PATCH 10/14] Update section "customizable task list" and CHANGELOG --- CHANGELOG.md | 2 +- TODO.org | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed0046a..50e3151 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 1. Multiple backend support - new custom variable `chronometrist-active-backend` to determine active backend, new command `chronometrist-switch-backend` to temporarily select a backend (with completion). 2. New `plist-group` backend, reducing time taken in startup and after changes to the file. 3. Unified migration interface with command `chronometrist-migrate`. -4. New custom variable `chronometrist-task-list`, to add/hide tasks without modifying the database. +4. New custom variable `chronometrist-task-list`, to add/hide tasks without modifying the database. Setting it also disables generation of the task list from the database, speeding up many operations. 5. New command `chronometrist-discard-active`, to discard the active interval. 6. Debug logging messages - to view them, set `chronometrist-debug-enable`. 7. `chronometrist-third`, an extension to add support for the [Third Time](https://www.lesswrong.com/posts/RWu8eZqbwgB9zaerh/third-time-a-better-way-to-work) system. diff --git a/TODO.org b/TODO.org index 9c76ba1..43e2a8b 100644 --- a/TODO.org +++ b/TODO.org @@ -818,9 +818,10 @@ https://github.com/projecthamster/hamster 3. =events-to-durations= * Use ISO date for functions operating on dates :time:format: -* STARTED customizable task list :feature: -1. Interactive, buffer-local modification of task list, with completion (=completing-read-multiple=) -2. Adding a task? We can modify the task list, but how to persist it? +* STARTED customizable task list [33%] :feature: +1. [X] Make =chronometrist-task-list= customizable +2. [ ] Interactive, buffer-local modification of task list, with completion (=completing-read-multiple=) +3. [ ] Adding a task? We can modify the task list, but how to persist it? * Extend time range prompt :feature: Support inputs like "today", "yesterday", "5 days ago", etc. From 9cdc5e5cbbe9dd611a330d1da99b122780d1c5bf Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Tue, 15 Feb 2022 18:16:58 +0530 Subject: [PATCH 11/14] Tweak task --- TODO.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO.org b/TODO.org index 43e2a8b..a2c60aa 100644 --- a/TODO.org +++ b/TODO.org @@ -919,7 +919,7 @@ The plist backend could theoretically be extended to support it, but I'd rather :CREATED: 2022-01-08T23:32:37+0530 :END: 1. [ ] default suggested input backend should be the active backend -2. [ ] conserve file local variables prop line +2. [ ] conserve file local variables prop line for text backends * STARTED Support for the Third Time System [57%] :extension: :PROPERTIES: From dd8660ee736f0920c771ded8eb4d82112d42c4ee Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Thu, 17 Feb 2022 23:33:07 +0530 Subject: [PATCH 12/14] Add tasks for implementing date properties --- TODO.org | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TODO.org b/TODO.org index a2c60aa..631fb15 100644 --- a/TODO.org +++ b/TODO.org @@ -879,7 +879,7 @@ Records not used for time tracking, but to store data associated with a date or [] ...) #+END_SRC -** STARTED tagging dates with key-values :feature: +** STARTED tagging dates with key-values [0%] :feature: :PROPERTIES: :CREATED: 2022-02-10T22:59:45+0530 :CUSTOM_ID: date-key-values @@ -904,6 +904,10 @@ Alternatively, this would be easier to work with - easier to select the key-valu The plist backend could theoretically be extended to support it, but I'd rather deprecate that format (since it suffers from performance issues) and not deal with it again. +1. [ ] Update call sites of =chronometrist-latest-date-records= (which may now also contain key-values) +2. [ ] Update code accessing the hash table +3. [ ] Update =plist-pp= to handle + * undesired file watcher created after literate-elisp-load :bug: :PROPERTIES: :CREATED: 2021-12-18T15:13:35+0530 From 6b56be318d7363cffd17d90227f903ec2990078d Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Thu, 17 Feb 2022 23:33:38 +0530 Subject: [PATCH 13/14] Move tasks into main heading --- TODO.org | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/TODO.org b/TODO.org index 631fb15..b4c2596 100644 --- a/TODO.org +++ b/TODO.org @@ -947,12 +947,6 @@ Additional rules: + /Avoid taking other unearned breaks/ if possible — so try to do personal tasks during normal or big breaks, or before/after your work day. #+END_QUOTE -** Example flow -1. work for 30m -2. clock out - add 10m to =break-time= -3. clock in after a 5m break - subtract 5m from =break-time= - -** Tasks 1. [X] =chronometrist-third-fraction= 2. [X] =chronometrist-third-break-time= 3. [X] on clock out, increment =break-time= and start timed notification @@ -964,6 +958,11 @@ Additional rules: * [ ] Hook function which prompts for work hours whenever you first clock in on a date. If work hours are defined in the custom variable, ask whether to use them - on negative answer, prompt for today's work hours. If work hours are not defined, prompt for today's work hours. 7. [ ] Displaying/recording breaks. Probably done implicitly - when work hours are defined, any time not spent working can be interpreted as break time. +** Example flow +1. work for 30m +2. clock out - add 10m to =break-time= +3. clock in after a 5m break - subtract 5m from =break-time= + ** Extras 1. persist =break-time= between Emacs sessions 2. audible alerts From 08e53cfea3a6957fd7a904d9fce5f6ef93479445 Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Thu, 17 Feb 2022 23:44:08 +0530 Subject: [PATCH 14/14] Add predefined key-values idea --- TODO.org | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/TODO.org b/TODO.org index b4c2596..72a37e6 100644 --- a/TODO.org +++ b/TODO.org @@ -855,6 +855,9 @@ With different checks, for different levels of speed/thoroughness - * format changes ** multiple intervals per record :feature: +:PROPERTIES: +:CUSTOM_ID: multiple-intervals-per-record +:END: #+BEGIN_SRC emacs-lisp (:name "" [] ... @@ -996,3 +999,16 @@ Also define =chronometrist--timer-alist=, which associates =symbol= with a timer 2. [ ] use in =chronometrist-goal= and =chronometrist-third= [fn:4] Actually, make a macro to define such alists, since the docstrings are likely to be near-identical. + +* Predefined key-values for tasks [100%] +:PROPERTIES: +:CREATED: 2022-02-17T23:34:17+0530 +:END: +Benefits +1. Speeds up key-value completion for very large data sets. +2. Prevents key-value suggestions from being affected by [[#multiple-intervals-per-record][splitting of tasks across multiple intervals]]. + +#+BEGIN_SRC emacs-lisp +'(("Task" ...) + ...) +#+END_SRC