Workaround for latex-forward-sexp slowness.
authorJoão Távora <joaotavora@gmail.com>
Fri, 3 Aug 2012 02:29:59 +0000 (10:29 +0800)
committerChong Yidong <cyd@gnu.org>
Fri, 3 Aug 2012 02:29:59 +0000 (10:29 +0800)
* textmodes/tex-mode.el (latex-forward-sexp): Terminate the loop if
sexp scanning does not move point.

Fixes: debbugs:5734

lisp/ChangeLog
lisp/textmodes/tex-mode.el

index a09042d..b550c8d 100644 (file)
@@ -1,3 +1,8 @@
+2012-08-03  João Távora  <joaotavora@gmail.com>
+
+       * textmodes/tex-mode.el (latex-forward-sexp): Terminate the loop
+       if sexp scanning does not move point (Bug#5734).
+
 2012-08-02  Tassilo Horn  <tsdh@gnu.org>
 
        * textmodes/reftex-vars.el (reftex-default-label-alist-entries):
index 5571af1..9a34627 100644 (file)
@@ -1722,9 +1722,12 @@ Mark is left at original location."
   "Like `forward-sexp' but aware of multi-char elements and escaped parens."
   (interactive "P")
   (unless arg (setq arg 1))
-  (let ((pos (point)))
+  (let ((pos (point))
+       (opoint 0))
     (condition-case err
-       (while (/= arg 0)
+       (while (and (/= (point) opoint)
+                   (/= arg 0))
+         (setq opoint (point))
          (setq arg
                (if (> arg 0)
                    (progn (latex-forward-sexp-1) (1- arg))