]> code.delx.au - gnu-emacs/commitdiff
Fix C-M-a in a C function finding the start of a macro preceding it.
authorAlan Mackenzie <acm@muc.de>
Wed, 29 Jun 2016 20:17:39 +0000 (20:17 +0000)
committerAlan Mackenzie <acm@muc.de>
Wed, 29 Jun 2016 20:17:39 +0000 (20:17 +0000)
Also amend some pertinent documentation.  This fixes bug #23818.

* lisp/progmodes/cc-engine.el (c-beginning-of-decl-1): Also check for a
virtual semicolon at a place where we check for other types of statement ends.

* lisp/progmodes/cc-vars.el (c-macro-nacmes-with-semicolon): Remove from the
doc string the bit saying that the variable is a prototype and liable to
change.

* doc/misc/cc-mode.texi (Macros with ;): Enhance, stating that configuring
macros with semicolon can prevent C-M-a missing the beginning of defun.

doc/misc/cc-mode.texi
lisp/progmodes/cc-engine.el
lisp/progmodes/cc-vars.el

index 82f8cbc2e33d859e9394d8cff98f34270ad67bd9..f311ec8a3a57edca82f400f65273c69207d42738 100644 (file)
@@ -6727,9 +6727,11 @@ Macros which needn't (or mustn't) be followed by a semicolon when you
 invoke them, @dfn{macros with semicolons}, are very common.  These can
 cause @ccmode{} to parse the next line wrongly as a
 @code{statement-cont} (@pxref{Function Symbols}) and thus mis-indent
-it.
+it.  At the top level, a macro invocation before a defun start can
+cause, for example, @code{c-beginning-of-defun} (@kbd{C-M-a}) not to
+find the correct start of the current function.
 
-You can prevent this by specifying which macros have semicolons.  It
+You can prevent these by specifying which macros have semicolons.  It
 doesn't matter whether or not such a macro has a parameter list:
 
 @defopt c-macro-names-with-semicolon
index 4bc4056081b0cc60fff271a4146df33eee095edf..75f07e334d26f66538ecfe865f6870a69aecba1f 100644 (file)
@@ -9298,7 +9298,8 @@ comment at the start of cc-engine.el for more info."
                (/= last-stmt-start (point))
                (progn
                  (c-backward-syntactic-ws lim)
-                 (not (memq (char-before) '(?\; ?} ?: nil))))
+                 (not (or (memq (char-before) '(?\; ?} ?: nil))
+                          (c-at-vsemi-p))))
                (save-excursion
                  (backward-char)
                  (not (looking-at "\\s(")))
index f03aec2804b65ebf2a3c0a514368094160eba886..7a6f4baaa73c95543ff76c3dced70520523f905c 100644 (file)
@@ -1702,10 +1702,7 @@ the regular expression must match only valid identifiers.
 
 If you change this variable's value, call the function
 `c-make-macros-with-semi-re' to set the necessary internal
-variables.
-
-Note that currently \(2008-11-04) this variable is a prototype,
-and is likely to disappear or change its form soon.")
+variables.")
 (make-variable-buffer-local 'c-macro-names-with-semicolon)
 (put 'c-macro-names-with-semicolon 'safe-local-variable
      #'c-string-or-string-list-p)