GNU bug report logs - #23818
25.0.95.3: c-beginning-of-defun misbehaviour

Previous Next

Packages: emacs, cc-mode;

Reported by: Rolf Ade <rolf <at> pointsman.de>

Date: Wed, 22 Jun 2016 00:20:02 UTC

Severity: normal

Found in version 25.0.95.3

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Rolf Ade <rolf <at> pointsman.de>
To: 23818 <at> debbugs.gnu.org
Subject: bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour
Date: Wed, 29 Jun 2016 02:57:12 +0200
Hello Alan,

sorry for replying late, was off road.

Am 06/24/2016 05:02 PM, Alan Mackenzie wrote:
> [...]
> There are two things here.  The first is that you must configure "DBG" as
> a "macro with a semicolon", as detailed in the CC Mode manual, page
> "Macros with ;".  For example, you could put the following into your
> c-mode-common-hook:
>
>      (setq c-macro-names-with-semicolon '("DBG"))
>      (c-make-macro-with-semi-re)
>
> [...]
> The second part of the fix is an actual bug where the software fails to
> check for "macros with semicolons" at a critical point.  For that, could
> you install the following patch, please, then byte-compile cc-engine.el:
>
>
>
> diff -r 4c8ccaedfd6a cc-engine.el
> --- a/cc-engine.el	Fri Jun 24 13:06:30 2016 +0000
> +++ b/cc-engine.el	Fri Jun 24 14:55:30 2016 +0000
> @@ -9135,7 +9135,8 @@
>   		(/= 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(")))
>

Did so. Patched, byte-compiled, evaluated the configuration in a emacs
-Q: Yes, this works now as expected. With the example file and with
the real case out of the wild
(http://core.tcl.tk/tdom/artifact/2cf83fbbaefad3ef?ln=3268-3362), from
which I stripped my reported example down. Much more pleasant, now.
Thanks.


I wasn't aware of chapter 12 "Customizing Macros" of the cc mode
manual, in some sense I obviously expected that to "just work".

Since I now have looked into chapter 12 of the manual I must say I
also naive expected that to 'just' work ...

Probably this should all work a completetly other way. As

emacs -Q
M-: (require 'cc-mode) RET
C-h v c-macro-names-with-semicolon RET

suggests. The last paragraph reads:

"Note that currently (2008-11-04) this variable is a prototype,
and is likely to disappear or change its form soon."

That docstring may need revisiting.




This bug report was last modified 7 years and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.