From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= 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: Wed, 15 May 2019 12:27:52 +0100 Message-ID: References: <87ftqms9db.fsf@secretsauce.net> <871s15k7ll.fsf@gmail.com> <20190513195323.GB5525@ACM> <20190514092735.GB4231@ACM> <20190515100339.GB15042@ACM> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000056f23f0588eb7102" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="90605"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Noam Postavsky , Dima Kogan , 35254@debbugs.gnu.org, Stefan Monnier To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 15 13:29:20 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 1hQs63-000NPI-L0 for geb-bug-gnu-emacs@m.gmane.org; Wed, 15 May 2019 13:29:19 +0200 Original-Received: from localhost ([127.0.0.1]:35461 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQs62-0007AT-J7 for geb-bug-gnu-emacs@m.gmane.org; Wed, 15 May 2019 07:29:18 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:49855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQs5o-00078S-5o for bug-gnu-emacs@gnu.org; Wed, 15 May 2019 07:29:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQs5m-0000h7-9W for bug-gnu-emacs@gnu.org; Wed, 15 May 2019 07:29:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37721) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQs5m-0000gm-4k; Wed, 15 May 2019 07:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hQs5l-00082t-PQ; Wed, 15 May 2019 07:29:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Wed, 15 May 2019 11:29:01 +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.155791969330874 (code B ref 35254); Wed, 15 May 2019 11:29:01 +0000 Original-Received: (at 35254) by debbugs.gnu.org; 15 May 2019 11:28:13 +0000 Original-Received: from localhost ([127.0.0.1]:51265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQs4y-00081t-KE for submit@debbugs.gnu.org; Wed, 15 May 2019 07:28:13 -0400 Original-Received: from mail-io1-f68.google.com ([209.85.166.68]:43747) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQs4w-00081f-EO for 35254@debbugs.gnu.org; Wed, 15 May 2019 07:28:11 -0400 Original-Received: by mail-io1-f68.google.com with SMTP id v7so1891113iob.10 for <35254@debbugs.gnu.org>; Wed, 15 May 2019 04:28:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Jozn33D2ODCLuu9isCf2CBfv+ElAsyYrOcsH6zOU6t4=; b=Y0ebWWCrpD8y/7u30woAd1wmzSYZnPR8MYSMamB6+xT5SYv5ajz3x3P+RaG6jdWlP3 zsiNSzrDrlA8UId1QYm/eTghptLCN560pu/ywAG7/MILh7h7XDz0RpDycFdZC28L+ZAY IVJm2P6nWLwlnsVwdYj9LeBuvaT52zwYYD5EpL6ntbtIVMiga1dxfcZN2cpFzxGENoJQ FOkrByz69l8MRXz/ay7aDvR+6OOnx3oQ2DWc1Ag0NrCLem+YrP/e8/3D5oz8IYzQ96q2 E4B9IRZKLaaAAkAdD77klP9N0fzy42OZUxYnrui3srbknqI+scooOBJpkuKg3PkEZ2lj xzOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Jozn33D2ODCLuu9isCf2CBfv+ElAsyYrOcsH6zOU6t4=; b=kxu0XngJAa3xd/rxsKd1ALtYI7HuKcPZ7RDgI6DkXpzDSaBg0f9h6xT8XwYBnP977A 4ZL28CKBUJgItvuhWBM0Lghm37EOS4Ds/IIjzs5DvFahtf4shcv0IJVP/hvNN8DZMWc8 sTPxl8BPnW3wuG6xPWwUov+S2qX51b9ZyEYakLXFumxra4bG0L6ZrfsdU4yBAh/RDs9W G7hfa3rfdMhQsr4oOmVQvfcxeHBN7fM4znzOjO4uL69C06xR+GmmstfG75BLoT+COH5u /Ho4TGbpJqASSD4z0V7ZZkQzRvUEmYCu18hheiDEpanGoUiCZZK/3Fx1CpcyCL+nLKFC ET0Q== X-Gm-Message-State: APjAAAWXYmRBEfhei+qR9MQejL6ZjoLmFSeUYYPPALacfpx344TJFeth RuQ/6RWL+ssJm9deN9erGkPYh+VehtEmqUqZSDU= X-Google-Smtp-Source: APXvYqxx4CTFtVkCShWnzThDJLtjjQc++QR2OyraMw19Eng5UIHNKHRjBVT7vpb/IuMV37pdvjFVBS3x+PBrkPsgqGA= X-Received: by 2002:a5d:9e0f:: with SMTP id h15mr17298647ioh.48.1557919683767; Wed, 15 May 2019 04:28:03 -0700 (PDT) In-Reply-To: <20190515100339.GB15042@ACM> 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:159334 Archived-At: --00000000000056f23f0588eb7102 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Well, I've just come across the bug myself, and it is indeed annoying. Can you check if this patch, which seems the simplest, serves all purposes? It also adds a test to prevent future regressions Thanks, Jo=C3=A3o diff --git a/lisp/electric.el b/lisp/electric.el index 657913a396..f15a95bf91 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -281,10 +281,13 @@ electric-indent-post-self-insert-function (goto-char before) (condition-case-unless-debug () (indent-according-to-mode) - (error (throw 'indent-error nil))) - ;; The goal here will be to remove the trailing - ;; whitespace after reindentation of the previous line - ;; because that may have (re)introduced it. + (error (throw 'indent-error nil)))) + (unless (eq electric-indent-inhibit 'electric-layout-mode) + ;; Unless we're operating under + ;; `electric-layout-mode' (Bug#35254), the goal here + ;; will be to remove the trailing whitespace after + ;; reindentation of the previous line because that + ;; may have (re)introduced it. (goto-char before) ;; We were at EOL in marker `before' before the call ;; to `indent-according-to-mode' but after we may @@ -464,7 +467,7 @@ electric-layout-post-self-insert-function-1 ;; really wants to reindent, then ;; `last-command-event' should be in ;; `electric-indent-chars'. - (let ((electric-indent-inhibit t)) + (let ((electric-indent-inhibit 'electric-layout-mode)) (funcall nl-after))))))) (pcase sym ('before (funcall nl-before)) diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el index 4f1e5729be..22b7a18ba5 100644 --- a/test/lisp/electric-tests.el +++ b/test/lisp/electric-tests.el @@ -876,6 +876,24 @@ electric-layout-for-c-style-du-jour (call-interactively (key-binding `[,last-command-event]))) (should (equal (buffer-string) "int main () {\n \n}")))) +(ert-deftest electric-layout-control-reindentation () + "Same as `e-l-int-main-kernel-style', but checking Bug#35254." + (ert-with-test-buffer () + (plainer-c-mode) + (electric-layout-local-mode 1) + (electric-pair-local-mode 1) + (electric-indent-local-mode 1) + (setq-local electric-layout-rules + '((?\{ . (after)) + (?\} . (before)))) + (insert "int main () ") + (let ((last-command-event ?\{)) + (call-interactively (key-binding `[,last-command-event]))) + (should (equal (buffer-string) "int main () {\n \n}")) + ;; insert an additional newline and check indentation + (call-interactively 'newline) + (should (equal (buffer-string) "int main () {\n\n \n}")))) + (define-derived-mode plainer-c-mode c-mode "pC" "A plainer/saner C-mode with no internal electric machinery." (c-toggle-electric-state -1) On Wed, May 15, 2019 at 11:03 AM Alan Mackenzie wrote: > Hello, Jo=C3=A3o. > > On Tue, May 14, 2019 at 11:34:24 +0100, Jo=C3=A3o T=C3=A1vora wrote: > > On Tue, May 14, 2019 at 10:27 AM Alan Mackenzie wrote: > > > > The bug is, type lots of s in a row; the indentation WS isn't > > > getting removed from the blank lines. Currently > electric-indent-inhibit > > > is inhibiting this removal. > > > > Do you mean the "removal of the WS in the lines preceding the current". > > In other words, do you mean "removal of the trailing WS that was once > > proper indentation"? > > Yes. To be absolutely clear, supposing we have point at the end of a > line containing nothing but indentation space (e.g., we've just typed > ): > > ! > ^ > point > > Type again. What we are currently seeing is: > > > ! > > . What we want to see is > > > ! > > . > > > Or do you think that the current line, the one where point stands, shou= ld > > not be indented at all in certain electric-* variable combinations and = or > > c-electric-* variable? Which of those combinations? > > When electric-indent-inhibit is set, the (electric) indentation of the > current line should not be done by electric-indent-mode. For the > moment, in CC Mode it should be done by c-electric-brace, and friends, > if so configured in CC Mode (the default being enabled). > > > > Probably. Maybe Jo=C3=A3o should check this, once he's fully back wi= th us. > > > > I'm afraid I can't put a date on that. There's a bun in the oven... > > Well, congratulations! I hope everything goes well. > > > An important development towards figuring out this issue is that a > > significant fraction of us agrees on what the behavior should be > > in what cases. Then we should code tests that assert that behavior > > possibly reusing the fixtures in electric-tests.el. > > Yes. > > > > The same bug occurs in Python Mode. > > > Succinctly, the bug is that on pressing lots of times in a row, > the > > > indentation WS is being left on the blank lines rather than being > > > removed. > > > I see. That does make sense. But, to be sure, we _dont_ what to > > remove the indentation WS on the "current" line, right? > > Right. Unless, and until, the current line becomes the "previous" line, > still otherwise being blank. > > I think we're agreed on everything. :-) > > > Jo=C3=A3o > > -- > Alan Mackenzie (Nuremberg, Germany). > --=20 Jo=C3=A3o T=C3=A1vora --00000000000056f23f0588eb7102 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Well,

I= 've just come across the bug myself, and it is indeed annoying.
Can you check if this patch, which seems the simplest, serves
=
all purposes? It also adds a test to prevent future regressions
<= div>
Thanks,
Jo=C3=A3o

diff --git a/lisp/electric.el b/lisp/electric.el
index 657913a396..f15a= 95bf91 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -28= 1,10 +281,13 @@ electric-indent-post-self-insert-function
=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (goto-char before)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 (condition-case-unless-debug ()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (indent-according-to-mode)
-=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (error (throw 'indent-error nil)))
-=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 ;; The goal here will be to remove the trailing
-=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 ;; whitespace after reindentation of the previous lin= e
-=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; because that may have (re)introduced i= t.
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (error (throw 'indent-= error nil))))
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (unless (eq electric-indent-inhibit '= electric-layout-mode)
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; Unless we're = operating under
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; `electric-layout-mode&#= 39; (Bug#35254), the goal here
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; will be = to remove the trailing whitespace after
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;;= reindentation of the previous line because that
+=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 ;; may have (re)introduced it.
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= (goto-char before)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; We were at EOL= in marker `before' before the call
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 ;; to `indent-according-to-mode' but after we may
@@ -464,7 +467= ,7 @@ electric-layout-post-self-insert-function-1
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; really wants to reindent, then
= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; `last-command-= event' should be in
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 ;; `electric-indent-chars'.
-=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 (let ((electric-indent-inhibit t))
+=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (let ((electric-indent-inhibit &= #39;electric-layout-mode))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 (funcall nl-after)))))))
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (pcase sym
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= ('before (funcall nl-before))
diff --git a/test/lisp/electric-tests= .el b/test/lisp/electric-tests.el
index 4f1e5729be..22b7a18ba5 100644--- a/test/lisp/electric-tests.el
+++ b/test/lisp/electric-tests.el
= @@ -876,6 +876,24 @@ electric-layout-for-c-style-du-jour
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (call-interactively (key-binding `[,last-command-even= t])))
=C2=A0=C2=A0=C2=A0=C2=A0 (should (equal (buffer-string) "int = main () {\n=C2=A0 \n}"))))
=C2=A0
+(ert-deftest electric-layout-= control-reindentation ()
+=C2=A0 "Same as `e-l-int-main-kernel-styl= e', but checking Bug#35254."
+=C2=A0 (ert-with-test-buffer ()+=C2=A0=C2=A0=C2=A0 (plainer-c-mode)
+=C2=A0=C2=A0=C2=A0 (electric-lay= out-local-mode 1)
+=C2=A0=C2=A0=C2=A0 (electric-pair-local-mode 1)
+= =C2=A0=C2=A0=C2=A0 (electric-indent-local-mode 1)
+=C2=A0=C2=A0=C2=A0 (s= etq-local electric-layout-rules
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 '((?\{ . (after))+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (?\} . (before))))
+=C2=A0=C2=A0=C2=A0 (i= nsert "int main () ")
+=C2=A0=C2=A0=C2=A0 (let ((last-command-= event ?\{))
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (call-interactively (key-bin= ding `[,last-command-event])))
+=C2=A0=C2=A0=C2=A0 (should (equal (buffe= r-string) "int main () {\n=C2=A0 \n}"))
+=C2=A0=C2=A0=C2=A0 ;;= insert an additional newline and check indentation
+=C2=A0=C2=A0=C2=A0 = (call-interactively 'newline)
+=C2=A0=C2=A0=C2=A0 (should (equal (bu= ffer-string) "int main () {\n\n=C2=A0 \n}"))))
+
=C2=A0(def= ine-derived-mode plainer-c-mode c-mode "pC"
=C2=A0=C2=A0 "= ;A plainer/saner C-mode with no internal electric machinery."
=C2= =A0=C2=A0 (c-toggle-electric-state -1)



On Wed, May 15, 2019 at 11:03 AM Alan Mackenzie <acm@muc.de> wrote:
Hello, Jo=C3=A3o.

On Tue, May 14, 2019 at 11:34:24 +0100, Jo=C3=A3o T=C3=A1vora wrote:
> On Tue, May 14, 2019 at 10:27 AM Alan Mackenzie <acm@muc.de> wrote:

> > The bug is, type lots of <CR>s in a row; the indentation WS= isn't
> > getting removed from the blank lines.=C2=A0 Currently electric-in= dent-inhibit
> > is inhibiting this removal.


> Do you mean the "removal of the WS in the lines preceding the cur= rent".
> In other words, do you mean "removal of the trailing WS that was = once
> proper indentation"?

Yes.=C2=A0 To be absolutely clear, supposing we have point at the end of a<= br> line containing nothing but indentation space (e.g., we've just typed <CR>):

<spaces>!
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ^
=C2=A0 =C2=A0 =C2=A0 point

Type <CR> again.=C2=A0 What we are currently seeing is:

<spaces>
<spaces>!

.=C2=A0 What we want to see is

<nothing>
<spaces>!

.

> Or do you think that the current line, the one where point stands, sho= uld
> not be indented at all in certain electric-* variable combinations and= or
> c-electric-* variable?=C2=A0 Which of those combinations?

When electric-indent-inhibit is set, the (electric) indentation of the
current line should not be done by electric-indent-mode.=C2=A0 For the
moment, in CC Mode it should be done by c-electric-brace, and friends,
if so configured in CC Mode (the default being enabled).

> > Probably.=C2=A0 Maybe Jo=C3=A3o should check this, once he's = fully back with us.


> I'm afraid I can't put a date on that. There's a bun in th= e oven...

Well, congratulations!=C2=A0 I hope everything goes well.

> An important development towards figuring out this issue is that a
> significant fraction of us agrees on what the behavior should be
> in what cases.=C2=A0 Then we should code tests that assert that behavi= or
> possibly reusing the fixtures in electric-tests.el.

Yes.

> > The same bug occurs in Python Mode.
> > Succinctly, the bug is that on pressing <CR> lots of times = in a row, the
> > indentation WS is being left on the blank lines rather than being=
> > removed.

> I see.=C2=A0 That does make sense. But, to be sure, we _dont_ what to<= br> > remove the indentation WS on the "current" line, right?

Right.=C2=A0 Unless, and until, the current line becomes the "previous= " line,
still otherwise being blank.

I think we're agreed on everything.=C2=A0 :-)

> Jo=C3=A3o

--
Alan Mackenzie (Nuremberg, Germany).


--
Jo=C3=A3o T=C3=A1vora
--00000000000056f23f0588eb7102--