From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Konstantin Kharlamov Newsgroups: gmane.emacs.bugs Subject: bug#29959: cc-mode: wrong indentation in absence of semicolon Date: Thu, 18 Jan 2018 22:19:35 +0300 Message-ID: References: <8a042ba1-301c-8943-1381-537cba8a2334@yandex.ru> <20180113203752.GA9688@ACM> <20180118184137.GB21934@ACM> <7dc2d599-f391-2b0c-2509-ea45a5cf74d4@yandex.ru> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1516303127 7225 195.159.176.226 (18 Jan 2018 19:18:47 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 18 Jan 2018 19:18:47 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 Cc: 29959@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 18 20:18:42 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ecFhc-0000ST-LL for geb-bug-gnu-emacs@m.gmane.org; Thu, 18 Jan 2018 20:18:20 +0100 Original-Received: from localhost ([::1]:49430 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecFjc-0006MO-Ig for geb-bug-gnu-emacs@m.gmane.org; Thu, 18 Jan 2018 14:20:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecFjQ-0006Kr-TW for bug-gnu-emacs@gnu.org; Thu, 18 Jan 2018 14:20:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecFjK-0000K6-DN for bug-gnu-emacs@gnu.org; Thu, 18 Jan 2018 14:20:12 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54025) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecFjG-0000JB-Ls; Thu, 18 Jan 2018 14:20:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ecFjG-0000mP-7M; Thu, 18 Jan 2018 14:20:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Konstantin Kharlamov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Thu, 18 Jan 2018 19:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29959 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 29959-submit@debbugs.gnu.org id=B29959.15163031862972 (code B ref 29959); Thu, 18 Jan 2018 19:20:02 +0000 Original-Received: (at 29959) by debbugs.gnu.org; 18 Jan 2018 19:19:46 +0000 Original-Received: from localhost ([127.0.0.1]:33689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ecFj0-0000lr-6U for submit@debbugs.gnu.org; Thu, 18 Jan 2018 14:19:46 -0500 Original-Received: from forward100o.mail.yandex.net ([37.140.190.180]:51728) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ecFix-0000lb-W8 for 29959@debbugs.gnu.org; Thu, 18 Jan 2018 14:19:44 -0500 Original-Received: from mxback15j.mail.yandex.net (mxback15j.mail.yandex.net [IPv6:2a02:6b8:0:1619::91]) by forward100o.mail.yandex.net (Yandex) with ESMTP id F1E9C2A23B2D; Thu, 18 Jan 2018 22:19:37 +0300 (MSK) Original-Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback15j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Ws3rKxmbsi-JbY4ankG; Thu, 18 Jan 2018 22:19:37 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1516303177; bh=xANo6AGREIWUu+Z0ELE3XblngvVYfljXeWO6jqVzICc=; h=Subject:From:To:Cc:References:Message-ID:Date:In-Reply-To; b=EVQZxsM/S8wh7ocPgdV+Ga8WR/CfCm8/a4mRvClwVpYZ9lA3hVbnxwMyGC/6ATR4V 5VEWP1n5soFnHhzgpoXeFDXObbBKKDKpig5ZeJAuU9ezTXZXKqJXz5npFMW0jDFEEa Ju7xjiXZGKGyfgCjTxhic6WzWxDuL4DJ3RQT/Zl4= Original-Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id rZlizH8sP6-JbV8ZtoG; Thu, 18 Jan 2018 22:19:37 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1516303177; bh=xANo6AGREIWUu+Z0ELE3XblngvVYfljXeWO6jqVzICc=; h=Subject:From:To:Cc:References:Message-ID:Date:In-Reply-To; b=EVQZxsM/S8wh7ocPgdV+Ga8WR/CfCm8/a4mRvClwVpYZ9lA3hVbnxwMyGC/6ATR4V 5VEWP1n5soFnHhzgpoXeFDXObbBKKDKpig5ZeJAuU9ezTXZXKqJXz5npFMW0jDFEEa Ju7xjiXZGKGyfgCjTxhic6WzWxDuL4DJ3RQT/Zl4= Authentication-Results: smtp2o.mail.yandex.net; dkim=pass header.i=@yandex.ru In-Reply-To: <7dc2d599-f391-2b0c-2509-ea45a5cf74d4@yandex.ru> Content-Language: en-US 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: 208.118.235.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:142267 Archived-At: Sorry, I mean, not cool that it doesn't work, but cool there's a workaround. On side note — though I am not experienced in elisp — I think it'd be nice to add a comment in the removed code that it's looking for C99 compound literals. Otherwise I personally struggle to understand what's being looked up there. In fact, whole file doesn't mention sentence "C99 compound literals" anywhere. On 18.01.2018 22:08, Konstantin Kharlamov wrote: > Cool, thanks, I applied it locally, works for me! > > On 18.01.2018 21:41, Alan Mackenzie wrote: >> Hello again, Konstantin. >> >> On Sat, Jan 13, 2018 at 20:37:52 +0000, Alan Mackenzie wrote: >>> On Sat, Jan 13, 2018 at 14:11:31 +0300, Konstantin Kharlamov wrote: >>>> Just tested with current git, the problem is still present. >> >>>> I am almost sure this is a regression, I don't remember having that >>>> problem before. The real-world consequences are just too annoying >>>> for it >>>> to go unnoticed — basically, every time I'm typing variables >>>> indentation >>>> just doesn't work. And I also seem to remember a few irrelevant >>>> situations where I was typing conditions with the like results. >> >>> The problem originates in a new feature, C99 compound literals, which >>> was >>> committed on 2017-11-10.  This detects brace blocks (meaning something >>> like the initialisation of a struct) in the middle of executable code, >>> but it is clear the test for such a brace block isn't rigorous enough, >>> since even function blocks are being mistaken for them. >> >> The new feature, C99 compound literals, has been removed from the >> emacs-26 branch, so as to avoid delaying the relase process for that >> branch.  The commit has hash 36edb6cb97ce3d53543c87643077d270bb5bdfd1, >> and it should apply without problems to the master branch. >> >> It is to be hoped that a more elaborate and more correct solution will >> be found soon for the master branch. >> >>>> On 03.01.2018 09:02, Konstantin Kharlamov wrote: >>>>> # Steps to reproduce: >>>>> 1. Open emacs -Q test.c >>>>> 2. Write the following: >> >>>>> int main() { >>>>>       int a, >>>>> } >> >>>>> 3. put the caret after the comma symbol, and press enter, e.g. to >>>>> continue writing variables on the new line. >> >>>>> # Expected: >>>>> the new line alignment stands out with regard to the prev. line. >> >>>>> # Actual: >>>>> the new line aligned to the beginning of the prev. line. >> >>>>> # Workarounds: >>>>> Typing the following text: >> >>>>> int main() { >>>>>       int a,; >>>>> } >> >>>>> …then pressing enter right after the comma works as expected. >> >>>>> ------------ >> >>>>> In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version >>>>> 3.22.26) >>>>>    of 2017-12-15 built on constantine-N61Ja >>>>> Repository revision: 6c301afa70f6eac32ad1ce92412ea3cf6fcdeeca >>>>> Windowing system distributor 'The X.Org Foundation', version >>>>> 11.0.11906000 >>>>> System Description: Arch Linux >> >>> [ .... ] >>