[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour
From: |
Rolf Ade |
Subject: |
bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour |
Date: |
Wed, 29 Jun 2016 02:57:12 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
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.