[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tempel 7cf25bd795 71/82: Simplify templates data struct
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tempel 7cf25bd795 71/82: Simplify templates data structure at load time |
Date: |
Sun, 9 Jan 2022 20:58:46 -0500 (EST) |
branch: externals/tempel
commit 7cf25bd795f14a01e234257cccd2f18c7813e5e1
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Simplify templates data structure at load time
---
tempel.el | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/tempel.el b/tempel.el
index 8e164e2024..227653f3b6 100644
--- a/tempel.el
+++ b/tempel.el
@@ -120,7 +120,11 @@ may be named with `tempel--name' or carry an evaluatable
Lisp expression
(goto-char (point-max))
(insert "\n)")
(goto-char (point-min))
- (read (current-buffer))))
+ (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)))
(defun tempel--print-element (elt)
"Return string representation of template ELT."
@@ -324,16 +328,15 @@ PROMPT is the optional prompt/default value."
(defun tempel--templates ()
"Return templates for current mode."
- (let ((mod (file-attribute-modification-time (file-attributes tempel-file))))
+ (let ((mod (time-convert (file-attribute-modification-time
+ (file-attributes tempel-file))
+ 'integer)))
(unless (equal tempel--modified mod)
(setq tempel--templates (tempel--load tempel-file)
tempel--modified mod)))
- (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)))
+ (cl-loop for x in tempel--templates
+ if (derived-mode-p (car x))
+ append (cdr x)))
(defun tempel--region ()
"Return region bounds."
- [elpa] externals/tempel 07d16fded7 67/82: Update fields when new field is inserted, (continued)
- [elpa] externals/tempel 07d16fded7 67/82: Update fields when new field is inserted, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel f0df571f66 17/82: Respect derived modes, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel bf95b3f1c2 31/82: Add support for (q (FORM ...) var), ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 64f896d782 44/82: Fix jump to first field, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 9948c6889d 43/82: Add tempel-form-prefix and tempel-field-prefix, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel ad71c25632 32/82: Add syntax extension (p (FORM...) <NAME>), ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 5dbdc76eb2 74/82: Specify the completion category tempel, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 65a3eb0458 76/82: Improve abbreviation expansion, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 57bbc5e681 78/82: README update, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel ac3df540a4 69/82: Remove underlines from faces, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 7cf25bd795 71/82: Simplify templates data structure at load time,
ELPA Syncer <=
- [elpa] externals/tempel 69f7cb3212 06/82: Reimplement without Tempo for more flexibility, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel fbef94d77d 48/82: Minor cleanup, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 01e7430343 27/82: Add docstrings, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel a03c36c8dd 02/82: Improve behavior when templates are nested, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel db6847a7f9 56/82: Make temple-key a macro, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 0e618cd169 23/82: Do not sort overlays, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 04d4f6c055 55/82: Use named key function, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 91f6978ddd 60/82: Use Tempo PROMPT as default value, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel e20f982dc5 25/82: Remove global variable tempel--state, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel fa99fb7f96 34/82: README: Update keybindings, ELPA Syncer, 2022/01/09