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

    Improve tempel-abbrev-mode
    
    Ensure that correct template is expanded.
---
 tempel.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tempel.el b/tempel.el
index 7d7b8f78c4..27137f4050 100644
--- a/tempel.el
+++ b/tempel.el
@@ -859,16 +859,16 @@ If called interactively, select a template with 
`completing-read'."
     (let ((table (make-abbrev-table))
           (tempel--ignore-condition t))
       (dolist (template (tempel--templates))
-        (let* ((name (symbol-name (car template)))
-               (hook (make-symbol name)))
+        (let* ((sym (car template))
+               (hook (make-symbol (symbol-name sym))))
           (fset hook (lambda ()
-                       (tempel--delete-word name)
-                       (tempel--insert (cdr template) nil)
+                       (tempel--delete-word (symbol-name sym))
+                       (tempel--insert (alist-get sym (tempel--templates)) nil)
                        t))
           (put hook 'no-self-insert t)
-          (define-abbrev table name 'Template hook
+          (define-abbrev table (symbol-name sym) 'Template hook
             :system t :enable-function
-            (lambda () (assq (car template) (tempel--templates))))))
+            (lambda () (assq sym (tempel--templates))))))
       (setq-local abbrev-minor-mode-table-alist
                   (cons `(tempel-abbrev-mode . ,table)
                         abbrev-minor-mode-table-alist)))))

Reply via email to