]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #33416, where typing a ) in a comment at EOB caused a loop (CC Mode).
authorAlan Mackenzie <acm@muc.de>
Sat, 24 Nov 2018 10:31:53 +0000 (10:31 +0000)
committerAlan Mackenzie <acm@muc.de>
Sat, 24 Nov 2018 10:31:53 +0000 (10:31 +0000)
* lisp/progmodes/cc-mode.el (c-fl-decl-start): A c-forward-syntactic-ws leaves
point inside whitespace when moving over a comment at EOB which has no
terminating LF.  Check this possibility and correct for it.

lisp/progmodes/cc-mode.el

index 664f01012b89f894d0b530cd409f9b085342be60..424cde52474b4d6e2e2828c9564140a1270887cf 100644 (file)
@@ -1512,7 +1512,10 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".")
         (c-syntactic-skip-backward "^;{}" bod-lim t)
         (> (point) bod-lim)
         (progn (c-forward-syntactic-ws)
-               (setq bo-decl (point))
+               ;; Have we got stuck in a comment at EOB?
+               (not (and (eobp)
+                         (c-literal-start))))
+        (progn (setq bo-decl (point))
                (or (not (looking-at c-protection-key))
                    (c-forward-keyword-clause 1)))
         (progn