emacs-diffs
[Top][All Lists]
Advanced

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

master af6a93b2b8: * lisp/progmodes/cc-mode.el (c-fl-decl-start): Fix of


From: Alan Mackenzie
Subject: master af6a93b2b8: * lisp/progmodes/cc-mode.el (c-fl-decl-start): Fix off-by-one error.
Date: Thu, 10 Nov 2022 05:07:57 -0500 (EST)

branch: master
commit af6a93b2b85839f9f5775f6350ddd3036be177f4
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    * lisp/progmodes/cc-mode.el (c-fl-decl-start): Fix off-by-one error.
    
    This fixes bug #59070.
---
 lisp/progmodes/cc-mode.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 2aa6b90dea..34ba97bb87 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -2390,6 +2390,8 @@ with // and /*, not more generic line and block comments."
          ;; Go to a less nested declaration each time round this loop.
          (and
           (setq old-pos (point))
+          ;; The following form tries to move to the end of the previous
+          ;; declaration without moving outside of an enclosing {.
           (let (pseudo)
             (while
                 (and
@@ -2404,7 +2406,9 @@ with // and /*, not more generic line and block comments."
                           (setq pseudo (c-cheap-inside-bracelist-p 
(c-parse-state)))))))
               (goto-char pseudo))
             t)
-          (>= (point) bod-lim)
+          (or (> (point) bod-lim)
+              (eq bod-lim (point-min)))
+          ;; Move forward to the start of the next declaration.
           (progn (c-forward-syntactic-ws)
                  ;; Have we got stuck in a comment at EOB?
                  (not (and (eobp)



reply via email to

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