From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#14008: Better autoindent for C++11 code? Date: Sun, 13 Oct 2019 10:03:00 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="203983"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Alan Mackenzie , 14008@debbugs.gnu.org To: Andrew Pennebaker Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 13 10:05:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iJYsM-000qvE-G0 for geb-bug-gnu-emacs@m.gmane.org; Sun, 13 Oct 2019 10:05:14 +0200 Original-Received: from localhost ([::1]:38250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJYsL-0007Jr-1M for geb-bug-gnu-emacs@m.gmane.org; Sun, 13 Oct 2019 04:05:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48811) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJYsB-0007Af-5q for bug-gnu-emacs@gnu.org; Sun, 13 Oct 2019 04:05:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iJYsA-00007d-58 for bug-gnu-emacs@gnu.org; Sun, 13 Oct 2019 04:05:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54291) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iJYsA-00007U-1w; Sun, 13 Oct 2019 04:05:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iJYs9-0003hx-Q4; Sun, 13 Oct 2019 04:05:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sun, 13 Oct 2019 08:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14008 X-GNU-PR-Package: emacs,cc-mode Original-Received: via spool by 14008-submit@debbugs.gnu.org id=B14008.157095385414177 (code B ref 14008); Sun, 13 Oct 2019 08:05:01 +0000 Original-Received: (at 14008) by debbugs.gnu.org; 13 Oct 2019 08:04:14 +0000 Original-Received: from localhost ([127.0.0.1]:34879 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iJYrO-0003gb-4k for submit@debbugs.gnu.org; Sun, 13 Oct 2019 04:04:14 -0400 Original-Received: from mail-pf1-f176.google.com ([209.85.210.176]:45468) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iJYrM-0003gM-D7 for 14008@debbugs.gnu.org; Sun, 13 Oct 2019 04:04:13 -0400 Original-Received: by mail-pf1-f176.google.com with SMTP id y72so8585335pfb.12 for <14008@debbugs.gnu.org>; Sun, 13 Oct 2019 01:04:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=iWnOwYb2TUn0U03O1PLxL+1o4QT89GXmLaz6+5gZVMM=; b=dHwXdtNdCk6ZzQojnS45/NWmr1E6wKdK4AV1xMeqt4v2Mog5yjpOr5YC0EOSvmHD+Y KcfjXb60/uOMqBaz2S8K6Eym/1zK7CBowgyAFU5ic9WFWJ8HNoKAXoGFyXTfYfm5hlmG mnz95uoZGLcoPnoBrJ13xpx2Xp3aRZaNr4oZpYkn5+Ths0ikMdqtLt5j2DCj6F/tVNJm 92KbGtKOv5E0Xb1JLJfAb0ihPJlsw+3AekIXna9hOfZgsYh1KqzXGSVlxnmCY4Wz29Uy aLHFF1WxVP1I34P0Qopjbwvnht4BR+oGoU+TVN3cJghmDLrYfNyUUHEu1cCeLb/6VbvS mneA== X-Gm-Message-State: APjAAAVe7WUSepyQQg0711qbar2a0ytHVJCE6ooc59hjwTT15SElFw9s jPySjvziHfC5yAW12ks7gBA++X9m3M6o28EGeLU= X-Google-Smtp-Source: APXvYqwET+62rz5KTKfcoKeK+nTsWscbTzn8IXI0EQ9aE5/kbKSDV9Huh2tWPjeh0zUjplFWbMb9og6f9FIYnvDW0nw= X-Received: by 2002:a63:1c03:: with SMTP id c3mr25737735pgc.198.1570953846562; Sun, 13 Oct 2019 01:04:06 -0700 (PDT) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:169106 Archived-At: Andrew Pennebaker writes: > C++11 introduced lambda syntax []() { ... } and other strange things that Emacs indents strangely. > > for_each(range.begin(), range.end(), [=](int i) { > cout << strings[i] << endl; > }); > > I would like the final line `});` to have the same indentation level as the first line `for_each...`. I'm seeing the same thing here. With "emacs -Q" on current master, this indents like: for_each(range.begin(), range.end(), [=](int i) { cout << strings[i] << endl; }); However, note that I have only one space before the final "}" character, whereas the reporter had two. I'm not sure if this behaviour is intentional or not, or if it could be configured. > Here's another example: > > for_each(range.begin(), range.end(), [&](int i) { > std::async( > launch::async, > [&]() { strings[i] = fizzy(i); } > ); > }); > > The arguments to std::async and its closing parenthesis are indented much too far; I would like them indented only one level further than where std::async is itself indented. Any tips for achieving this? I'm seeing something similar here: for_each(range.begin(), range.end(), [&](int i) { std::async( launch::async, [&]() { strings[i] = fizzy(i); } ); }); Perhaps Alan could clarify if this is a bug or if this is just a case of missing configuration? Best regards, Stefan Kangas