[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tempel af98dd6b4d 4/9: If no region was given for `r` o
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tempel af98dd6b4d 4/9: If no region was given for `r` or `r>`, flag the field as "terminating" |
Date: |
Fri, 29 Apr 2022 23:57:46 -0400 (EDT) |
branch: externals/tempel
commit af98dd6b4d418d99e47e8fb182546ba9164ce89e
Author: Fritz Grabo <fritz.grabo@gmail.com>
Commit: Daniel Mendler <mail@daniel-mendler.de>
If no region was given for `r` or `r>`, flag the field as "terminating"
---
README.org | 3 ++-
tempel.el | 5 ++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/README.org b/README.org
index 5d40fffcf9..dc58b9373e 100644
--- a/README.org
+++ b/README.org
@@ -210,7 +210,8 @@ document the important ones here:
- ~n~ Inserts a newline.
- ~>~ Indents with ~indent-according-to-mode~.
- ~r~ Inserts the current region.
-- ~r>~ The region, but indented.
+ If no region is active, quits the containing template when jumped to.
+- ~r>~ Acts like ~r~, but indent region.
- ~n>~ Inserts a newline and indents.
- ~&~ Insert newline if there is only whitespace between line start and point.
- ~%~ Insert newline if there is only whitespace between point and line end.
diff --git a/tempel.el b/tempel.el
index 8b4327cafd..15864b3c11 100644
--- a/tempel.el
+++ b/tempel.el
@@ -324,7 +324,10 @@ Return the added field."
(`(l . ,lst) (dolist (e lst) (tempel--element st region e)))
((or 'p `(,(or 'p 'P) . ,rest)) (apply #'tempel--placeholder st rest))
((or 'r 'r> `(,(or 'r 'r>) . ,rest))
- (if (not region) (apply #'tempel--placeholder st rest)
+ (if (not region)
+ (when-let (ov (apply #'tempel--placeholder st rest))
+ (unless rest
+ (overlay-put ov 'tempel--terminate t)))
(goto-char (cdr region))
(when (eq (or (car-safe elt) elt) 'r>)
(indent-region (car region) (cdr region) nil))))
- [elpa] externals/tempel updated (f9e048e05c -> 805ac58a63), ELPA Syncer, 2022/04/29
- [elpa] externals/tempel 77bbbc8712 5/9: Allow to terminate a template immediately with `q`, ELPA Syncer, 2022/04/29
- [elpa] externals/tempel 344f9b0c36 7/9: Simplify tempel--range-modified, ELPA Syncer, 2022/04/29
- [elpa] externals/tempel 89ca46bbc8 8/9: Update comments, ELPA Syncer, 2022/04/29
- [elpa] externals/tempel 2ce14ab661 1/9: Make `tempel--{field, form, placeholder}` return the added element, ELPA Syncer, 2022/04/29
- [elpa] externals/tempel cec46fd8f9 2/9: Make `tempel--disable` optionally accept the template to disable, ELPA Syncer, 2022/04/29
- [elpa] externals/tempel 805ac58a63 9/9: Minor tweak to tempel--disable to avoid quadratic behavior, ELPA Syncer, 2022/04/29
- [elpa] externals/tempel af98dd6b4d 4/9: If no region was given for `r` or `r>`, flag the field as "terminating",
ELPA Syncer <=
- [elpa] externals/tempel 876495cf90 3/9: Disable containing template when jumping to "terminating" fields, ELPA Syncer, 2022/04/29
- [elpa] externals/tempel a1722e7490 6/9: Rename tempel--terminate to tempel--quit, ELPA Syncer, 2022/04/29