[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tempel 10ee82ef8b 1/3: Improve example
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tempel 10ee82ef8b 1/3: Improve example |
Date: |
Sun, 16 Jan 2022 16:57:44 -0500 (EST) |
branch: externals/tempel
commit 10ee82ef8b72e8524c7ae7b20cb3e4597ccae01a
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Improve example
---
README.org | 6 +++++-
tempel.el | 4 ++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/README.org b/README.org
index 37ea2f79b3..25e805a475 100644
--- a/README.org
+++ b/README.org
@@ -149,7 +149,11 @@ the template. Behind the name, the Tempo syntax elements
follow.
(class "public class " (p (file-name-base (or (buffer-file-name)
(buffer-name)))) " {" n> r> n "}")
- c-mode :condition (bolp)
+ c-mode
+ :condition
+ (save-match-data
+ (save-excursion
+ (re-search-backward "^\\w*$" (line-beginning-position) 'noerror)))
(inc "#include <" (p (concat (file-name-base (or (buffer-file-name)
(buffer-name))) ".h")) ">")
(incc "#include \"" (p (concat (file-name-base (or (buffer-file-name)
(buffer-name))) ".h")) "\"")
diff --git a/tempel.el b/tempel.el
index 3a056f2325..c5c6585d9b 100644
--- a/tempel.el
+++ b/tempel.el
@@ -367,7 +367,7 @@ PROMPT is the optional prompt/default value."
(push (pop data) plist))
(while (consp (car data))
(push (pop data) templates))
- (push (list mode (nreverse plist) (nreverse templates)) result)))
+ (push `(,mode ,(nreverse plist) . ,(nreverse templates)) result)))
result)))
(defun tempel-file-templates ()
@@ -378,7 +378,7 @@ PROMPT is the optional prompt/default value."
(unless (equal tempel--file-modified mod)
(setq tempel--file-templates (tempel--file-read tempel-file)
tempel--file-modified mod)))
- (cl-loop for (mode plist templates) in tempel--file-templates
+ (cl-loop for (mode plist . templates) in tempel--file-templates
if (or (derived-mode-p mode) (eq mode #'fundamental-mode))
if (or (not (plist-member plist :condition))
(eval (plist-get plist :condition) 'lexical))