GNU bug report logs -
#66911
CC Mode 5.35.2 (C++//l); Noise macro being taken as anchor to class-open
Previous Next
Reported by: Arsen Arsenović <arsen <at> aarsen.me>
Date: Fri, 3 Nov 2023 10:24:02 UTC
Severity: normal
Done: Alan Mackenzie <acm <at> muc.de>
Bug is archived. No further changes may be made.
Full log
Message #14 received at 66911 <at> debbugs.gnu.org (full text, mbox):
Hello, Arsen.
On Mon, Nov 06, 2023 at 12:38:36 +0100, Arsen Arsenović wrote:
> Hi Alan,
> Alan Mackenzie <acm <at> muc.de> writes:
> > On Fri, Nov 03, 2023 at 10:51:32 +0100, Arsen Arsenović via CC-Mode-help wrote:
> >> Package: cc-mode
[ .... ]
> > Would you please apply the patch, byte compile cc-engine.el (or all of
> > CC Mode), load it into your Emacs and try it out on your real C++ code.
> > The patch should apply cleanly to the Emacs master branch. Then please
> > confirm that it is actually fixes the bug, or tell me what's still not
> > working properly. (If you want any help applying the patch or compiling
> > the file, feel free to send me private email.)
> That indeed appears to have fixed it. I built emacs 30.0.50 from git
> (94807b6896191245ff3bef44a0ec21efb918232f) and applied your patch, then
> compared the analysis and indentation before and after on libstdc++es
> <bitset>, and it worked as expected (the noise macro stopped confusing
> it).
Thanks! Time to commit the patch, then.
> Though, the anchor still anchors on the template<> line rather than the
> struct line in:
> template<size_t _Nw>
> struct _Base_bitset
> {
> ... making it impossible (AFAICT) to create a style that implements:
> template<size_t _Nw>
> struct _Base_bitset
> {
> };
> struct foo
> {
> };
> instead, the former gets formatted as:
> template<size_t _Nw>
> struct _Base_bitset
> {
> };
> Is this intended?
Apologies. I missed this second point in your original bug report.
This should be fixable, but will be more work to fix than the other
point.
I think something like the following would do it: we could add a second
anchor point to topmost-intro-cont forms, that second point pointing at
struct. In languages without templates/generics, or in constructs
lacking template components, both anchor points would be the same.
So you could write an alignment function which would use that second
anchor point for class-open lines and the like. Or, just possibly, we
might be able to make that second point the default for class-open. This
should keep backward compatibility. I'll have to think about this.
And of course, the manual and test programs will need amending, too. ;-)
> >> Emacs : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.17.8)
> >> of 2023-09-24
> >> Package: CC Mode 5.35.2 (C++//l)
> >> Buffer Style: gnu
> >> c-emacs-features: (pps-extended-state col-0-paren posix-char-classes
> >> gen-string-delim gen-comment-delim syntax-properties category-properties
> >> 1-bit)
[ .... ]
> --
> Arsen Arsenović
--
Alan Mackenzie (Nuremberg, Germany).
This bug report was last modified 1 year and 175 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.