branch: externals/tmr commit f15579b58e8cc71fbfe6423e3a42df25f2c78415 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Add node about integration with Embark Using the code shared by Daniel Mendler on the mailing list[1] and the Embark wiki.[2] [1] https://lists.sr.ht/~protesilaos/tmr/%3cb80c3c89-c704-6f58-8e2d-d81c6aaf8...@daniel-mendler.de%3E#%3c73e34fe6-f41a-10ad-95fa-0bcfbe824...@daniel-mendler.de%3E [2] https://github.com/oantolin/embark/wiki/Additional-Actions#actions-for-prots-tmr-tmr-may-ring --- README.org | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.org b/README.org index 824ae1114e..375edd47e6 100644 --- a/README.org +++ b/README.org @@ -315,6 +315,36 @@ Everything is in place to set up the package. (define-key map (kbd "C-c t R") #'tmr-remove-finished)) #+end_src +* Integration with Embark +:PROPERTIES: +:CUSTOM_ID: h:64711ce4-c023-4f6e-b9aa-b43942013423 +:END: + +The =embark= package provides standards-compliant infrastructure to run +context-dependent actions on all sorts of targets (symbol at point, +current completion candidate, etc.). TMR is set up to make its timer +objects recognisable by Embark. All the user needs is something like +the following glue code: + +#+begin_src emacs-lisp +(defvar tmr-action-map + (let ((map (make-sparse-keymap))) + (define-key map "k" #'tmr-remove) + (define-key map "r" #'tmr-remove) + (define-key map "R" #'tmr-remove-finished) + (define-key map "c" #'tmr-clone) + (define-key map "e" #'tmr-edit-description) + (define-key map "s" #'tmr-reschedule) + map)) + +(with-eval-after-load 'embark + (add-to-list 'embark-keymap-alist '(tmr-timer . tmr-action-map)) + (cl-loop + for cmd the key-bindings of tmr-action-map + if (commandp cmd) do + (add-to-list 'embark-post-action-hooks (list cmd 'embark--restart)))) +#+end_src + * Acknowledgements :PROPERTIES: :CUSTOM_ID: h:047ecc52-ca02-4424-a037-c5b6a02383de