branch: externals/tmr commit cfd798b06660e2343a8cc373e2d1dfaae8a0c86d Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Add tmr-reschedule and tmr-edit-description Add bindings for more symmetry between toplevel and tabulated view. --- README.org | 2 ++ tmr-tabulated.el | 19 ++++++++----------- tmr.el | 20 ++++++++++++++++++++ 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/README.org b/README.org index 8359cd0b48..f0180ac5c7 100644 --- a/README.org +++ b/README.org @@ -321,6 +321,8 @@ Everything is in place to set up the package. (define-key map (kbd "C-c t l") #'tmr-tabulated-view) ; "list timers" mnemonic (define-key map (kbd "C-c t c") #'tmr-clone) (define-key map (kbd "C-c t k") #'tmr-cancel) + (define-key map (kbd "C-c t s") #'tmr-reschedule) + (define-key map (kbd "C-c t e") #'tmr-edit-description) (define-key map (kbd "C-c t K") #'tmr-remove-finished)) #+end_src diff --git a/tmr-tabulated.el b/tmr-tabulated.el index 10d0d5d844..def3cf274b 100644 --- a/tmr-tabulated.el +++ b/tmr-tabulated.el @@ -66,8 +66,11 @@ (define-key map "k" #'tmr-tabulated-cancel) (define-key map "K" #'tmr-remove-finished) (define-key map "+" #'tmr) + (define-key map "t" #'tmr) + (define-key map "*" #'tmr-with-description) + (define-key map "T" #'tmr-with-description) (define-key map "c" #'tmr-tabulated-clone) - (define-key map "w" #'tmr-tabulated-rewrite-description) + (define-key map "e" #'tmr-tabulated-edit-description) (define-key map "s" #'tmr-tabulated-reschedule) map) "Keybindings for `tmr-tabulated-mode-map'.") @@ -97,23 +100,17 @@ Interactively, use the timer at point." (defun tmr-tabulated-reschedule (timer) "Reschedule TIMER. -This is the same as cloning it and cancelling the original one. - -If TIMER has a description, prompt for one. Otherwise only -prompt for a duration." +This is the same as cloning it and cancelling the original one." (interactive (list (tmr-tabulated--get-timer-at-point))) - (tmr-clone timer :prompt) - (let (tmr-timer-cancelled-functions) - (tmr-tabulated-cancel timer))) + (tmr-reschedule timer)) -(defun tmr-tabulated-rewrite-description (timer description) +(defun tmr-tabulated-edit-description (timer description) "Change TIMER description with that of DESCRIPTION." (interactive (list (tmr-tabulated--get-timer-at-point) (tmr--description-prompt))) - (setf (tmr--timer-description timer) description) - (run-hooks 'tmr--update-hook)) + (tmr-edit-description timer description)) (defun tmr-tabulated--move-point-to-closest-entry () "Move the point to the next entry if there is one or to the previous one. diff --git a/tmr.el b/tmr.el index 2aaa412113..f5413248f1 100644 --- a/tmr.el +++ b/tmr.el @@ -217,6 +217,26 @@ completion." (run-hooks 'tmr--update-hook) (run-hook-with-args 'tmr-timer-cancelled-functions timer))) +;;;###autoload +(defun tmr-reschedule (timer) + "Reschedule TIMER. +This is the same as cloning it, prompting for duration and +cancelling the original one." + (interactive (list (tmr--read-timer))) + (tmr-clone timer :prompt) + (let (tmr-timer-cancelled-functions) + (tmr-cancel timer))) + +;;;###autoload +(defun tmr-edit-description (timer description) + "Change TIMER description with that of DESCRIPTION." + (interactive + (list + (tmr--read-timer) + (tmr--description-prompt))) + (setf (tmr--timer-description timer) description) + (run-hooks 'tmr--update-hook)) + ;;;###autoload (defun tmr-remove-finished () "Remove all finished timers."