[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tempel 931ea613cb 49/82: Remove faces, reduce visual no
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tempel 931ea613cb 49/82: Remove faces, reduce visual noise |
Date: |
Sun, 9 Jan 2022 20:58:44 -0500 (EST) |
branch: externals/tempel
commit 931ea613cb5e332fda27cbf89b2d91a053bca3d1
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Remove faces, reduce visual noise
Try this to see if I like it better.
---
tempel.el | 35 +++++++++++++++--------------------
1 file changed, 15 insertions(+), 20 deletions(-)
diff --git a/tempel.el b/tempel.el
index 86f063299e..85f92b1e09 100644
--- a/tempel.el
+++ b/tempel.el
@@ -49,14 +49,9 @@
"Path to the template file."
:type 'string)
-(defcustom tempel-field-prefix
- #(" " 0 1 (display (space :width (2)) face tempel-field))
- "Field indicator prefix string."
- :type '(choice (const nil) string))
-
-(defcustom tempel-form-prefix
- #(" " 0 1 (display (space :width (2)) face tempel-form))
- "Form indicator prefix string."
+(defcustom tempel-mark
+ #(" " 0 1 (display (space :width (1)) face cursor))
+ "Field start indicator."
:type '(choice (const nil) string))
(defcustom tempel-insert-annotation 40
@@ -67,12 +62,6 @@
"Annotation width for `tempel-expand'."
:type '(choice (const nil integer)))
-(defface tempel-field '((t :inherit highlight))
- "Face used for fields.")
-
-(defface tempel-form '((t :inherit region))
- "Face used for evaluated forms.")
-
(defvar tempel--templates nil
"Templates loaded from the `tempel-file'.")
@@ -141,7 +130,11 @@ WIDTH, SEP and ELLIPSIS configure the formatting."
AFTER is non-nil after the modification.
BEG and END are the boundaries of the modification."
(when (and after (>= beg (overlay-start ov)) (<= beg (overlay-end ov)))
+ ;; TODO field marker
(move-overlay ov (overlay-start ov) (max end (overlay-end ov)))
+ (overlay-put ov 'before-string
+ (and (= (overlay-start ov) (overlay-end ov))
+ tempel-mark))
(let ((st (overlay-get ov 'tempel--state)))
(when-let (name (overlay-get ov 'tempel--name))
(setf (alist-get name (cdr st))
@@ -175,7 +168,12 @@ If OV is alive, move it."
(goto-char beg)
(delete-char (- end beg))
(insert str)
- (when ov (move-overlay ov beg (point))))))))
+ (when ov
+ (move-overlay ov beg (point))
+ (unless (overlay-get ov 'tempel--form)
+ (overlay-put ov 'before-string
+ (and (= (overlay-start ov) (overlay-end ov))
+ tempel-mark)))))))))
(defun tempel--field (st &optional name init)
"Add template field to ST.
@@ -183,8 +181,6 @@ NAME is the optional field name.
INIT is the optional initial input."
(let ((ov (make-overlay (point) (point))))
(push ov (car st))
- (overlay-put ov 'face 'tempel-field)
- (overlay-put ov 'before-string tempel-field-prefix)
(overlay-put ov 'modification-hooks (list #'tempel--field-modified))
(overlay-put ov 'insert-in-front-hooks (list #'tempel--field-modified))
(overlay-put ov 'insert-behind-hooks (list #'tempel--field-modified))
@@ -193,7 +189,8 @@ INIT is the optional initial input."
(overlay-put ov 'tempel--name name)
(setq init (or init (alist-get name (cdr st)) ""))
(setf (alist-get name (cdr st)) init))
- (when (and init (not (equal init "")))
+ (if (or (not init) (equal init ""))
+ (overlay-put ov 'before-string tempel-mark)
(insert init)
(move-overlay ov (overlay-start ov) (point)))))
@@ -205,8 +202,6 @@ INIT is the optional initial input."
;; Ignore errors since some variables may not be defined yet.
(void-variable nil))
(let ((ov (make-overlay beg (point) nil t)))
- (overlay-put ov 'face 'tempel-form)
- (overlay-put ov 'before-string tempel-form-prefix)
(overlay-put ov 'tempel--form form)
(push ov (car st)))))
- [elpa] externals/tempel 1ef2d76dd1 35/82: Add screenshots, (continued)
- [elpa] externals/tempel 1ef2d76dd1 35/82: Add screenshots, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel fcfb19e134 47/82: Improve undo, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 36a7977702 62/82: Use cyan color for default values, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel bcf135f993 66/82: Bind lexical environment for prompt eval, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 7a7813e531 26/82: Maintain list of active templates, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 934bf35f4b 37/82: Set deleted overlays to nil, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel a5dde06576 75/82: Add tempel-abbrev-mode and tempel-global-abbrev-mode, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 49ba6e795e 79/82: README update, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 72a31055cc 41/82: Fix movement commands, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 29ca4b424d 13/82: README formatting, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 931ea613cb 49/82: Remove faces, reduce visual noise,
ELPA Syncer <=
- [elpa] externals/tempel 49f779027c 38/82: Minor corrections, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel c8bd4d7e95 61/82: Add special treatment for default values, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 23443415c6 29/82: README: add more examples, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 566fbe15da 50/82: Add back faces, improve undo, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 87a5237034 28/82: Expand docstring, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 9fc17d541c 58/82: temple-key: Generate docstring, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 963128fb66 54/82: Minor fix, ELPA Syncer, 2022/01/09