From: Tadeus Prastowo <tadeus.prastowo@unitn.it>
To: Alan Mackenzie <acm@muc.de>
Cc: John Wiegley <jwiegley@gmail.com>, 28623@debbugs.gnu.org
Subject: bug#28623: 27.0.50; lisp/progmodes/cc-engine.el incorrect indentation of C++14 curly-brace initializer list
Date: Thu, 9 Nov 2017 10:27:55 +0100 [thread overview]
Message-ID: <CAN-HRFaUsoop86RuZzg6h8hiLrs8c2bK1ao_FMLi2Eg6=4kC2Q@mail.gmail.com> (raw)
In-Reply-To: <20171108192358.GA4582@ACM>
On Wed, Nov 8, 2017 at 8:23 PM, Alan Mackenzie <acm@muc.de> wrote:
[...]
> OK. The essential characteristic of your new file is:
>
> ({ {..}, ..., {...}}, { {..} .....
> ^
> l L
>
> With the critical point marked, c-inside-bracelist-p had calculated a
> backward search limit at position L, which was insufficient for it to
> determine its brace list characteristic.
>
> I've corrected c-inside-bracelist-p such that it now uses position l as
> this limit. I've also taken the opportunity to simplify it quite a bit.
> This now appears to work.
>
> So, thank you for taking the time to test this, and finding this further
> bug.
My pleasure. And thank you very much for looking into this last
problem as well.
> Could I ask you, please, to try the amended patch which I include
> below. This should, again, apply cleanly to the emacs-26 branch, or
> master. It is a patch "from scratch"; it is not an incremental patch on
> top of the last one.
Cool! Your new patch produces the following now:
int main() {
/* Indentation produced by your new patch */
fn({
{1, 2, 3},
{3, 4, 5},
{6, 7, 8},
}, {
{1, 3},
{4, 5},
{7, 8},
});
for (const auto &v : fn({
{3, 4, 5},
{6, 7, 8},
{9, 10, 11},
}, {
{1, 3},
{4, 5},
{7, 8},
})) {
for (const auto &a : v) {
std::cout << a << '\n';
}
}
/* End: Indentation produced by your new patch */
}
So, you solved the problem :)
>> Additionally, I would argue that compared to the one produced by my
>> patch demonstrated above, the following indentation would be even
>> better:
>> for (const auto &v : fn({
>> {3, 4, 5},
>> {6, 7, 8},
>> {9, 10, 11},
>> }, {
>> {1, 3},
>> {4, 5},
>> {7, 8},
>> })) {
>> for (const auto &a : v) {
>> std::cout << a << '\n';
>> }
>> }
>> Please let me know what you think about that.
>
> I think I would agree with you. This is probably fixable by configuring
> the CC Mode indentation engine, possibly by writing a Line-up function,
> but I can't say for sure without looking at it more closely.
I will have a look at it this weekend.
>> > If you have nothing against it, I intend to put your test file (or bits
>> > of it) into a new file in the CC Mode test suite.
>
>> Yes, that is okay.
>
> Thanks, I'll do that.
You are welcome.
And, just out of curiosity, in cc-engine, there is a long function
with many inline comments in the form of CASE xxx. Why aren't those
refactored into individual functions? Performance issue?
> --
> Alan Mackenzie (Nuremberg, Germany).
--
Best regards,
Tadeus
next prev parent reply other threads:[~2017-11-09 9:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-27 17:49 bug#28623: 27.0.50; lisp/progmodes/cc-engine.el incorrect indentation of C++14 curly-brace initializer list Tadeus Prastowo
2017-09-27 19:31 ` John Wiegley
2017-10-04 18:15 ` Alan Mackenzie
2017-10-06 2:59 ` Tadeus Prastowo
2017-10-11 20:32 ` Alan Mackenzie
2017-10-12 11:38 ` Tadeus Prastowo
2017-11-04 19:56 ` Alan Mackenzie
2017-11-06 22:46 ` Tadeus Prastowo
2017-11-08 19:23 ` Alan Mackenzie
[not found] ` <20171108192358.GA4582@ACM>
2017-11-09 9:27 ` Tadeus Prastowo [this message]
2017-11-09 18:53 ` Alan Mackenzie
[not found] ` <20171109185354.GA15085@ACM>
2017-11-10 12:07 ` Tadeus Prastowo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAN-HRFaUsoop86RuZzg6h8hiLrs8c2bK1ao_FMLi2Eg6=4kC2Q@mail.gmail.com' \
--to=tadeus.prastowo@unitn.it \
--cc=28623@debbugs.gnu.org \
--cc=acm@muc.de \
--cc=jwiegley@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.