feat: new command chronometrist-discard-active
This commit is contained in:
parent
14f02ff402
commit
4eb4f30873
|
@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
2. New `plist-group` backend, reducing time taken in startup and after changes to the file.
|
2. New `plist-group` backend, reducing time taken in startup and after changes to the file.
|
||||||
3. Unified migration interface with command `chronometrist-migrate`.
|
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.
|
||||||
|
5. New command `chronometrist-discard-active`, to discard the active interval.
|
||||||
|
|
||||||
## [0.9.0] - 2021-07-08
|
## [0.9.0] - 2021-07-08
|
||||||
### Added
|
### Added
|
||||||
|
|
2
TODO.org
2
TODO.org
|
@ -746,7 +746,7 @@ A general library for this could convert between (both to and from) such strings
|
||||||
* today, yesterday, day before yesterday, tomorrow, day after tomorrow
|
* today, yesterday, day before yesterday, tomorrow, day after tomorrow
|
||||||
* N <seconds/minutes/hours/days/weeks/months/years> (ago|from now/today)
|
* N <seconds/minutes/hours/days/weeks/months/years> (ago|from now/today)
|
||||||
+ plus multiples of those units e.g. "1 year, 5 months, ... from now"
|
+ plus multiples of those units e.g. "1 year, 5 months, ... from now"
|
||||||
* STARTED Kill/discard command :feature:
|
* DONE Kill/discard command :feature:
|
||||||
Command to delete the interval currently being recorded. (bind to 'k')
|
Command to delete the interval currently being recorded. (bind to 'k')
|
||||||
+ Most conservative option - it will only operate on the project at point, and will only kill for a clocked-in project.
|
+ Most conservative option - it will only operate on the project at point, and will only kill for a clocked-in project.
|
||||||
+ Somewhat less conservative option - it will operate on the currently clocked-in project, no matter where point is.
|
+ Somewhat less conservative option - it will operate on the currently clocked-in project, no matter where point is.
|
||||||
|
|
|
@ -2030,10 +2030,11 @@ PREFIX is ignored."
|
||||||
(define-key map (kbd "a") #'chronometrist-add-new-task)
|
(define-key map (kbd "a") #'chronometrist-add-new-task)
|
||||||
(define-key map (kbd "RET") #'chronometrist-toggle-task)
|
(define-key map (kbd "RET") #'chronometrist-toggle-task)
|
||||||
(define-key map (kbd "M-RET") #'chronometrist-toggle-task-no-hooks)
|
(define-key map (kbd "M-RET") #'chronometrist-toggle-task-no-hooks)
|
||||||
(define-key map (kbd "<C-return>") #'chronometrist-restart-task)
|
|
||||||
(define-key map (kbd "<C-M-return>") #'chronometrist-extend-task)
|
|
||||||
(define-key map [mouse-1] #'chronometrist-toggle-task)
|
(define-key map [mouse-1] #'chronometrist-toggle-task)
|
||||||
(define-key map [mouse-3] #'chronometrist-toggle-task-no-hooks)
|
(define-key map [mouse-3] #'chronometrist-toggle-task-no-hooks)
|
||||||
|
(define-key map (kbd "<C-return>") #'chronometrist-restart-task)
|
||||||
|
(define-key map (kbd "<C-M-return>") #'chronometrist-extend-task)
|
||||||
|
(define-key map (kbd "D") #'chronometrist-discard-active)
|
||||||
(define-key map (kbd "d") #'chronometrist-details)
|
(define-key map (kbd "d") #'chronometrist-details)
|
||||||
(define-key map (kbd "r") #'chronometrist-report)
|
(define-key map (kbd "r") #'chronometrist-report)
|
||||||
(define-key map (kbd "l") #'chronometrist-open-log)
|
(define-key map (kbd "l") #'chronometrist-open-log)
|
||||||
|
@ -2056,6 +2057,7 @@ PREFIX is ignored."
|
||||||
["Extend time for last completed task" chronometrist-extend-task]
|
["Extend time for last completed task" chronometrist-extend-task]
|
||||||
["Extend time without running hooks" (chronometrist-extend-task t)
|
["Extend time without running hooks" (chronometrist-extend-task t)
|
||||||
:keys "\\[universal-argument] \\[chronometrist-extend-task]"]
|
:keys "\\[universal-argument] \\[chronometrist-extend-task]"]
|
||||||
|
["Discard active interval" chronometrist-discard-active]
|
||||||
["View details of today's data" chronometrist-details]
|
["View details of today's data" chronometrist-details]
|
||||||
["View weekly report" chronometrist-report]
|
["View weekly report" chronometrist-report]
|
||||||
["View/edit log file" chronometrist-open-log]
|
["View/edit log file" chronometrist-open-log]
|
||||||
|
@ -2210,6 +2212,15 @@ Has no effect if a task is active."
|
||||||
(run-hook-with-args 'chronometrist-after-out-functions task)))))
|
(run-hook-with-args 'chronometrist-after-out-functions task)))))
|
||||||
;; extend-task:1 ends here
|
;; extend-task:1 ends here
|
||||||
|
|
||||||
|
;; [[file:chronometrist.org::*discard-interval][discard-interval:1]]
|
||||||
|
(defun chronometrist-discard-active ()
|
||||||
|
"Remove active interval from the active backend."
|
||||||
|
(interactive)
|
||||||
|
(let ((backend (chronometrist-active-backend)))
|
||||||
|
(when (chronometrist-current-task backend)
|
||||||
|
(chronometrist-remove-last backend))))
|
||||||
|
;; discard-interval:1 ends here
|
||||||
|
|
||||||
;; [[file:chronometrist.org::*chronometrist][chronometrist:1]]
|
;; [[file:chronometrist.org::*chronometrist][chronometrist:1]]
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun chronometrist (&optional arg)
|
(defun chronometrist (&optional arg)
|
||||||
|
|
|
@ -2931,10 +2931,11 @@ PREFIX is ignored."
|
||||||
(define-key map (kbd "a") #'chronometrist-add-new-task)
|
(define-key map (kbd "a") #'chronometrist-add-new-task)
|
||||||
(define-key map (kbd "RET") #'chronometrist-toggle-task)
|
(define-key map (kbd "RET") #'chronometrist-toggle-task)
|
||||||
(define-key map (kbd "M-RET") #'chronometrist-toggle-task-no-hooks)
|
(define-key map (kbd "M-RET") #'chronometrist-toggle-task-no-hooks)
|
||||||
(define-key map (kbd "<C-return>") #'chronometrist-restart-task)
|
|
||||||
(define-key map (kbd "<C-M-return>") #'chronometrist-extend-task)
|
|
||||||
(define-key map [mouse-1] #'chronometrist-toggle-task)
|
(define-key map [mouse-1] #'chronometrist-toggle-task)
|
||||||
(define-key map [mouse-3] #'chronometrist-toggle-task-no-hooks)
|
(define-key map [mouse-3] #'chronometrist-toggle-task-no-hooks)
|
||||||
|
(define-key map (kbd "<C-return>") #'chronometrist-restart-task)
|
||||||
|
(define-key map (kbd "<C-M-return>") #'chronometrist-extend-task)
|
||||||
|
(define-key map (kbd "D") #'chronometrist-discard-active)
|
||||||
(define-key map (kbd "d") #'chronometrist-details)
|
(define-key map (kbd "d") #'chronometrist-details)
|
||||||
(define-key map (kbd "r") #'chronometrist-report)
|
(define-key map (kbd "r") #'chronometrist-report)
|
||||||
(define-key map (kbd "l") #'chronometrist-open-log)
|
(define-key map (kbd "l") #'chronometrist-open-log)
|
||||||
|
@ -2957,6 +2958,7 @@ PREFIX is ignored."
|
||||||
["Extend time for last completed task" chronometrist-extend-task]
|
["Extend time for last completed task" chronometrist-extend-task]
|
||||||
["Extend time without running hooks" (chronometrist-extend-task t)
|
["Extend time without running hooks" (chronometrist-extend-task t)
|
||||||
:keys "\\[universal-argument] \\[chronometrist-extend-task]"]
|
:keys "\\[universal-argument] \\[chronometrist-extend-task]"]
|
||||||
|
["Discard active interval" chronometrist-discard-active]
|
||||||
["View details of today's data" chronometrist-details]
|
["View details of today's data" chronometrist-details]
|
||||||
["View weekly report" chronometrist-report]
|
["View weekly report" chronometrist-report]
|
||||||
["View/edit log file" chronometrist-open-log]
|
["View/edit log file" chronometrist-open-log]
|
||||||
|
@ -3110,6 +3112,16 @@ Has no effect if a task is active."
|
||||||
(unless inhibit-hooks
|
(unless inhibit-hooks
|
||||||
(run-hook-with-args 'chronometrist-after-out-functions task)))))
|
(run-hook-with-args 'chronometrist-after-out-functions task)))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
**** discard-interval :command:
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun chronometrist-discard-active ()
|
||||||
|
"Remove active interval from the active backend."
|
||||||
|
(interactive)
|
||||||
|
(let ((backend (chronometrist-active-backend)))
|
||||||
|
(when (chronometrist-current-task backend)
|
||||||
|
(chronometrist-remove-last backend))))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
**** chronometrist :command:
|
**** chronometrist :command:
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
Reference in New Issue