From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#35254: 27.0.50; cc-mode/electric-pair-mode/electric-layout-mode: bad trailing whitespace behavior in cc-mode Date: Sun, 12 May 2019 15:12:37 +0000 Message-ID: <20190512151237.GB20053@ACM> References: <87ftqms9db.fsf@secretsauce.net> <871s15k7ll.fsf@gmail.com> <20190511120524.GA15991@ACM> <87sgtlhyq5.fsf@gmail.com> <20190511161903.GB15991@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="220767"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Dima Kogan , 35254@debbugs.gnu.org, =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 12 17:13:13 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.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hPqA4-000vJX-Jz for geb-bug-gnu-emacs@m.gmane.org; Sun, 12 May 2019 17:13:12 +0200 Original-Received: from localhost ([127.0.0.1]:44172 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPqA3-00046R-Jb for geb-bug-gnu-emacs@m.gmane.org; Sun, 12 May 2019 11:13:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:37976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPq9x-00046M-DG for bug-gnu-emacs@gnu.org; Sun, 12 May 2019 11:13:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hPq9v-0007qt-I7 for bug-gnu-emacs@gnu.org; Sun, 12 May 2019 11:13:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57757) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hPq9u-0007ps-HT; Sun, 12 May 2019 11:13:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hPq9u-0003nz-89; Sun, 12 May 2019 11:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sun, 12 May 2019 15:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35254 X-GNU-PR-Package: emacs,cc-mode Original-Received: via spool by 35254-submit@debbugs.gnu.org id=B35254.155767396814606 (code B ref 35254); Sun, 12 May 2019 15:13:02 +0000 Original-Received: (at 35254) by debbugs.gnu.org; 12 May 2019 15:12:48 +0000 Original-Received: from localhost ([127.0.0.1]:43068 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hPq9f-0003nV-Ma for submit@debbugs.gnu.org; Sun, 12 May 2019 11:12:47 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:46593 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1hPq9d-0003nK-Ho for 35254@debbugs.gnu.org; Sun, 12 May 2019 11:12:46 -0400 Original-Received: (qmail 62633 invoked by uid 3782); 12 May 2019 15:12:42 -0000 Original-Received: from acm.muc.de (p2E5D50C3.dip0.t-ipconnect.de [46.93.80.195]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 12 May 2019 17:12:41 +0200 Original-Received: (qmail 20309 invoked by uid 1000); 12 May 2019 15:12:37 -0000 Content-Disposition: inline In-Reply-To: <20190511161903.GB15991@ACM> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de 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:159134 Archived-At: Hello again, Noam. On Sat, May 11, 2019 at 16:19:03 +0000, Alan Mackenzie wrote: > On Sat, May 11, 2019 at 10:06:42 -0400, Noam Postavsky wrote: > > Alan Mackenzie writes: [ .... ] > > So we should have an electric-delete-trailing-whitespace-mode? > NO, NO, NO, NO, NO, NO, NO!!!! First of all, apologies for being so unecessarily emphatic, yesterday. > Again, the cause of the current problem is that the deletion of the > trailing WS has got mixed up with electric stuff. General confusion. > Trailing WS deletion has got NOTHING to do with electric indentation. It > was part of `newline-and-indent' long before anybody started trying to > apply CC Mode's electric stuff to other modes. It should be part of > `newline' now, not part of electric-indent-post-self-insert-function. I think I now understand what's going on. I was wrong in the previous paragraph. The connection between WS deletion and newline-and-indent/electric indentation is that when n-a-i/e-i is in play, Emacs assumes that the trailing WS on a line was put there by a previous use of n-a-i/e-i, therefore it's the Right Thing to remove it. Otherwise (newline, no electric indentation) the trailing WS stays. The chaotic tangling of newline and electric indentation remains. I still think the best way to fix this bug (and the only way to fix its cause) is to separate out the two functionalities. If they hadn't been tangled in the first place, the current bug couldn't have happened. Back in Emacs 24.3 (or whenever it was), newline and newline-and-indent were perfectly adequate for the job. They still are, IMAO. I propose that newline be restored to its former functionality (i.e. with no indentation of the new line) and be bound to C-j; that newline-and-indent become the standard binding for ; that indentation of a new line no longer be done by electric indentation, since this is not needed; that the grossly misnamed, and now redundant electric-indent-just-newline and the command of dubious utility electric-newline-and-maybe-indent both be made obsolete. The above amendments will leave the behaviour of Emacs unchanged for the normal user. They will cause mild incompatibilities, the inverse of those which were caused in 24.4 (or whenever), when the current setup was set up. Then bugs like the current one will no longer happen in the future. Clearly this would need to be discussed and settled in emacs-devel, first. What do you say? [ .... ] -- Alan Mackenzie (Nuremberg, Germany).