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 14:55:09 +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="00000000000013ec750588ed809c" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="233137"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Alan Mackenzie , Noam Postavsky , 35254@debbugs.gnu.org, Dima Kogan To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 15 15:56:22 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 1hQuOL-000yVZ-Hi for geb-bug-gnu-emacs@m.gmane.org; Wed, 15 May 2019 15:56:21 +0200 Original-Received: from localhost ([127.0.0.1]:37539 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQuOK-00047c-HA for geb-bug-gnu-emacs@m.gmane.org; Wed, 15 May 2019 09:56:20 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:54496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQuOA-00047L-2o for bug-gnu-emacs@gnu.org; Wed, 15 May 2019 09:56:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQuO7-0008PD-IZ for bug-gnu-emacs@gnu.org; Wed, 15 May 2019 09:56:10 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39559) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQuO2-0008K9-BM; Wed, 15 May 2019 09:56:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hQuO1-0003aY-W6; Wed, 15 May 2019 09:56:02 -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 13:56: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.155792853713570 (code B ref 35254); Wed, 15 May 2019 13:56:01 +0000 Original-Received: (at 35254) by debbugs.gnu.org; 15 May 2019 13:55:37 +0000 Original-Received: from localhost ([127.0.0.1]:52865 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQuNc-0003WO-Ax for submit@debbugs.gnu.org; Wed, 15 May 2019 09:55:37 -0400 Original-Received: from mail-io1-f68.google.com ([209.85.166.68]:33635) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQuNT-0003N6-Tw for 35254@debbugs.gnu.org; Wed, 15 May 2019 09:55:33 -0400 Original-Received: by mail-io1-f68.google.com with SMTP id z4so2309056iol.0 for <35254@debbugs.gnu.org>; Wed, 15 May 2019 06:55:27 -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=Ik4+rnNYjVLsVuc+ob61ZA0jJzp2bNjwEUC8+PqtftA=; b=SpL7UVzq1daz0aBiVWPug61An5ZxaNkKeNDHFn6LF+2yovhVS/VV8sw7AZhRaIx7ou w3B7OzCRkf33ZnB3EOyCtebLUIzyelhb+Q7lkwpKccm40ZXD5btVCxfLMwAeIGHBN9gK 2eL7Jp0mfny1dwR95kuotxC1RRIFE15yGsBgIb8ReZyVDr2u2PS8IZ3F8YPOM2UEf59K 8zJ04T+3/yIPdL9jWpsFtMLXqCG4rnyEjFqnTFMZXMG0guKC0xCMkKmdS+kF5At4oX7c fW3X8kSjT9LW5uk5H9YEBwy8HEy82k+GAVV1m5onZQc7TDTd4hIBIniTxY2SadgUfCOL afhg== 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=Ik4+rnNYjVLsVuc+ob61ZA0jJzp2bNjwEUC8+PqtftA=; b=Dd2sAv5YNs0fr4w4lXEA3uyD6ORBSQD3C1n95oeFB8nAOocx41vyzMKAMLeV0QWWhF hyRrrx0Hkkn/eSbCeQaKvkrC+CzhUDm5aP8yu0ci8/ManuCIFHHhu3e5vaMm+hq4Ov4R HZGtv0mxebvvPmnpM5lH2/3uoGCDcVgS7oBgEU0PaHrLtrjA+tn9UseGFntXImlB6i2x 3BmQ+qEMmSB0X6+vSU8kMq+4WrGahS8YFv8o+YfLNMJnj4fdPHNO5yGXv+q4e1y+6388 pKGbaDEH1sY79NekRpGxzFfu/3Duj4lMQym3Vvo6Q7CzHboLeSTvefVHz1etGSStCQ/1 NAhw== X-Gm-Message-State: APjAAAUvYNyGFoUr4wpNA3fsBIDRMYt3Qz35sCjgGVSEvQICbthj+dDB 59UfK2awzxaqdgzM/sDyR52F0wsAy5V/ulWErWQ= X-Google-Smtp-Source: APXvYqw5qOi/6wCmHmvpCT78BPiTre+oXbh2gpLgZN2OIAKczvfdl+nBR6qZOdLDx4iJGAOT/UGFjrrSvGiM6YcrU0g= X-Received: by 2002:a6b:b415:: with SMTP id d21mr22316470iof.189.1557928520967; Wed, 15 May 2019 06:55:20 -0700 (PDT) In-Reply-To: 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:159339 Archived-At: --00000000000013ec750588ed809c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, May 15, 2019 at 2:19 PM Stefan Monnier wrote: > > 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? > > FWIW, I find it rather ugly (makes the two minor modes too tightly > intertwined). > It's no work of art. But the modes are already intertwined. (And the code within a mode ain't no work of art, too :-)) > It also adds a test to prevent future regressions > > Another approach might be to do the whitespace erasure in > electric-indent without paying any attention to electric-layout/pair, > and then in electric-pair to explicitly cause (re)indentation > after moving point to between the opened pair? > Maybe, I don't have time to implement that, and it looks like it could hold surprises. But if you do it and it passes the existing tests and the new one, nothing against > Yet another option is to tell electric-indent about the final position > of point and have it refrain from deleting whitespace before that final > position, as in the patch below. WDYT? > It looks a little like an elaboration of a third abstraction to basically create another intertwining between e-p-m and e-i-m. Sure it's the best? Anyway, if it passes all tests, new and old, great, push it! (but why are you deleting plainer-c-mode in test/lisp/electric-tests.el?) Jo=C3=A3o > > > Stefan > > > diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el > index 3be09d87b4..a14efff241 100644 > --- a/lisp/elec-pair.el > +++ b/lisp/elec-pair.el > @@ -551,7 +551,8 @@ electric-pair-post-self-insert-function > (goto-char pos) > (funcall electric-pair-inhibit-predicate > last-command-event))))) > - (save-excursion (electric-pair--insert pair))))) > + (let ((electric-indent--destination (point-marker))) > + (save-excursion (electric-pair--insert pair)))))) > (_ > (when (and (if (functionp electric-pair-open-newline-between-pair= s) > (funcall electric-pair-open-newline-between-pairs) > diff --git a/lisp/electric.el b/lisp/electric.el > index 07da2f1d9e..71ebb9cf45 100644 > --- a/lisp/electric.el > +++ b/lisp/electric.el > @@ -231,6 +231,14 @@ electric-indent-functions-without-reindent > not try to reindent lines. It is normally better to make the major > mode set `electric-indent-inhibit', but this can be used as a > workaround.") > > +(defun electric-indent--inhibited-p () > + (or electric-indent-inhibit > + (memq indent-line-function > + electric-indent-functions-without-reindent))) > + > +(defvar electric-indent--destination nil > + "If non-nil, position to which point will be later restored.") > + > (defun electric-indent-post-self-insert-function () > "Function that `electric-indent-mode' adds to `post-self-insert-hook'. > This indents if the hook `electric-indent-functions' returns non-nil, > @@ -272,26 +280,26 @@ electric-indent-post-self-insert-function > (when at-newline > (let ((before (copy-marker (1- pos) t))) > (save-excursion > - (unless > - (or (memq indent-line-function > - electric-indent-functions-without-reindent= ) > - electric-indent-inhibit) > + (unless (electric-indent--inhibited-p) > ;; Don't reindent the previous line if the > ;; indentation function is not a real one. > (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. > - (goto-char before) > - ;; We were at EOL in marker `before' before the call > - ;; to `indent-according-to-mode' but after we may > - ;; not be (Bug#15767). > - (when (and (eolp)) > - (delete-horizontal-space t)))))) > - (unless (and electric-indent-inhibit > + (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. > + (goto-char before) > + ;; We were at EOL in marker `before' before the call > + ;; to `indent-according-to-mode' but after we may > + ;; not be (Bug#15767). > + (when (and (eolp) > + ;; Don't delete "trailing space" before point= ! > + (not (and electric-indent--destination > + (=3D (point) > electric-indent--destination)))) > + (delete-horizontal-space t))))) > + (unless (and (electric-indent--inhibited-p) > (not at-newline)) > (condition-case-unless-debug () > (indent-according-to-mode) > diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el > index 4f1e5729be..0b67fb3f1f 100644 > --- a/test/lisp/electric-tests.el > +++ b/test/lisp/electric-tests.el > @@ -876,15 +876,6 @@ electric-layout-for-c-style-du-jour > (call-interactively (key-binding `[,last-command-event]))) > (should (equal (buffer-string) "int main () {\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) > - (setq-local electric-indent-local-mode-hook nil) > - (setq-local electric-indent-mode-hook nil) > - (electric-indent-local-mode 1) > - (dolist (key '(?\" ?\' ?\{ ?\} ?\( ?\) ?\[ ?\])) > - (local-set-key (vector key) 'self-insert-command))) > - > (ert-deftest electric-modes-int-main-allman-style () > (ert-with-test-buffer () > (plainer-c-mode) > > --=20 Jo=C3=A3o T=C3=A1vora --00000000000013ec750588ed809c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, May 15, 2019 at 2:19 PM Stefan Mo= nnier <monnier@iro.umontreal= .ca> wrote:
> 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?

FWIW, I find it rather ugly (makes the two minor modes too tightly
intertwined).

It's no work of art. = But the modes are already intertwined.
(And the code within = a mode ain't no work of art, too :-))

> It also adds a test to prevent future regressions

Another approach might be to do the whitespace erasure in
electric-indent without paying any attention to electric-layout/pair,
and then in electric-pair to explicitly cause (re)indentation
after moving point to between the opened pair?

Maybe, I don't have time to implement that, and it looks like i= t
could hold surprises.=C2=A0 But if you do it and it passes the = existing
tests and the new one, nothing against
=C2=A0
Yet another option is to tell electric-indent about the final position
of point and have it refrain from deleting whitespace before that final
position, as in the patch below.=C2=A0 WDYT?

It looks a little like an elaboration of a third abstraction to basic= ally
create another intertwining between e-p-m and e-i-m. Su= re it's the
best? Anyway, if it passes all=C2=A0 tests, = new and old, great, push it!

(but why are you = deleting=20 plainer-c-mode in test/lisp/electric-tests.el?)

Jo=C3=A3o


=C2=A0


=C2=A0 =C2=A0 =C2=A0 =C2=A0 Stefan


diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
index 3be09d87b4..a14efff241 100644
--- a/lisp/elec-pair.el
+++ b/lisp/elec-pair.el
@@ -551,7 +551,8 @@ electric-pair-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 (goto-char pos)
=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 electric-pair-inhibit-predicate
=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=A0last-command-event)))))=
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(save-excursion (electric-pair--insert p= air)))))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(let ((electric-indent--destination (poi= nt-marker)))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(save-excursion (electric-pair--i= nsert pair))))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(_
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (and (if (functionp electric-pair-open-ne= wline-between-pairs)
=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 electric-pair-open-newline-between-pairs)
diff --git a/lisp/electric.el b/lisp/electric.el
index 07da2f1d9e..71ebb9cf45 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -231,6 +231,14 @@ electric-indent-functions-without-reindent
=C2=A0not try to reindent lines.=C2=A0 It is normally better to make the ma= jor
=C2=A0mode set `electric-indent-inhibit', but this can be used as a wor= karound.")

+(defun electric-indent--inhibited-p ()
+=C2=A0 (or electric-indent-inhibit
+=C2=A0 =C2=A0 =C2=A0 (memq indent-line-function
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 electric-indent-functions-withou= t-reindent)))
+
+(defvar electric-indent--destination nil
+=C2=A0 "If non-nil, position to which point will be later restored.&q= uot;)
+
=C2=A0(defun electric-indent-post-self-insert-function ()
=C2=A0 =C2=A0"Function that `electric-indent-mode' adds to `post-s= elf-insert-hook'.
=C2=A0This indents if the hook `electric-indent-functions' returns non-= nil,
@@ -272,26 +280,26 @@ electric-indent-post-self-insert-function
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(when at-newline
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(let ((before (copy-marker = (1- pos) t)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(save-excursion
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (unless
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (or = (memq indent-line-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 electric-indent-functions-without-reindent)=
-=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-inhibit)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (unless (electric-= indent--inhibited-p)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; Don= 't reindent the previous line if the
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; ind= entation function is not a real one.
=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(condi= tion-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(indent-according-to-mode)
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (err= or (throw 'indent-error nil)))
-=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 ;; whitespa= ce after reindentation of the previous line
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; because = that may have (re)introduced it.
-=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 ;; 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 ;; to `inde= nt-according-to-mode' but after we may
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; not be (= Bug#15767).
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (and = (eolp))
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (del= ete-horizontal-space t))))))
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (unless (and electric-indent-inhibit +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (err= or (throw 'indent-error nil))))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; The goal here w= ill be to remove the trailing
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; whitespace afte= r reindentation of the previous line
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; because that ma= y have (re)introduced it.
+=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 ;; 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 ;; to `indent-acco= rding-to-mode' but after we may
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; not be (Bug#157= 67).
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (and (eolp)<= br> +=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;; Don't delete "trailing space" befo= re point!
+=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(not (and electric-indent--destination
+=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(=3D (point) ele= ctric-indent--destination))))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (delete-hor= izontal-space t)))))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (unless (and (electric-indent--inhibite= d-p)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 (not at-newline))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(condition-case-unless-debu= g ()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(indent-accor= ding-to-mode)
diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el
index 4f1e5729be..0b67fb3f1f 100644
--- a/test/lisp/electric-tests.el
+++ b/test/lisp/electric-tests.el
@@ -876,15 +876,6 @@ electric-layout-for-c-style-du-jour
=C2=A0 =C2=A0 =C2=A0 =C2=A0(call-interactively (key-binding `[,last-command= -event])))
=C2=A0 =C2=A0 =C2=A0(should (equal (buffer-string) "int main () {\n=C2= =A0 \n}"))))

-(define-derived-mode plainer-c-mode c-mode "pC"
-=C2=A0 "A plainer/saner C-mode with no internal electric machinery.&q= uot;
-=C2=A0 (c-toggle-electric-state -1)
-=C2=A0 (setq-local electric-indent-local-mode-hook nil)
-=C2=A0 (setq-local electric-indent-mode-hook nil)
-=C2=A0 (electric-indent-local-mode 1)
-=C2=A0 (dolist (key '(?\" ?\' ?\{ ?\} ?\( ?\) ?\[ ?\]))
-=C2=A0 =C2=A0 (local-set-key (vector key) 'self-insert-command)))
-
=C2=A0(ert-deftest electric-modes-int-main-allman-style ()
=C2=A0 =C2=A0(ert-with-test-buffer ()
=C2=A0 =C2=A0 =C2=A0(plainer-c-mode)



--
Jo=C3=A3o T=C3=A1vora
--00000000000013ec750588ed809c--