emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 9078f34: Fix a loop in c-fl-decl-start. This fixe


From: Alan Mackenzie
Subject: [Emacs-diffs] emacs-26 9078f34: Fix a loop in c-fl-decl-start. This fixes bug #34186.
Date: Fri, 25 Jan 2019 11:16:39 -0500 (EST)

branch: emacs-26
commit 9078f34e84178553cd59bc03ac1b58cb56038436
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    Fix a loop in c-fl-decl-start.  This fixes bug #34186.
    
    * lisp/progmodes/cc-mode.el (c-fl-decl-start) In the pair of operations
    c-syntactic-skip-backward and c-forward-syntactic-ws, ensure the latter
    doesn't come back to the position before the former, and break out of the
    enclosing loop if it does.
---
 lisp/progmodes/cc-mode.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 8cbb4e8..5283cfe 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1487,6 +1487,7 @@ Note that this is a strict tail, so won't match, e.g. 
\"0x....\".")
   ;; lock context (etc.) fontification.
   (goto-char pos)
   (let ((lit-start (c-literal-start))
+       old-pos
        (new-pos pos)
        capture-opener
        bod-lim bo-decl)
@@ -1509,12 +1510,14 @@ Note that this is a strict tail, so won't match, e.g. 
\"0x....\".")
     (while
        ;; Go to a less nested declaration each time round this loop.
        (and
+        (setq old-pos (point))
         (c-syntactic-skip-backward "^;{}" bod-lim t)
         (> (point) bod-lim)
         (progn (c-forward-syntactic-ws)
                ;; Have we got stuck in a comment at EOB?
                (not (and (eobp)
                          (c-literal-start))))
+        (< (point) old-pos)
         (progn (setq bo-decl (point))
                (or (not (looking-at c-protection-key))
                    (c-forward-keyword-clause 1)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]