branch: externals/tempel
commit db6847a7f994e9f4d9a5f9f0cb37264fc84a8049
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>

    Make temple-key a macro
---
 tempel.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tempel.el b/tempel.el
index cad63e0cfa..aa03aab2cd 100644
--- a/tempel.el
+++ b/tempel.el
@@ -425,11 +425,12 @@ If called interactively, select a template with 
`completing-read'."
                     (tempel--region))))
 
 ;;;###autoload
-(defun tempel-key (key name &optional map)
+(defmacro tempel-key (key name &optional map)
   "Bind KEY to NAME in MAP."
   (let ((cmd (intern (format "tempel-insert-%s" name))))
-    (fset cmd (lambda () (interactive) (tempel-insert name)))
-    (define-key (or map global-map) (kbd key) cmd)))
+    `(progn
+       (defun ,cmd () (interactive) (tempel-insert ',name))
+       (define-key ,(or map 'global-map) ,(kbd key) #',cmd))))
 
 (provide 'tempel)
 ;;; tempel.el ends here

Reply via email to