GNU bug report logs - #62841
CC Mode 5.35.2 (Group); Template indentation problems

Previous Next

Package: cc-mode;

Reported by: Michael Welsh Duggan <mwd <at> md5i.com>

Date: Fri, 14 Apr 2023 18:19:01 UTC

Severity: normal

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: Alan Mackenzie <acm <at> muc.de>
To: Michael Welsh Duggan <mwd <at> md5i.com>
Cc: acm <at> muc.de, 62841 <at> debbugs.gnu.org
Subject: bug#62841: CC Mode 5.35.2 (Group); Template indentation problems
Date: Sun, 23 Apr 2023 13:44:29 +0000
Hello, Michael.

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.

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.

[ .... ]

> Then, try C-x h C-M-\ again.  Note another reindentation.

[ .... ]


> Type C-x h C-M-\ again.  Another re-indentation.  This
> one is stable, but incorrect.

[ .... ]

At the base of these errors is a failure to apply the syntax-table text
properties consistently to the <s and >s.  I'm quite some way through
fixing this, but it will be a few days yet before I'll have a working
fix.

Just as a matter of interest, the sort of thing which I'm looking at is
things like an open string such as:

        "            std::vector<std::vector<T>>>>>>,

, which then gets terminated, such as:

        "    "        std::vector<std::vector<T>>>>>>,

..  The angle brackets which were in a string no longer are, so need to
have the properties applied to them and their partners.  But this is
some way distant from the buffer change region.

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

[ .... ]

> -- 
> Michael Welsh Duggan
> (md5i <at> md5i.com)

-- 
Alan Mackenzie (Nuremberg, Germany).




This bug report was last modified 2 years and 22 days ago.

Previous Next


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