diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 2aa6b90dea3..34ba97bb87f 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)