]> code.delx.au - gnu-emacs-elpa/commitdiff
avoid looking-back in el-search--goto-next-sexp
authorMichael Heerdegen <michael_heerdegen@web.de>
Tue, 22 Sep 2015 23:35:54 +0000 (01:35 +0200)
committerMichael Heerdegen <michael_heerdegen@web.de>
Sun, 11 Oct 2015 09:29:10 +0000 (11:29 +0200)
because it extremely slows it down

packages/el-search/el-search.el

index 3c7af293a06c34864cf78fccc942d5b2d9307ae7..cf9a23eb31220200896be0b09b29792a15b08342 100644 (file)
@@ -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