From 0ffee6167f5a90c13fffc53f27a7e13d35475645 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Fri, 3 Aug 2012 10:29:59 +0800 Subject: [PATCH] Workaround for latex-forward-sexp slowness. * textmodes/tex-mode.el (latex-forward-sexp): Terminate the loop if sexp scanning does not move point. Fixes: debbugs:5734 --- lisp/ChangeLog | 5 +++++ lisp/textmodes/tex-mode.el | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a09042d9faf..b550c8db7e2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-08-03 João Távora + + * textmodes/tex-mode.el (latex-forward-sexp): Terminate the loop + if sexp scanning does not move point (Bug#5734). + 2012-08-02 Tassilo Horn * textmodes/reftex-vars.el (reftex-default-label-alist-entries): diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 5571af1ad9b..9a3462773fc 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -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)) -- 2.39.2