aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2016-06-29 20:17:39 +0000
committerAlan Mackenzie2016-06-29 20:17:39 +0000
commit681d3f1f582d9b549f41ef1eacff42abb98f878d (patch)
treee67927c1fd6a97f2d7e245fe6097049c916c2fa4
parent4a2a1eba09e5bbc37b853733708feae17f1425f5 (diff)
downloademacs-681d3f1f582d9b549f41ef1eacff42abb98f878d.tar.gz
emacs-681d3f1f582d9b549f41ef1eacff42abb98f878d.zip
Fix C-M-a in a C function finding the start of a macro preceding it.
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.
-rw-r--r--doc/misc/cc-mode.texi6
-rw-r--r--lisp/progmodes/cc-engine.el3
-rw-r--r--lisp/progmodes/cc-vars.el5
3 files changed, 7 insertions, 7 deletions
diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi
index 82f8cbc2e33..f311ec8a3a5 100644
--- a/doc/misc/cc-mode.texi
+++ b/doc/misc/cc-mode.texi
@@ -6727,9 +6727,11 @@ Macros which needn't (or mustn't) be followed by a semicolon when you
6727invoke them, @dfn{macros with semicolons}, are very common. These can 6727invoke them, @dfn{macros with semicolons}, are very common. These can
6728cause @ccmode{} to parse the next line wrongly as a 6728cause @ccmode{} to parse the next line wrongly as a
6729@code{statement-cont} (@pxref{Function Symbols}) and thus mis-indent 6729@code{statement-cont} (@pxref{Function Symbols}) and thus mis-indent
6730it. 6730it. At the top level, a macro invocation before a defun start can
6731cause, for example, @code{c-beginning-of-defun} (@kbd{C-M-a}) not to
6732find the correct start of the current function.
6731 6733
6732You can prevent this by specifying which macros have semicolons. It 6734You can prevent these by specifying which macros have semicolons. It
6733doesn't matter whether or not such a macro has a parameter list: 6735doesn't matter whether or not such a macro has a parameter list:
6734 6736
6735@defopt c-macro-names-with-semicolon 6737@defopt c-macro-names-with-semicolon
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 4bc4056081b..75f07e334d2 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -9298,7 +9298,8 @@ comment at the start of cc-engine.el for more info."
9298 (/= last-stmt-start (point)) 9298 (/= last-stmt-start (point))
9299 (progn 9299 (progn
9300 (c-backward-syntactic-ws lim) 9300 (c-backward-syntactic-ws lim)
9301 (not (memq (char-before) '(?\; ?} ?: nil)))) 9301 (not (or (memq (char-before) '(?\; ?} ?: nil))
9302 (c-at-vsemi-p))))
9302 (save-excursion 9303 (save-excursion
9303 (backward-char) 9304 (backward-char)
9304 (not (looking-at "\\s("))) 9305 (not (looking-at "\\s(")))
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el
index f03aec2804b..7a6f4baaa73 100644
--- a/lisp/progmodes/cc-vars.el
+++ b/lisp/progmodes/cc-vars.el
@@ -1702,10 +1702,7 @@ the regular expression must match only valid identifiers.
1702 1702
1703If you change this variable's value, call the function 1703If you change this variable's value, call the function
1704`c-make-macros-with-semi-re' to set the necessary internal 1704`c-make-macros-with-semi-re' to set the necessary internal
1705variables. 1705variables.")
1706
1707Note that currently \(2008-11-04) this variable is a prototype,
1708and is likely to disappear or change its form soon.")
1709(make-variable-buffer-local 'c-macro-names-with-semicolon) 1706(make-variable-buffer-local 'c-macro-names-with-semicolon)
1710(put 'c-macro-names-with-semicolon 'safe-local-variable 1707(put 'c-macro-names-with-semicolon 'safe-local-variable
1711 #'c-string-or-string-list-p) 1708 #'c-string-or-string-list-p)