From: Alan Mackenzie Date: Sat, 2 Aug 2014 16:42:29 +0000 (+0000) Subject: Correct loop termination condition in c-syntactic-skip-backward. X-Git-Tag: emacs-25.0.90~2635^2~679^2~542 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=790221774532185b590fecd64585309aed034063;p=emacs.git Correct loop termination condition in c-syntactic-skip-backward. progmodes/cc-engine.el (c-syntactic-skip-backward): Correct for the situation where, after moving back out of a literal, skip-chars-backward doesn't move further, yet checks have still to be done. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 531cbe5aeed..83975cb885b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2014-08-02 Alan Mackenzie + + Correct loop termination condition in c-syntactic-skip-backward. + * progmodes/cc-engine.el (c-syntactic-skip-backward): Correct for + the situation where, after moving back out of a literal, + skip-chars-backward doesn't move further, yet checks have still to + be done. + 2014-08-01 Eli Zaretskii * tutorial.el (tutorial--display-changes): Accept punctuation diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 7404241af9b..0a96b155498 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -4245,16 +4245,18 @@ comment at the start of cc-engine.el for more info." ;; loops when it hasn't succeeded. (while (and - (< (skip-chars-backward skip-chars limit) 0) + (let ((pos (point))) + (while (and + (< (skip-chars-backward skip-chars limit) 0) + ;; Don't stop inside a literal. + (when (setq lit-beg (c-ssb-lit-begin)) + (goto-char lit-beg) + t))) + (< (point) pos)) (let ((pos (point)) state-2 pps-end-pos) (cond - ;; Don't stop inside a literal - ((setq lit-beg (c-ssb-lit-begin)) - (goto-char lit-beg) - t) - ((and paren-level (save-excursion (setq state-2 (parse-partial-sexp