bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23775: bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour


From: Alan Mackenzie
Subject: bug#23775: bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour
Date: Wed, 29 Jun 2016 20:26:22 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

Hello, Rolf.

On Wed, Jun 29, 2016 at 01:22:27AM +0200, Rolf Ade wrote:

> Hello Alan,

> sorry for replying late, was off road.

No problems.

> 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.

Thank you.

> 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.

Whoops!  It needed revisiting 7½ years ago, but better late than never!

I've committed the changes, to the CC Mode repository, the Emacs master
branch and the XEmacs package repository.  I'm going to close the bug.

-- 
Alan Mackenzie (Nuremberg, Germany).





reply via email to

[Prev in Thread] Current Thread [Next in Thread]