emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/tmr f15579b58e 1/2: Add node about integration with Emb


From: ELPA Syncer
Subject: [elpa] externals/tmr f15579b58e 1/2: Add node about integration with Embark
Date: Wed, 29 Jun 2022 08:58:06 -0400 (EDT)

branch: externals/tmr
commit f15579b58e8cc71fbfe6423e3a42df25f2c78415
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@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-d81c6aaf8403@daniel-mendler.de%3E#%3C73e34fe6-f41a-10ad-95fa-0bcfbe8245b3@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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]