From 790221774532185b590fecd64585309aed034063 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Sat, 2 Aug 2014 16:42:29 +0000 Subject: [PATCH] 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. --- lisp/ChangeLog | 8 ++++++++ lisp/progmodes/cc-engine.el | 14 ++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) 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 -- 2.39.5