bug#62386: CC Mode 5.35.2 (C++//l); C++ concept indentation

Alan Mackenzie <[email protected]> Fri, 14 Apr 2023 11:14:39 +0000
Newsgroups gmane.emacs.cc-mode.general
Message-ID <ZDk1n1GyyV7IsL+K@ACM>
Hello, Michael.

Sorry for the delay, it's been a bit of a rough week, here.

On Fri, Apr 07, 2023 at 12:00:13 -0400, Michael Welsh Duggan wrote:
> Alan Mackenzie <[email protected]> writes:

[ .... ]

> Much, much better!

Thanks for the testing.

> I have only one niggling nit left, and this one doesn't bother me
> nearly as much as the others.  The nit is that opening parentheses
> don't seem to open up a new indention context anymore.  (That's my
> internal mental terminology, not necessary what it used by cc-mode.)

> Before:

>   template <typename T>
>   requires (OctetLike<T>
>             || (std::rank_v<T> == 1 && std::extent_v<T> == 0
>                 && OctetLike<std::remove_extent_t<T>>))
>   Chunk(std::shared_ptr<T> const & p, length_t size)
>   : data_{p, octet_cast(p.get())},
>     size_{size}
>   {}


> After:

>   template <typename T>
>   requires (OctetLike<T>
>     || (std::rank_v<T> == 1 && std::extent_v<T> == 0
>     && OctetLike<std::remove_extent_t<T>>))
>   Chunk(std::shared_ptr<T> const & p, length_t size)
>     : data_{p, octet_cast(p.get())},
>       size_{size}
>   {}

This is a difficult one.  Aligning the || under OctetLike causes problems
when the parenthesis is already far to the right, for example if requires
is on the same line as template.  Then everything will be indented too
far to the right.  This dilemma has come up at least twice before.

I think what's worse is the lack of further indentation of the && line.
I don't know what to do about that, at the moment.

I'm also a little bit worried about the "virtual semicolon" detection on
some more complicated requires constructs.

Anyhow, I think I'll commit what I've got, and leave these doubts to be
cleared up later.

> -- 
> Michael Welsh Duggan
> ([email protected])

-- 
Alan Mackenzie (Nuremberg, Germany).