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

    Simplify
---
 tempel.el | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/tempel.el b/tempel.el
index 4d4d2bc7e1..1c0b308642 100644
--- a/tempel.el
+++ b/tempel.el
@@ -74,11 +74,7 @@
     (goto-char (point-max))
     (insert "\n)")
     (goto-char (point-min))
-    (let ((templates (read (current-buffer))) result)
-      (while (and templates (symbolp (car templates)))
-        (push (cons (car templates) (seq-take-while #'consp (cdr templates))) 
result)
-        (setq templates (seq-drop-while #'consp (cdr templates))))
-      result)))
+    (read (current-buffer))))
 
 (defun tempel--annotate (templates sep name)
   "Annotate template NAME given the list of TEMPLATES and SEP."
@@ -232,9 +228,12 @@ BEG and END are the boundaries of the modification."
     (unless (equal tempel--modified mod)
       (setq tempel--templates (tempel--load tempel-file)
             tempel--modified mod)))
-  (apply #'append (mapcar #'cdr
-                          (seq-filter (lambda (x) (derived-mode-p (car x)))
-                                      tempel--templates))))
+  (let (result (templates tempel--templates))
+    (while (and templates (symbolp (car templates)))
+      (when (derived-mode-p (car templates))
+        (push (seq-take-while #'consp (cdr templates)) result))
+      (setq templates (seq-drop-while #'consp (cdr templates))))
+    (apply #'append result)))
 
 (defun tempel--region ()
   "Return region bounds."

Reply via email to