[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tempel 0e618cd169 23/82: Do not sort overlays
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tempel 0e618cd169 23/82: Do not sort overlays |
Date: |
Sun, 9 Jan 2022 20:58:42 -0500 (EST) |
branch: externals/tempel
commit 0e618cd1694d33498245583b60ed3a04e85704cc
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Do not sort overlays
---
tempel.el | 42 +++++++++++++++++++++++-------------------
1 file changed, 23 insertions(+), 19 deletions(-)
diff --git a/tempel.el b/tempel.el
index cc90affe52..49384cd5b7 100644
--- a/tempel.el
+++ b/tempel.el
@@ -36,7 +36,9 @@
;;; Code:
(require 'seq)
-(eval-when-compile (require 'subr-x))
+(eval-when-compile
+ (require 'subr-x)
+ (require 'cl-lib))
(defgroup tempel nil
"Simple templates"
@@ -238,7 +240,6 @@ BEG and END are the boundaries of the modification."
(dolist (x template) (tempel--element x region)))
;; End marker
(push (make-overlay (point) (point)) tempel--overlays))
- (setq tempel--overlays (sort tempel--overlays (lambda (x y) (<
(overlay-start x) (overlay-start y)))))
;; Jump to first field
(tempel-next 1)))
@@ -269,26 +270,29 @@ BEG and END are the boundaries of the modification."
(deactivate-mark)
(cons (point-marker) (mark-marker))))
+(defun tempel--find (dir)
+ "Find next overlay in DIR."
+ (let ((pt (point))
+ (next nil))
+ (if (> dir 0)
+ (cl-loop for ov in tempel--overlays do
+ (when (and (not (overlay-get ov 'tempel--form)) ;; Skip form
+ (> (overlay-start ov) pt))
+ (setq next (min (or next most-positive-fixnum) (overlay-end
ov)))))
+ (cl-loop for ov in tempel--overlays do
+ (when (and (not (overlay-get ov 'tempel--form)) ;; Skip form
+ (< (overlay-end ov) pt))
+ (setq next (max (or next most-negative-fixnum) (overlay-end
ov))))))
+ next))
+
(defun tempel-next (arg)
"Move ARG fields forward and quit at the end."
(interactive "p")
- (catch 'tempel--break
- (cond
- ((> arg 0)
- (dolist (ov tempel--overlays)
- (when (and (not (overlay-get ov 'tempel--form)) ;; Skip form
- (> (overlay-start ov) (point)))
- (if (> arg 1) (setq arg (1- arg))
- (goto-char (overlay-end ov))
- (throw 'tempel--break nil)))))
- ((< arg 0)
- (dolist (ov (reverse tempel--overlays))
- (when (and (not (overlay-get ov 'tempel--form)) ;; Skip form
- (< (overlay-end ov) (point)))
- (if (< arg -1) (setq arg (1+ arg))
- (goto-char (overlay-end ov))
- (throw 'tempel--break nil))))))
- (tempel-done)))
+ (cl-loop for i below (abs arg)
+ for next = (tempel--find arg) do
+ (if next (goto-char next)
+ (tempel-done)
+ (cl-return))))
(defun tempel-previous (arg)
"Move ARG fields backward and quit at the beginning."
- [elpa] externals/tempel 5dbdc76eb2 74/82: Specify the completion category tempel, (continued)
- [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, 2022/01/09
- [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 <=
- [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
- [elpa] externals/tempel c4cd6e0f69 73/82: Rename tempel-expand -> tempel-complete, add tempel-expand (Fix #13), ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 8f8588985a 04/82: Simplify template markers, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel d9efb707b3 20/82: Improve undo behavior, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 4bc75c1aba 52/82: Use the more subtle face colors from Modus, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 52d8556c05 57/82: Improve annotation function, ELPA Syncer, 2022/01/09
- [elpa] externals/tempel 675e759bde 64/82: Add special prompt treatment, ELPA Syncer, 2022/01/09