emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/el-search 29ec302 012/332: avoid looking-back in el-sea


From: Stefan Monnier
Subject: [elpa] externals/el-search 29ec302 012/332: avoid looking-back in el-search--goto-next-sexp
Date: Tue, 1 Dec 2020 15:48:01 -0500 (EST)

branch: externals/el-search
commit 29ec302fa7dfd618a3849c11fbb3d7d14d654960
Author: Michael Heerdegen <michael_heerdegen@web.de>
Commit: Michael Heerdegen <michael_heerdegen@web.de>

    avoid looking-back in el-search--goto-next-sexp
    
    because it extremely slows it down
---
 el-search.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/el-search.el b/el-search.el
index 3c7af29..cf9a23e 100644
--- a/el-search.el
+++ b/el-search.el
@@ -244,7 +244,11 @@ expression."
 Don't move if already at beginning of a sexp."
   (let ((not-done t) res)
     (while not-done
-      (let ((stop-here nil) syntax-here)
+      (let ((stop-here nil) syntax-here
+            (looking-at-from-back (lambda (regexp n)
+                                    (save-excursion
+                                      (backward-char n)
+                                      (looking-at regexp)))))
         (while (not stop-here)
           (cond
            ((eobp) (signal 'end-of-buffer nil))
@@ -257,10 +261,10 @@ Don't move if already at beginning of a sexp."
            ;; FIXME: can the rest be done more generically?
            ((and (looking-at (rx (or (syntax symbol) (syntax word))))
                  (not (looking-at "\\_<"))
-                 (not (looking-back ",@" 2)))
+                 (not (funcall looking-at-from-back ",@" 2)))
             (forward-symbol 1))
-           ((or (and (looking-at "'") (looking-back "#" 1))
-                (and (looking-at "@") (looking-back "," 1)))
+           ((or (and (looking-at "'") (funcall looking-at-from-back "#" 1))
+                (and (looking-at "@") (funcall looking-at-from-back "," 1)))
             (forward-char))
            (t (setq stop-here t)))))
       (condition-case nil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]