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: Tue, 14 May 2019 09:34:15 +0000 Message-ID: <20190514093415.GC4231__8338.95857665397$1557826549$gmane$org@ACM> References: <87ftqms9db.fsf@secretsauce.net> <871s15k7ll.fsf@gmail.com> <20190513195323.GB5525@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="245006"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: 35254@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue May 14 11:35:39 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 1hQTqV-0011XD-9g for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 May 2019 11:35:39 +0200 Original-Received: from localhost ([127.0.0.1]:44188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQTqU-0005Ct-8S for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 May 2019 05:35:38 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:40469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQTqH-0005Bj-K4 for bug-gnu-emacs@gnu.org; Tue, 14 May 2019 05:35:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQTqB-0004nU-Th for bug-gnu-emacs@gnu.org; Tue, 14 May 2019 05:35:21 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33795) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQTpu-0003st-Fc; Tue, 14 May 2019 05:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hQTpu-0004eF-3G; Tue, 14 May 2019 05:35: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: Tue, 14 May 2019 09:35: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.155782646017792 (code B ref 35254); Tue, 14 May 2019 09:35:02 +0000 Original-Received: (at 35254) by debbugs.gnu.org; 14 May 2019 09:34:20 +0000 Original-Received: from localhost ([127.0.0.1]:47339 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQTpE-0004cu-Da for submit@debbugs.gnu.org; Tue, 14 May 2019 05:34:20 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:37263 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1hQTpC-0004cj-S8 for 35254@debbugs.gnu.org; Tue, 14 May 2019 05:34:19 -0400 Original-Received: (qmail 9374 invoked by uid 3782); 14 May 2019 09:34:16 -0000 Original-Received: from acm.muc.de (p4FE15CA2.dip0.t-ipconnect.de [79.225.92.162]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 14 May 2019 11:34:15 +0200 Original-Received: (qmail 9587 invoked by uid 1000); 14 May 2019 09:34:15 -0000 Content-Disposition: inline In-Reply-To: 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:159264 Archived-At: Hello, Stefan. On Mon, May 13, 2019 at 19:32:49 -0400, Stefan Monnier wrote: > >> Electric indent mode's post-self-insert hook entry has 3 effects: > >> 1. Indent the previous line. > >> 2. Remove trailing whitespace from the previous line. > >> 3. Indent the current line (when at beginning of line). > Note that `newline` itself already does some subset of 2 (before running > electric-indent's post-self-insert hook). Speaking of `newline', there's a strange regexp around this part: ;; If the newline leaves the previous line blank, and we ;; have a left margin, delete that from the blank line. (save-excursion (goto-char beforepos) (beginning-of-line) (and (looking-at "[ \t]$") <========================= (> (current-left-margin) 0) (delete-region (point) (line-end-position)))) It's trying to match a single WS character. Shouldn't this, perhaps, be "[ \t]+$"? [ .... ] > Stefan -- Alan Mackenzie (Nuremberg, Germany).