Subject: bug#62841: CC Mode 5.35.2 (Group); Template indentation problems

From: Michael Welsh Duggan <[email-masked]>
Date: Thu, 08 Jun 2023 13:39:41 -0400

Alan Mackenzie <[email-masked]> writes:

> Hello, Michael.
>
> On Sun, Apr 23, 2023 at 13:44:29 +0000, Alan Mackenzie wrote:
>> Thanks for the bug report.
>
>> On Fri, Apr 14, 2023 at 14:18:16 -0400, Michael Welsh Duggan wrote:
>> > Package: cc-mode
>
>> > Package: cc-mode
>
>> > Load the included file, bar.cpp:
>
>
>> > template <typename T>
>> > using value_variant=
>> >   std::pair<
>> >   std::variant<
>> >     ipfix::octetArray_t,
>> >     ipfix::unsigned8_t,
>> >     ipfix::unsigned16_t,
>> >     ipfix::unsigned32_t,
>> >     ipfix::unsigned64_t,
>> >     ipfix::signed8_t,
>> >     ipfix::signed16_t,
>> >     ipfix::signed32_t,
>> >     ipfix::signed64_t,
>> >     ipfix::float32_t,
>> >     ipfix::float64_t,
>> >     ipfix::boolean_t,
>> >     ipfix::macAddress_t,
>> >     ipfix::string_t,
>> >     ipfix::dateTimeSeconds_t,
>> >     ipfix::dateTimeMilliseconds_t,
>> >     ipfix::dateTimeMicroseconds_t,
>> >     ipfix::dateTimeNanoseconds_t,
>> >     ipfix::ipv4Address_t,
>> >     ipfix::ipv6Address_t,
>> >     std::pair<ipfix::InfoElementID,std::vector<T>>,
>> >     std::pair<ipfix::TemplateID,std::vector<std::vector<T>>>,
>> >     std::pair<std::vector<
>> >                 std::pair<
>> >                   ipfix::TemplateID,
>> >                   std::vector<std::vector<T>>>>>>,
>> >   ipfix::length_t>;
>
>
>> > For example:
>
>> > emacs -Q /tmp/bar.cpp
>
>> > Type:
>> > C-x h C-M-\
>
>> > First, note that std::variant is not indented with respect to std::pair.
>
> I have amended the indentation logic, by introducing a new line-up
> function, so this should be fixed, now.
>
>> There are actually two distinct bugs in play, here.  Up till now I've
>> been concentrating on the second one ....
>
>> > Next, delete and re-insert the final angle bracket on the line that
>> > reads:
>
>> >     std::pair<ipfix::InfoElementID,std::vector<T>>,
>
>> > Note the re-indention.
>
> This, together with the other indentation problems, I hope are fixed,
> too.
>
> [ .... ]
>
> Would you please test the enclosed patch, which should apply cleanly to
> the Emacs master branch.  And then let me know whether there are any
> problems with it.  Thanks!
>
> Just, there might be unfound interactions between the template markers
> and raw strings, but I hope not.
>
>> > Emacs  : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo =
>> > version 1.16.0)
>> >  of 2023-04-14
>> > Package: CC Mode 5.35.2 (C++//l)
>> > Buffer Style: gnu
>> > c-emacs-features: (pps-extended-state col-0-paren posix-char-classes gen-st=
>> > ring-delim gen-comment-delim syntax-properties category-properties 1-bit)

Sorry it took me so long to get around to testing this.  This is *much*
better.  I haven't run into any problems so far; you can be sure I will
report again if I do.  Thanks!

-- 
Michael Welsh Duggan
([email-masked])