GNU bug report logs - #36884
Default python mode with electric-indent-mode sometimes indents empty lines

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Jarosław Rzeszótko <jrzeszotko@HIDDEN>; dated Thu, 1 Aug 2019 07:07:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 36884 <at> debbugs.gnu.org:


Received: (at 36884) by debbugs.gnu.org; 2 Aug 2019 14:55:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 02 10:55:23 2019
Received: from localhost ([127.0.0.1]:57556 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1htYxl-0004hb-Dj
	for submit <at> debbugs.gnu.org; Fri, 02 Aug 2019 10:55:21 -0400
Received: from mail-io1-f45.google.com ([209.85.166.45]:47034)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jrzeszotko@HIDDEN>) id 1htYxk-0004hK-15
 for 36884 <at> debbugs.gnu.org; Fri, 02 Aug 2019 10:55:20 -0400
Received: by mail-io1-f45.google.com with SMTP id i10so39454404iol.13
 for <36884 <at> debbugs.gnu.org>; Fri, 02 Aug 2019 07:55:19 -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=d+ZGDLpgox8CGVLgH3TDYMG0/du9dU1CxQEytjSh1fE=;
 b=WB9nZEECba9smFu4+6OsVfw+3OFoNTVAchi0J3L8Z/5W3aWfhlasQr/jwA/wiuHKIc
 3lTG3A2RF0kex7TnL7uw9jZFXLgVWJvTK39impkhNCgMwb++ERGjJ9a1Vma3glkI3hoY
 i/i4a2F+qtOwE7gOPsjrLT7nKHPbZ0BquWdWo899YxX9AD/s6qgXypGNR39CX2liYnng
 QbudtsNSZCADWy5ZZqrMox436ecjaeYSsGjh7287nTEZKimTYfQrCJjPJsCwmjXiiOpS
 pQ5SSGHEQz8odK05FgN6cOsFbA/sGzDffqXIqqFBw5CSKANWb0pIQLZkUFp2lf2CzDhj
 UV8Q==
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=d+ZGDLpgox8CGVLgH3TDYMG0/du9dU1CxQEytjSh1fE=;
 b=VSeMmb84Rdq+bOsqrg+Bl7Zc4B3oMnZHX3EbAnj/dnM7riopXIPm7vE0BYK/q1mZAs
 57muGVJ0phDDue5WNKG7Tb+hThQQ2FkA0F8Q5gPwBr81itU6H+dN0627ADcSnbofpCKD
 /jUmhJQ5Hj1AKoC20g4etCqmEnnubWaSPfT5cg8ZZrHVyvoDAixZlFAgReH2xvG34Cce
 LGQRG2Tm/uGgN5WHG/Btt8Xdmxcop8Yt/Lej1r6p4leFjvCo+sNHm0soaL7EXmF627J6
 bnNzbulLVVwoGyej15gypZyNo4dmlpxuUGphNB6UoPR10S9SV/pYDjMKOakp8iLqhqaO
 tMEg==
X-Gm-Message-State: APjAAAXBlj8qF7PTOd7e5yGBshv+iVplnbRxcMY6R8n58sGZX1ZNBh4v
 6Fly7N8pwYK8Ul+WPkyAKQ9pCO/kT75y3ip5RWQ=
X-Google-Smtp-Source: APXvYqx4FrQ44e3M1mMzOOd7YvQKpzqogTbxrOYEmgWx4ko2NyDeFfkqVjzPUfdavP2KWIU5g78dzHGyyhrKr+3C68c=
X-Received: by 2002:a02:cd83:: with SMTP id l3mr103007050jap.66.1564757714230; 
 Fri, 02 Aug 2019 07:55:14 -0700 (PDT)
MIME-Version: 1.0
References: <CAO_X8WByiRv9TQWC0vWRROeVdjV+LQu-F4PmSu+B4rdppW-=vg@HIDDEN>
 <88e5aea8-cee3-993c-8b8e-b7651f48459d@HIDDEN>
 <87a7cstl37.fsf@HIDDEN>
 <CAO_X8WDueszg2oN5JwEk0vYMy==xnp0oC5mf0_6ebc-oGmTWWg@HIDDEN>
 <41c3dcd2-0ba9-2898-6027-0064d23613ab@HIDDEN>
In-Reply-To: <41c3dcd2-0ba9-2898-6027-0064d23613ab@HIDDEN>
From: =?UTF-8?B?SmFyb3PFgmF3IFJ6ZXN6w7N0a28=?= <jrzeszotko@HIDDEN>
Date: Fri, 2 Aug 2019 16:55:03 +0200
Message-ID: <CAO_X8WARTDB0bqk3Obj6NYxUDZrB8cMqwWUPmnbJ9g8NzXAW9g@HIDDEN>
Subject: Re: bug#36884: Default python mode with electric-indent-mode
 sometimes indents empty lines
To: =?UTF-8?Q?Andreas_R=C3=B6hler?= <andreas.roehler@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000b762e6058f238b4b"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36884
Cc: 36884 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000b762e6058f238b4b
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

So this is by design? Of course I can insert a newline in some other way,
circumventing the electric stuff, but having to decide between
RET-version-1 and RET-version-2 seems really inconvenient, personally I
would much rather have RET insert a newline without indent if the cursor is
not after text. This is also how it seems to work in other editors.

Cheers,
Jarek

On Fri, Aug 2, 2019 at 12:38 PM Andreas R=C3=B6hler <
andreas.roehler@HIDDEN> wrote:

> All you need probably is calling C-j, not RET
>
> There is certain confusion IMO in recent design, as
>
> C-j is bound to electric-newline-and-maybe-indent
>
> which works as I would expect from newline.
>
>
> On 02.08.19 07:08, Jaros=C5=82aw Rzesz=C3=B3tko wrote:
>
> Perhaps this behavior exists because there can also be a situation like
> this:
>
> def test():
>     print("test")
> [cursor, on empty line in middle of indented block]
>     print("test")
>
> where what electric indent does after pressing RET (creates new line
> aligned to the print statements) makes sense. I think it is mostly
> irritating though, and editors I tested, Vim and Sublime Text, do not
> automatically indent in any of the situations I mentioned.
>
> FWIW this works as a workaround for me:
>
> (setq electric-indent-functions
>       '((lambda (inserted-char)
>           (when (eq major-mode 'python-mode)
>             ;; Do not auto-indent after inserting any empty line
>             (when (save-excursion
>                     (previous-line)
>                     (beginning-of-line)
>                     (looking-at "^\s*$"))
>               'no-indent)))))
>
> Cheers,
> Jarek
>
> On Fri, Aug 2, 2019 at 3:26 AM Noam Postavsky <npostavs@HIDDEN> wrote:
>
>> Andreas R=C3=B6hler <andreas.roehler@HIDDEN> writes:
>>
>> > AFAIU electric-indent-mode doesn't run a timer, cursor position alone
>> > would not trigger it.
>>
>> electric-indent-mode works from post-self-insert-hook.  Not sure how
>> cursor position and timers are related.
>>
>>
>>
>>

--000000000000b762e6058f238b4b
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>So this is by design? Of course I can insert a newlin=
e in some other way, circumventing the electric stuff, but having to decide=
 between RET-version-1 and RET-version-2 seems really inconvenient, persona=
lly I would much rather have RET insert a newline without indent if the cur=
sor is not after text. This is also how it seems to work in other editors.<=
/div><div><br></div><div>Cheers,</div><div>Jarek</div></div><br><div class=
=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Aug 2, 2019 =
at 12:38 PM Andreas R=C3=B6hler &lt;<a href=3D"mailto:andreas.roehler@easy-=
emacs.de">andreas.roehler@HIDDEN</a>&gt; wrote:<br></div><blockquote=
 class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px so=
lid rgb(204,204,204);padding-left:1ex">
 =20
   =20
 =20
  <div bgcolor=3D"#FFFFFF">
    <p>All you need probably is calling C-j, not RET</p>
    <p>There is certain confusion IMO in recent design, as <br>
    </p>
    <p>C-j is bound to electric-newline-and-maybe-indent</p>
    <p>which works as I would expect from newline.</p>
    <p><br>
    </p>
    <div class=3D"gmail-m_-2046911147561273444moz-cite-prefix">On 02.08.19 =
07:08, Jaros=C5=82aw Rzesz=C3=B3tko
      wrote:<br>
    </div>
    <blockquote type=3D"cite">
     =20
      <div dir=3D"ltr">
        <div dir=3D"ltr">
          <div>Perhaps this behavior exists because there can also be a
            situation like this:</div>
          <div><br>
          </div>
          <div>
            <div>def test():</div>
            <div>=C2=A0 =C2=A0 print(&quot;test&quot;)</div>
          </div>
          <div>[cursor, on empty line in middle of indented block]</div>
          <div>
            <div>
              <div>=C2=A0 =C2=A0 print(&quot;test&quot;)</div>
            </div>
            <div><br>
            </div>
            <div>where what electric indent does after pressing RET
              (creates new line aligned to the print statements)=C2=A0makes
              sense. I think it is mostly irritating though, and editors
              I tested, Vim and Sublime Text, do not automatically
              indent in any of the situations I mentioned.</div>
          </div>
          <div><br>
          </div>
        </div>
        <div dir=3D"ltr">FWIW this works as a workaround for me:
          <div><br>
          </div>
          <div>(setq electric-indent-functions<br>
            =C2=A0 =C2=A0 =C2=A0 &#39;((lambda (inserted-char)<br>
            =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (eq major-mode &#39;py=
thon-mode)<br>
            =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; Do not auto-indent=
 after inserting any empty
            line<br>
            =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (save-excursion=
<br>
            =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 (previous-line)<br>
            =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 (beginning-of-line)<br>
            =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 (looking-at &quot;^\s*$&quot;))<br>
            =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &#39;no-indent=
)))))<br>
          </div>
          <div><br>
          </div>
          <div>Cheers,</div>
          <div>Jarek</div>
        </div>
        <br>
        <div class=3D"gmail_quote">
          <div dir=3D"ltr" class=3D"gmail_attr">On Fri, Aug 2, 2019 at 3:26
            AM Noam Postavsky &lt;<a href=3D"mailto:npostavs@HIDDEN" tar=
get=3D"_blank">npostavs@HIDDEN</a>&gt; wrote:<br>
          </div>
          <blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8=
ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Andreas R=C3=B6=
hler &lt;<a href=3D"mailto:andreas.roehler@HIDDEN" target=3D"_blank"=
>andreas.roehler@HIDDEN</a>&gt;
            writes:<br>
            <br>
            &gt; AFAIU electric-indent-mode doesn&#39;t run a timer, cursor
            position alone<br>
            &gt; would not trigger it.<br>
            <br>
            electric-indent-mode works from post-self-insert-hook.=C2=A0 No=
t
            sure how<br>
            cursor position and timers are related.<br>
            <br>
            <br>
            <br>
          </blockquote>
        </div>
      </div>
    </blockquote>
  </div>

</blockquote></div>

--000000000000b762e6058f238b4b--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36884; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Aug 2019 10:37:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 02 06:37:08 2019
Received: from localhost ([127.0.0.1]:55823 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1htUvr-0001pD-Oa
	for submit <at> debbugs.gnu.org; Fri, 02 Aug 2019 06:37:08 -0400
Received: from lists.gnu.org ([209.51.188.17]:38899)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <andreas.roehler@HIDDEN>) id 1htUvp-0001p5-Q2
 for submit <at> debbugs.gnu.org; Fri, 02 Aug 2019 06:37:06 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:40683)
 by lists.gnu.org with esmtp (Exim 4.86_2)
 (envelope-from <andreas.roehler@HIDDEN>) id 1htUvo-000161-CI
 for bug-gnu-emacs@HIDDEN; Fri, 02 Aug 2019 06:37:05 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: ****
X-Spam-Status: No, score=4.1 required=5.0 tests=BAYES_50,HTML_MESSAGE,
 RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS,URIBL_BLOCKED autolearn=disabled
 version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <andreas.roehler@HIDDEN>) id 1htUvn-00033t-6k
 for bug-gnu-emacs@HIDDEN; Fri, 02 Aug 2019 06:37:04 -0400
Received: from mout.kundenserver.de ([217.72.192.73]:52485)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <andreas.roehler@HIDDEN>)
 id 1htUvm-00031w-St
 for bug-gnu-emacs@HIDDEN; Fri, 02 Aug 2019 06:37:03 -0400
Received: from [192.168.178.39] ([87.123.193.105]) by mrelayeu.kundenserver.de
 (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id
 1M9npT-1hx3q00zXZ-005u1U for <bug-gnu-emacs@HIDDEN>; Fri, 02 Aug 2019
 12:36:57 +0200
Subject: Re: bug#36884: Default python mode with electric-indent-mode
 sometimes indents empty lines
To: bug-gnu-emacs@HIDDEN
References: <CAO_X8WByiRv9TQWC0vWRROeVdjV+LQu-F4PmSu+B4rdppW-=vg@HIDDEN>
 <88e5aea8-cee3-993c-8b8e-b7651f48459d@HIDDEN>
 <87a7cstl37.fsf@HIDDEN>
 <CAO_X8WDueszg2oN5JwEk0vYMy==xnp0oC5mf0_6ebc-oGmTWWg@HIDDEN>
From: =?UTF-8?Q?Andreas_R=c3=b6hler?= <andreas.roehler@HIDDEN>
Message-ID: <41c3dcd2-0ba9-2898-6027-0064d23613ab@HIDDEN>
Date: Fri, 2 Aug 2019 12:39:17 +0200
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:60.0) Gecko/20100101
 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <CAO_X8WDueszg2oN5JwEk0vYMy==xnp0oC5mf0_6ebc-oGmTWWg@HIDDEN>
Content-Type: multipart/alternative;
 boundary="------------1347F5B696C885D99B858713"
Content-Language: en-US
X-Provags-ID: V03:K1:LnMNP+Q1kGWPkaUuDxprxWuINXmamKuepHq7bqWbQV75KnThBhQ
 rVstAh+qIh8FMFQ4lx2parUHDAeDh7JejWJHhmsMQaD39pnpk4eqHfpMh4OenuHYwMce21D
 eATPSr0QeLerYZzVeEzKObTjPBAbNeIbYEo8mZa4WZrRzuFizOxdqWkp7WEbjGImMQjFUDZ
 GXZHS/UdWqXH61cGNlI8g==
X-UI-Out-Filterresults: notjunk:1;V03:K0:OaK8LnofMlU=:wFO3bYQcL1AIXrzDHAcLcn
 nBCQ4Xp5WPKy4HHist8Q+UGrFqY1lvW0BRx153qBnEaSejcmnq6/V19+YUY8v+IaWF/izmq04
 VZKGrZKSfHRBUxrrTweKEek6BXjW9Z9MG3Qd4V1Pfr1vUVrWl8QMs1UjHriowBQPO4qByKWVH
 DTapK4iXGda+Z7xerhr3QNX0oiP+QlbMsuzqzF8ssztbX5MSt7QdL67STIj8j5yI/MHl3nzw1
 OjFzes5txHU9O85kHLF6BdCeY4FtcByOakrVH4V1mUyosbaVpk7Gy0s7dAT8Y/JDjdpvt9nf2
 j/vc9cWrESQl/AHYoFvpZdM7pLvI/+0/IYk8Ls4YG6weIW1e5F9oMoFyNYU009bO8uJm41Wom
 aR/mZIe6uq06DdQRllh3RzZS6XQ09G3rG25ez9XimHYJYFxcEeHk4DQ8dm4wXJ+zFtlQZpSE+
 SA0VuusV6Rifsf9I6LxAlE1BDRk4EAOWD9+6XvGxEMrAONNbaos8p5/3PsFyLqbHSr/mwbTYN
 w1Qsa0MjA52oldjFwvznPIV1yJ84HxI+9ldnxYC8zP5VLyEv8aWA2klDMqcyn/Vb9QHWROu4O
 BpJuoIlvAQ8BU6iQr/cM2kBQau0Iv/vCDk6ox4u2wxtljOV7brIa/GYT97v94aqY1SMNK79zk
 2S8wE5/0mCu7P0rWMtC0ssJM2ZO0FcmGpXAEg3gzUUhkHmzI94u8BUeZhwfFPYdjcIlb29yWG
 sOfl/sAQD6pda6Jwuk/9eMsdtbIMi4j2DDuDIEEM9LSTSNEgSZJLI+1Z11CPaPWbJog7yRbWs
 +PmJZnN
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 217.72.192.73
X-Spam-Score: 1.3 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  All you need probably is calling C-j,
 not RET There is certain confusion IMO in recent design,
 as C-j is bound to electric-newline-and-maybe-indent
 Content analysis details:   (1.3 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: easy-emacs.de]
 3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
 [87.123.193.105 listed in zen.spamhaus.org]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.0 SPF_NONE               SPF: sender does not publish an SPF Record
 -2.3 RCVD_IN_DNSWL_MED      RBL: Sender listed at https://www.dnswl.org/,
 medium trust [209.51.188.17 listed in list.dnswl.org]
 0.0 HTML_MESSAGE           BODY: HTML included in message
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

This is a multi-part message in MIME format.
--------------1347F5B696C885D99B858713
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit

All you need probably is calling C-j, not RET

There is certain confusion IMO in recent design, as

C-j is bound to electric-newline-and-maybe-indent

which works as I would expect from newline.


On 02.08.19 07:08, Jarosław Rzeszótko wrote:
> Perhaps this behavior exists because there can also be a situation 
> like this:
>
> def test():
>     print("test")
> [cursor, on empty line in middle of indented block]
>     print("test")
>
> where what electric indent does after pressing RET (creates new line 
> aligned to the print statements) makes sense. I think it is mostly 
> irritating though, and editors I tested, Vim and Sublime Text, do not 
> automatically indent in any of the situations I mentioned.
>
> FWIW this works as a workaround for me:
>
> (setq electric-indent-functions
>       '((lambda (inserted-char)
>           (when (eq major-mode 'python-mode)
>             ;; Do not auto-indent after inserting any empty line
>             (when (save-excursion
>                     (previous-line)
>                     (beginning-of-line)
>                     (looking-at "^\s*$"))
>               'no-indent)))))
>
> Cheers,
> Jarek
>
> On Fri, Aug 2, 2019 at 3:26 AM Noam Postavsky <npostavs@HIDDEN 
> <mailto:npostavs@HIDDEN>> wrote:
>
>     Andreas Röhler <andreas.roehler@HIDDEN
>     <mailto:andreas.roehler@HIDDEN>> writes:
>
>     > AFAIU electric-indent-mode doesn't run a timer, cursor position
>     alone
>     > would not trigger it.
>
>     electric-indent-mode works from post-self-insert-hook.  Not sure how
>     cursor position and timers are related.
>
>
>

--------------1347F5B696C885D99B858713
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>All you need probably is calling C-j, not RET</p>
    <p>There is certain confusion IMO in recent design, as <br>
    </p>
    <p>C-j is bound to electric-newline-and-maybe-indent</p>
    <p>which works as I would expect from newline.</p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 02.08.19 07:08, Jarosław Rzeszótko
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAO_X8WDueszg2oN5JwEk0vYMy==xnp0oC5mf0_6ebc-oGmTWWg@HIDDEN">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr">
          <div>Perhaps this behavior exists because there can also be a
            situation like this:</div>
          <div><br>
          </div>
          <div>
            <div>def test():</div>
            <div>    print("test")</div>
          </div>
          <div>[cursor, on empty line in middle of indented block]</div>
          <div>
            <div>
              <div>    print("test")</div>
            </div>
            <div><br>
            </div>
            <div>where what electric indent does after pressing RET
              (creates new line aligned to the print statements) makes
              sense. I think it is mostly irritating though, and editors
              I tested, Vim and Sublime Text, do not automatically
              indent in any of the situations I mentioned.</div>
          </div>
          <div><br>
          </div>
        </div>
        <div dir="ltr">FWIW this works as a workaround for me:
          <div><br>
          </div>
          <div>(setq electric-indent-functions<br>
                  '((lambda (inserted-char)<br>
                      (when (eq major-mode 'python-mode)<br>
                        ;; Do not auto-indent after inserting any empty
            line<br>
                        (when (save-excursion<br>
                                (previous-line)<br>
                                (beginning-of-line)<br>
                                (looking-at "^\s*$"))<br>
                          'no-indent)))))<br>
          </div>
          <div><br>
          </div>
          <div>Cheers,</div>
          <div>Jarek</div>
        </div>
        <br>
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">On Fri, Aug 2, 2019 at 3:26
            AM Noam Postavsky &lt;<a href="mailto:npostavs@HIDDEN"
              moz-do-not-send="true">npostavs@HIDDEN</a>&gt; wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">Andreas Röhler &lt;<a
              href="mailto:andreas.roehler@HIDDEN"
              target="_blank" moz-do-not-send="true">andreas.roehler@HIDDEN</a>&gt;
            writes:<br>
            <br>
            &gt; AFAIU electric-indent-mode doesn't run a timer, cursor
            position alone<br>
            &gt; would not trigger it.<br>
            <br>
            electric-indent-mode works from post-self-insert-hook.  Not
            sure how<br>
            cursor position and timers are related.<br>
            <br>
            <br>
            <br>
          </blockquote>
        </div>
      </div>
    </blockquote>
  </body>
</html>

--------------1347F5B696C885D99B858713--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36884; Package emacs. Full text available.

Message received at 36884 <at> debbugs.gnu.org:


Received: (at 36884) by debbugs.gnu.org; 2 Aug 2019 05:08:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 02 01:08:41 2019
Received: from localhost ([127.0.0.1]:55692 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1htPo1-00022h-8R
	for submit <at> debbugs.gnu.org; Fri, 02 Aug 2019 01:08:41 -0400
Received: from mail-io1-f45.google.com ([209.85.166.45]:37306)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jrzeszotko@HIDDEN>) id 1htPny-00022T-3R
 for 36884 <at> debbugs.gnu.org; Fri, 02 Aug 2019 01:08:40 -0400
Received: by mail-io1-f45.google.com with SMTP id q22so29717457iog.4
 for <36884 <at> debbugs.gnu.org>; Thu, 01 Aug 2019 22:08:38 -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=Sq/Y1zwEVub+9bXPKfHfbe7+/EX2BWLWCpuvHa0MiRg=;
 b=LOLgkysXT7qnG0pyk3WqnIhlHbqnh3me5MmFtpSJcHvCVh9XnAJVoXkHZwUv9tG1iz
 M6wQtHuWc4oFhzHjGbuhcq4AimTqmPBcrMV5ebSDGIIdQaGbniSnf0YyE0FL8FOrpdK8
 Y1nHV+nK4hhGftx3CmODhAxM+wchGY/MU3jIgmzhpOSwWcyGcUeiqB4XAdgRBVv2cOBb
 u4JjeHPBGcqhfb1S9cQ6NgEuz/8oD0eCN7J6SLDlgy73cmDq7gmgDGTVifLkCz5hqzSV
 /+/IJlCH79e6kGtb2kLtp/LgQ/P0YM0Ct/o0ZZnBKDnSH1zm6RIIs5/FWFpjZSf/yTST
 4lwA==
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=Sq/Y1zwEVub+9bXPKfHfbe7+/EX2BWLWCpuvHa0MiRg=;
 b=dEIvje/5lTtPTsSUv0gQhYSFpnLEwX9pkm8J710hfzIuxDNdzywISptTid/DYmF57N
 tfmNa6y/o0wG2unw+YDhzaiNzZwhGGiip9VBmOWOwJ2iMNMgY0JYzVS7T/xqf/29OGLk
 JPIGzOr3xlY+fkgoTJ+X9SE1GGR/BqnrCCMs24omO3DdtKKnG+IaBnNBqVn44vtyFexQ
 ou5aULTssWqU8AHzQLKCoITEgFFpY34S/dfqV64BPj/M5d+HoT7p2Y5tPwzaWkP7WSmY
 rCMP9fuI7DttKkJuyA7KUcvjh0DCTStOio6rqtXhniAWZB+J9jWW1CsRYTRKaN59mxXg
 Ixbg==
X-Gm-Message-State: APjAAAXx+iAgD6KwIwRgGGb6JIF0hIhFNruUGvMMCRGgFsCLk/OZD5M+
 PcEWV6/U/mFMtD4R5VWSJRyGKwXZI8Cer6Z5lQc=
X-Google-Smtp-Source: APXvYqwyg260gcMsL7uaPFA01NCdmTU6g7g+eBLWFYXz8iAN2Pf3LsAjLVo5WMHHxuMCZg2AfPj0HueOUcfNRAHHsNs=
X-Received: by 2002:a02:29ce:: with SMTP id p197mr4415561jap.139.1564722512396; 
 Thu, 01 Aug 2019 22:08:32 -0700 (PDT)
MIME-Version: 1.0
References: <CAO_X8WByiRv9TQWC0vWRROeVdjV+LQu-F4PmSu+B4rdppW-=vg@HIDDEN>
 <88e5aea8-cee3-993c-8b8e-b7651f48459d@HIDDEN>
 <87a7cstl37.fsf@HIDDEN>
In-Reply-To: <87a7cstl37.fsf@HIDDEN>
From: =?UTF-8?B?SmFyb3PFgmF3IFJ6ZXN6w7N0a28=?= <jrzeszotko@HIDDEN>
Date: Fri, 2 Aug 2019 07:08:21 +0200
Message-ID: <CAO_X8WDueszg2oN5JwEk0vYMy==xnp0oC5mf0_6ebc-oGmTWWg@HIDDEN>
Subject: Re: bug#36884: Default python mode with electric-indent-mode
 sometimes indents empty lines
To: Noam Postavsky <npostavs@HIDDEN>
Content-Type: multipart/alternative; boundary="00000000000086093e058f1b597d"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36884
Cc: 36884 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--00000000000086093e058f1b597d
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Perhaps this behavior exists because there can also be a situation like
this:

def test():
    print("test")
[cursor, on empty line in middle of indented block]
    print("test")

where what electric indent does after pressing RET (creates new line
aligned to the print statements) makes sense. I think it is mostly
irritating though, and editors I tested, Vim and Sublime Text, do not
automatically indent in any of the situations I mentioned.

FWIW this works as a workaround for me:

(setq electric-indent-functions
      '((lambda (inserted-char)
          (when (eq major-mode 'python-mode)
            ;; Do not auto-indent after inserting any empty line
            (when (save-excursion
                    (previous-line)
                    (beginning-of-line)
                    (looking-at "^\s*$"))
              'no-indent)))))

Cheers,
Jarek

On Fri, Aug 2, 2019 at 3:26 AM Noam Postavsky <npostavs@HIDDEN> wrote:

> Andreas R=C3=B6hler <andreas.roehler@HIDDEN> writes:
>
> > AFAIU electric-indent-mode doesn't run a timer, cursor position alone
> > would not trigger it.
>
> electric-indent-mode works from post-self-insert-hook.  Not sure how
> cursor position and timers are related.
>
>
>
>

--00000000000086093e058f1b597d
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div>Perhaps this behavior exists because=
 there can also be a situation like this:</div><div><br></div><div><div>def=
 test():</div><div>=C2=A0 =C2=A0 print(&quot;test&quot;)</div></div><div>[c=
ursor, on empty line in middle of indented block]</div><div><div><div>=C2=
=A0 =C2=A0 print(&quot;test&quot;)</div></div><div><br></div><div>where wha=
t electric indent does after pressing RET (creates new line aligned to the =
print statements)=C2=A0makes sense. I think it is mostly irritating though,=
 and editors I tested, Vim and Sublime Text, do not automatically indent in=
 any of the situations I mentioned.</div></div><div><br></div></div><div di=
r=3D"ltr">FWIW this works as a workaround for me:<div><br></div><div>(setq =
electric-indent-functions<br>=C2=A0 =C2=A0 =C2=A0 &#39;((lambda (inserted-c=
har)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (eq major-mode &#39;python=
-mode)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; Do not auto-indent a=
fter inserting any empty line<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
(when (save-excursion<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 (previous-line)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (beginning-of-line)<br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (looking-at &quot;^\s*=
$&quot;))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &#39;no-inden=
t)))))<br></div><div><br></div><div>Cheers,</div><div>Jarek</div></div><br>=
<div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Au=
g 2, 2019 at 3:26 AM Noam Postavsky &lt;<a href=3D"mailto:npostavs@HIDDEN=
m">npostavs@HIDDEN</a>&gt; wrote:<br></div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,20=
4);padding-left:1ex">Andreas R=C3=B6hler &lt;<a href=3D"mailto:andreas.roeh=
ler@HIDDEN" target=3D"_blank">andreas.roehler@HIDDEN</a>&gt; =
writes:<br>
<br>
&gt; AFAIU electric-indent-mode doesn&#39;t run a timer, cursor position al=
one<br>
&gt; would not trigger it.<br>
<br>
electric-indent-mode works from post-self-insert-hook.=C2=A0 Not sure how<b=
r>
cursor position and timers are related.<br>
<br>
<br>
<br>
</blockquote></div></div>

--00000000000086093e058f1b597d--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36884; Package emacs. Full text available.

Message received at 36884 <at> debbugs.gnu.org:


Received: (at 36884) by debbugs.gnu.org; 2 Aug 2019 01:25:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 01 21:25:25 2019
Received: from localhost ([127.0.0.1]:55657 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1htMJw-0005D8-Sp
	for submit <at> debbugs.gnu.org; Thu, 01 Aug 2019 21:25:25 -0400
Received: from mail-io1-f42.google.com ([209.85.166.42]:33031)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1htMJv-0005Ct-6C
 for 36884 <at> debbugs.gnu.org; Thu, 01 Aug 2019 21:25:23 -0400
Received: by mail-io1-f42.google.com with SMTP id z3so7499376iog.0
 for <36884 <at> debbugs.gnu.org>; Thu, 01 Aug 2019 18:25:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=6/PszUEi88Vm0gMUuL9D/3l8hNB7V6j0JTwjeT4VCCg=;
 b=eBwXi6TpqYlMDooh4kBFZt+KVKR/7g2Tn1demc2+iWoUDy7Qz+7dWdErn++4a65QUi
 5hV0EWTVuC2XstmAkmaX4l7ZDfHpJkF4GOfA/Vc+wXGwHtZxvqSq1tOhbZ8634kTBT1A
 Urbk2JcJAPH3/vsu60xZx1zffX397BNJpXZopcwGdu0NOySR+MrKE73WjeipHFO2fdCc
 reWdGUkjwwHLjyB33YaOxuHM7Za1ZdqYspPPbDAAkCDVMudlYuHQKnggEjJi0QUpKXnK
 JGyKdayqzs7kn8TpId61+nREEagM0BIqviLxpba3ztYq4iK2a/W41Ocn23mRRtURfVfp
 ps5Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=6/PszUEi88Vm0gMUuL9D/3l8hNB7V6j0JTwjeT4VCCg=;
 b=cZjFLAFodog1GymHvrg999vsUuLsgneQXNohTpX3AmJgTLQDmGBgVLqQNXWAbTpwAZ
 a+GuUnOzE6MChCXCTrpdTG0LhTF/TflSCu0QYi295vGUXuQ2TdVXZ6Ki4/cturpXEyMB
 jX+6KTjpX+1c6y5SeogF06CZ/Jj4jPl64mWYbEKAqd6qFbTc/dKDsGIlgLJt+4O6lfh6
 yZXG2XYs/i7qfPTVXp6dNRLjzwva6vLKIT3YxfUiyGutA2Dfy/PlUjtTXEA50t+bkuq8
 NrEgPC5MPrLxYqnnIep7fmHb5WpeN0vTtGJmdkbw+bUFeclrVRUgEf7dOepw8oNtzoYl
 2SoA==
X-Gm-Message-State: APjAAAW7O1dQEwVgXlWK5Nqea5ZZoQ5ZTazs8Tja7fFno9EFlPsdVsW1
 AzapM6wSXyAN/Sgf1yVdqAZX8+FE
X-Google-Smtp-Source: APXvYqzUCcZw+w0LHRGlMY/J8w3/1Rzy9PMyRiSoFFb+QgDHMyv3rBTiGizqXdx/JDoZuDH0LhEC7g==
X-Received: by 2002:a5e:d51a:: with SMTP id e26mr115976013iom.71.1564709117473; 
 Thu, 01 Aug 2019 18:25:17 -0700 (PDT)
Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.gmail.com with ESMTPSA id
 h18sm57513734iob.80.2019.08.01.18.25.16
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 01 Aug 2019 18:25:17 -0700 (PDT)
From: Noam Postavsky <npostavs@HIDDEN>
To: Andreas =?utf-8?Q?R=C3=B6hler?= <andreas.roehler@HIDDEN>
Subject: Re: bug#36884: Default python mode with electric-indent-mode
 sometimes indents empty lines
References: <CAO_X8WByiRv9TQWC0vWRROeVdjV+LQu-F4PmSu+B4rdppW-=vg@HIDDEN>
 <88e5aea8-cee3-993c-8b8e-b7651f48459d@HIDDEN>
Date: Thu, 01 Aug 2019 21:25:16 -0400
In-Reply-To: <88e5aea8-cee3-993c-8b8e-b7651f48459d@HIDDEN> ("Andreas
 \=\?utf-8\?Q\?R\=C3\=B6hler\=22's\?\= message of "Thu,
 1 Aug 2019 09:56:53 +0200")
Message-ID: <87a7cstl37.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36884
Cc: 36884 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Andreas R=C3=B6hler <andreas.roehler@HIDDEN> writes:

> AFAIU electric-indent-mode doesn't run a timer, cursor position alone
> would not trigger it.

electric-indent-mode works from post-self-insert-hook.  Not sure how
cursor position and timers are related.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36884; Package emacs. Full text available.

Message received at 36884 <at> debbugs.gnu.org:


Received: (at 36884) by debbugs.gnu.org; 1 Aug 2019 08:52:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 01 04:52:11 2019
Received: from localhost ([127.0.0.1]:53455 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ht6ok-0000L0-NR
	for submit <at> debbugs.gnu.org; Thu, 01 Aug 2019 04:52:11 -0400
Received: from mail-io1-f67.google.com ([209.85.166.67]:36634)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jrzeszotko@HIDDEN>) id 1ht6oi-0000Kl-I9
 for 36884 <at> debbugs.gnu.org; Thu, 01 Aug 2019 04:52:09 -0400
Received: by mail-io1-f67.google.com with SMTP id o9so39013582iom.3
 for <36884 <at> debbugs.gnu.org>; Thu, 01 Aug 2019 01:52:08 -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=x9TL7o7WxjefsfpCBeZfnzmLi2ftmm9lnNlAbL1A5rU=;
 b=uJ8+F1UWuRZ/g0jejPO3t6fIc9oHKPJuvO89FZegv2ipICQr/HdtTxm6HYMb5veZZ3
 cqiyFd+qxB3VrBW73/MbybfYsR7tTHtIVMXqXHXByonY26XxyX89F6ZO8ayz3WPaozE8
 4jvIVeW5Yf6Mo1s6UCTpMKqxgM2DvM8kdL3ymcAx8Vp8WgiLjdHT+TA0D/wxUaL+VSIA
 YyP/U1mPR5yHo269Hz6BDetwHnhWWHBbL3UvCuVbcjFBEdxKebI80t+p1+BKtQJG6Kuy
 shV+eC3KTjK4VDVAz+qpyVNqPB6jWlVjXsxVYDUc+G0wvO4w91HJ5NLoSF/8x9WinlU8
 wCfg==
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=x9TL7o7WxjefsfpCBeZfnzmLi2ftmm9lnNlAbL1A5rU=;
 b=ZXr10FkL0No1GCw4oogop+nk/L6HTCpXZRU57C+4tIhiVIZlsbBnaZL15gO6nGtVNz
 JA/GzDo0Zf9O534L0NyG0EKod5tsclXJfvH6O0GB9X7brIxAR4edmrUCFGI/q1DgplIU
 T6wccYaboNLxvrq6cg6ZLsqSqbmS/cTjE0XzYGwQeWKExhoMyWn2QFr8Io3JOWcrUddG
 pnscEEiiVo1tonpZF6YizD8eVQyD67kQ2DfrBfxM4WjAzoAbKdeD9r7KQ8Hjv4e7O+e1
 fOLnnubZEdHS3cxuKwnYPxSSwjKuiTQTjnpN/I9HsGk4Y9D+yDXNi9LiK001N7tLPyuU
 SFnw==
X-Gm-Message-State: APjAAAXW3/C2fNEATOVvsXt3uC0dWVfwz40Xj7HNeAYs/uENLh7ypwoF
 FLHkZ35PD9FopdTUPzKt+a7XqZ4djjPZuViFtYp7zfXO
X-Google-Smtp-Source: APXvYqxsCzPxtZTSD4M6uOGMdNffu/irzi4bY9U2VotOWq9IjclXkx81fwHvTrWykufannqMHo+yeOGqGeTMM5f+7TY=
X-Received: by 2002:a02:c549:: with SMTP id g9mr12706872jaj.14.1564649522637; 
 Thu, 01 Aug 2019 01:52:02 -0700 (PDT)
MIME-Version: 1.0
References: <CAO_X8WByiRv9TQWC0vWRROeVdjV+LQu-F4PmSu+B4rdppW-=vg@HIDDEN>
 <88e5aea8-cee3-993c-8b8e-b7651f48459d@HIDDEN>
In-Reply-To: <88e5aea8-cee3-993c-8b8e-b7651f48459d@HIDDEN>
From: =?UTF-8?B?SmFyb3PFgmF3IFJ6ZXN6w7N0a28=?= <jrzeszotko@HIDDEN>
Date: Thu, 1 Aug 2019 10:51:51 +0200
Message-ID: <CAO_X8WBEe+sJdy9i1UhDZJXEgrCOed4A31cjtL1yx1ArqROpQg@HIDDEN>
Subject: Re: bug#36884: Default python mode with electric-indent-mode
 sometimes indents empty lines
To: =?UTF-8?Q?Andreas_R=C3=B6hler?= <andreas.roehler@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000feb1b3058f0a5ae2"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36884
Cc: 36884 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000feb1b3058f0a5ae2
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

M-x about-emacs shows:
GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.4) of
2019-02-03, modified by Debian

C-h k [RET] shows that it is bound to the "newline" function. I get the
same behavior with --no-init.

Cheers,
Jarek

On Thu, Aug 1, 2019 at 9:55 AM Andreas R=C3=B6hler <andreas.roehler@easy-em=
acs.de>
wrote:

>
> On 01.08.19 09:06, Jaros=C5=82aw Rzesz=C3=B3tko wrote:
> > When pressing enter with the cursor like this:
> >
> > def test():
> >     print("test")
> > [cursor]
> >
> > Emacs (26.1) correctly just inserts a blank line. However, with this:
> >
> > def test():
> >     if True:
> >           print("test")
> > [cursor]
> >
> > Emacs inserts a blank line and indents it one level. With this:
> >
> > def test():
> >     if True:
> >         if False:
> >               print("test")
> > [cursor]
> >
> > it inserts a blank line and indents it two levels, etc. Moreover, with
> > two methods like this:
> >
> > def test1():
> >     if True:
> >           print("test")
> >
> > [cursor]def test2():
> >     if True:
> >           print("test")
> >
> > pressing enter will also indent the def block, instead of just
> > inserting the empty line.
>
>
> Hi Jaros=C5=82aw,
>
> python-mode.el developer here, just being interested.
>
> AFAIU electric-indent-mode doesn't run a timer, cursor position alone
> would not trigger it.
>
> Assume there is a command used from pos. Which? BTW the key alone
> doesn't tell enough, as RET and C-j changed binding recently. Reporting
> Emacs version will be useful.
>
> Thanks,
>
> Andreas
>
>
>
>
>

--000000000000feb1b3058f0a5ae2
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">M-x about-emacs shows:<div>GNU Emacs 26.1 (build 2, x86_64=
-pc-linux-gnu, GTK+ Version 3.24.4)=C2=A0of 2019-02-03, modified by Debian<=
br></div><div><br></div><div>C-h k [RET] shows that it is bound to the &quo=
t;newline&quot; function. I get the same behavior with --no-init.</div><div=
><br></div><div>Cheers,</div><div>Jarek</div></div><br><div class=3D"gmail_=
quote"><div dir=3D"ltr" class=3D"gmail_attr">On Thu, Aug 1, 2019 at 9:55 AM=
 Andreas R=C3=B6hler &lt;<a href=3D"mailto:andreas.roehler@HIDDEN">a=
ndreas.roehler@HIDDEN</a>&gt; wrote:<br></div><blockquote class=3D"g=
mail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204=
,204,204);padding-left:1ex"><br>
On 01.08.19 09:06, Jaros=C5=82aw Rzesz=C3=B3tko wrote:<br>
&gt; When pressing enter with the cursor like this:<br>
&gt;<br>
&gt; def test():<br>
&gt; =C2=A0 =C2=A0 print(&quot;test&quot;)<br>
&gt; [cursor]<br>
&gt;<br>
&gt; Emacs (26.1) correctly just inserts a blank line. However, with this:<=
br>
&gt;<br>
&gt; def test():<br>
&gt; =C2=A0 =C2=A0 if True:<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print(&quot;test&quot;)<br>
&gt; [cursor]<br>
&gt;<br>
&gt; Emacs inserts a blank line and indents it one level. With this:<br>
&gt;<br>
&gt; def test():<br>
&gt; =C2=A0 =C2=A0 if True:<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 if False:<br>
&gt; =C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print(&quot;test=
&quot;)<br>
&gt; [cursor]<br>
&gt;<br>
&gt; it inserts a blank line and indents it two levels, etc. Moreover, with=
 <br>
&gt; two methods like this:<br>
&gt;<br>
&gt; def test1():<br>
&gt; =C2=A0 =C2=A0 if True:<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print(&quot;test&quot;)<br>
&gt;<br>
&gt; [cursor]def test2():<br>
&gt; =C2=A0 =C2=A0 if True:<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print(&quot;test&quot;)<br>
&gt;<br>
&gt; pressing enter will also indent the def block, instead of just <br>
&gt; inserting the empty line.<br>
<br>
<br>
Hi Jaros=C5=82aw,<br>
<br>
python-mode.el developer here, just being interested.<br>
<br>
AFAIU electric-indent-mode doesn&#39;t run a timer, cursor position alone <=
br>
would not trigger it.<br>
<br>
Assume there is a command used from pos. Which? BTW the key alone <br>
doesn&#39;t tell enough, as RET and C-j changed binding recently. Reporting=
 <br>
Emacs version will be useful.<br>
<br>
Thanks,<br>
<br>
Andreas<br>
<br>
<br>
<br>
<br>
</blockquote></div>

--000000000000feb1b3058f0a5ae2--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36884; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Aug 2019 07:54:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 01 03:54:45 2019
Received: from localhost ([127.0.0.1]:53419 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ht5vB-0007QH-H5
	for submit <at> debbugs.gnu.org; Thu, 01 Aug 2019 03:54:45 -0400
Received: from lists.gnu.org ([209.51.188.17]:45843)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <andreas.roehler@HIDDEN>) id 1ht5v8-0007Q8-W7
 for submit <at> debbugs.gnu.org; Thu, 01 Aug 2019 03:54:43 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:45947)
 by lists.gnu.org with esmtp (Exim 4.86_2)
 (envelope-from <andreas.roehler@HIDDEN>) id 1ht5v7-0005hp-VS
 for bug-gnu-emacs@HIDDEN; Thu, 01 Aug 2019 03:54:42 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_NONE
 autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <andreas.roehler@HIDDEN>) id 1ht5v7-0007ms-22
 for bug-gnu-emacs@HIDDEN; Thu, 01 Aug 2019 03:54:41 -0400
Received: from mout.kundenserver.de ([212.227.126.134]:50233)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <andreas.roehler@HIDDEN>)
 id 1ht5v6-0007m5-Pl
 for bug-gnu-emacs@HIDDEN; Thu, 01 Aug 2019 03:54:41 -0400
Received: from [192.168.178.39] ([87.123.193.228]) by mrelayeu.kundenserver.de
 (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id
 1M2Plu-1hvq0T0nok-003vzA for <bug-gnu-emacs@HIDDEN>; Thu, 01 Aug 2019
 09:54:35 +0200
Subject: Re: bug#36884: Default python mode with electric-indent-mode
 sometimes indents empty lines
To: bug-gnu-emacs@HIDDEN
References: <CAO_X8WByiRv9TQWC0vWRROeVdjV+LQu-F4PmSu+B4rdppW-=vg@HIDDEN>
From: =?UTF-8?Q?Andreas_R=c3=b6hler?= <andreas.roehler@HIDDEN>
Message-ID: <88e5aea8-cee3-993c-8b8e-b7651f48459d@HIDDEN>
Date: Thu, 1 Aug 2019 09:56:53 +0200
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:60.0) Gecko/20100101
 Thunderbird/60.7.2
MIME-Version: 1.0
In-Reply-To: <CAO_X8WByiRv9TQWC0vWRROeVdjV+LQu-F4PmSu+B4rdppW-=vg@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-US
X-Provags-ID: V03:K1:zYBVpz+E39sOz+ZJ0jTcuIZCB9/VHa7fTWXQFNWv94r8UPLeyHd
 SwnFI8xDR2dVuh+KAVaQl5QbSLNPtY+Uw/unoTmiiLi7DenctwTzECi/TEVxYYDwCFs1X74
 ZtErVEFBMRmEDRsrdxK84OHzmCuDqe8ANJo3Gj1M9kQRyHKUsvb7Eugrj/0DVpPXikmp1xo
 b3YzPr0xxchCKg4s8w1cA==
X-UI-Out-Filterresults: notjunk:1;V03:K0:xmQgzFpXyeQ=:3zW5mNpsScYo2FSt4VPgEw
 Xp+9dEAWkB2Hxy0vLesYVp71rneZQ0HdF63+73nYuM/JQGM/UF3Bu5wrtv3By7g2ayjmKMxnn
 lyYegizKHF+KpDnQjhhKw1/8pC1SvCyP1ZyCcCKjVWQJTLKV1pQ9Jx0oIYfwOW+gUWwaucrgy
 rnPQTVA+xeXhaEm3oybn5zZ0Ax3eoS4KLzn05L3QH5NMXunoj2My0Qj91eiSkysYdA20xSGdF
 CjOqdVPjTY5suY1/rEAJTgFRPk3gULtbfKpqpIHyNhPcC5Lfs6Gd2mfPVWXIquyRXEz77SGjG
 gOIixYkEbh5gKeuhwFokuPF9gNGUtd2j2B+pgKMFXJVvnkY0OTAqhR92egDRskEQkHkbDSa/+
 ltkTqyFL+Jj4HGYmY5mPHSYDecUpixQ8T1d52tDQkFFeHx+lngDGB9epTJY0lUsfBaisEPgNx
 aQFRGWbvngAt2TdZgnXEcVx4zGtxqUGyBV1jsbJlJiO97vw823ZH9MccMtswHtlRt9TCmpgmm
 8rKRI904xAVx/CctfABJtlFcJ/JL34lKiPzVY6GHeN1vSKPnVVEpyjc9xCx9BjxeVG6SmIJ+b
 5I3uCGszKuP+wck4Mgf5qD3WSFEbxBE7uzwkkdlBT3ctp1Boipxtb78kNHF7ZZAMVbRVuzeVm
 JEgteeAv4lRd6XUbRpmAg7xWr/XdQqfRpee1OXITV2629igW06QJxzp3a1DN4DpqQN/03U3sk
 zUkMTxPE2T2Jg6RXWUi99mZJV5OICYc9D2jhfeoRe9pwybRyiiAMSpNC/XxxKF33nyUPuKF8W
 RSnQK2W
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 212.227.126.134
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)


On 01.08.19 09:06, Jarosław Rzeszótko wrote:
> When pressing enter with the cursor like this:
>
> def test():
>     print("test")
> [cursor]
>
> Emacs (26.1) correctly just inserts a blank line. However, with this:
>
> def test():
>     if True:
>           print("test")
> [cursor]
>
> Emacs inserts a blank line and indents it one level. With this:
>
> def test():
>     if True:
>         if False:
>               print("test")
> [cursor]
>
> it inserts a blank line and indents it two levels, etc. Moreover, with 
> two methods like this:
>
> def test1():
>     if True:
>           print("test")
>
> [cursor]def test2():
>     if True:
>           print("test")
>
> pressing enter will also indent the def block, instead of just 
> inserting the empty line.


Hi Jarosław,

python-mode.el developer here, just being interested.

AFAIU electric-indent-mode doesn't run a timer, cursor position alone 
would not trigger it.

Assume there is a command used from pos. Which? BTW the key alone 
doesn't tell enough, as RET and C-j changed binding recently. Reporting 
Emacs version will be useful.

Thanks,

Andreas





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36884; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Aug 2019 07:06:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 01 03:06:46 2019
Received: from localhost ([127.0.0.1]:53405 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ht5Aj-0006L4-Ln
	for submit <at> debbugs.gnu.org; Thu, 01 Aug 2019 03:06:45 -0400
Received: from lists.gnu.org ([209.51.188.17]:42751)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jrzeszotko@HIDDEN>) id 1ht5Ah-0006Kx-Hb
 for submit <at> debbugs.gnu.org; Thu, 01 Aug 2019 03:06:43 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:37390)
 by lists.gnu.org with esmtp (Exim 4.86_2)
 (envelope-from <jrzeszotko@HIDDEN>) id 1ht5Ag-0006Q1-Gt
 for bug-gnu-emacs@HIDDEN; Thu, 01 Aug 2019 03:06:43 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 FROM_EXCESS_BASE64,HTML_MESSAGE autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <jrzeszotko@HIDDEN>) id 1ht5Af-0000uO-Ib
 for bug-gnu-emacs@HIDDEN; Thu, 01 Aug 2019 03:06:42 -0400
Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]:43932)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <jrzeszotko@HIDDEN>)
 id 1ht5Af-0000tn-Dw
 for bug-gnu-emacs@HIDDEN; Thu, 01 Aug 2019 03:06:41 -0400
Received: by mail-io1-xd33.google.com with SMTP id k20so142026442ios.10
 for <bug-gnu-emacs@HIDDEN>; Thu, 01 Aug 2019 00:06:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:from:date:message-id:subject:to;
 bh=YgNVegd/OWoNW9rSHevUe1jcA4cYcc/b1+u6m3KyW78=;
 b=bePww8yt0Q8MEZIXW9QSaifKLc2aRS32JYY0UrmwqZfGSt4M3IRobVoQZhMFy6RTmR
 lxJ+MmP4UzN2EleflVi6fRxypjURP3JlkDT/Q8g0dvJrNih5hnzqT/fKZm6ip7d0kUVF
 0sAZKQ568oM5+rUGpDxteMExyiSf7woXChncnqjuIkMxK7iGp760UpR37jIWmFXiNgR8
 p9y3r9KdWRAoPplMhu3fjra7DebMMTCcQD063g22HLE9Fbc+o77ptBxIBm7ypLs7PFwp
 LU453BpYmHrLPWd3Tyl20lBTlYoPI4LKt2ioaqGzpafma1vqchbXxnzi5l5g93Y49rht
 gKOQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=YgNVegd/OWoNW9rSHevUe1jcA4cYcc/b1+u6m3KyW78=;
 b=QW4ZOfzA2CO3MFywlZZFpq4X6ynoF3IW1MCvvkumpHn43eFTbJipN1HklGop4lPKYL
 FOql0AJ6oDOBVbwxPEBI/eL5ZwaJmPRYZoxf9oRopsLtRpMgP0T3iQK0BsqyCQAR296q
 oPk0UOZtqCEoRcSgVNhXOa1wCj++9S4EE3C/bW0yHnDNQZ8wvQa2+0DH31KrDH9O7VVI
 /vht0eLiL0hW4irKILIfQEwNssIhNAR91J2j8ceqcpr2IPnduHlOgcceu/VkZ1XHSnt/
 lLloBef3qD0Vq7b/pF7jmhI2AFOKNzWVjfFMX414zaHmtOZyVhsgfn1/IfYuLx5zC/HH
 Qh2g==
X-Gm-Message-State: APjAAAWH/9yX6KrQ3Kz3aMSe1Svut3AbhTYoPjS2oAWQFV2Zx3396c2E
 lUi2Py4+1ZWbUgPv2pKCVnmcDyM+oi8uFlohBScLaCw1
X-Google-Smtp-Source: APXvYqxqbZvX8L4IfZ4XNdGNAuvTuGBPSMXUg9VgtnK+fn1iRGWlnGJck/0mcLORAeVcx4h/DbKjzjckmHex81kA514=
X-Received: by 2002:a6b:f216:: with SMTP id q22mr76327921ioh.65.1564643199977; 
 Thu, 01 Aug 2019 00:06:39 -0700 (PDT)
MIME-Version: 1.0
From: =?UTF-8?B?SmFyb3PFgmF3IFJ6ZXN6w7N0a28=?= <jrzeszotko@HIDDEN>
Date: Thu, 1 Aug 2019 09:06:29 +0200
Message-ID: <CAO_X8WByiRv9TQWC0vWRROeVdjV+LQu-F4PmSu+B4rdppW-=vg@HIDDEN>
Subject: Default python mode with electric-indent-mode sometimes indents empty
 lines
To: "bug-gnu-emacs@HIDDEN" <bug-gnu-emacs@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000228e00058f08e2a1"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2607:f8b0:4864:20::d33
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--000000000000228e00058f08e2a1
Content-Type: text/plain; charset="UTF-8"

When pressing enter with the cursor like this:

def test():
    print("test")
[cursor]

Emacs (26.1) correctly just inserts a blank line. However, with this:

def test():
    if True:
          print("test")
[cursor]

Emacs inserts a blank line and indents it one level. With this:

def test():
    if True:
        if False:
              print("test")
[cursor]

it inserts a blank line and indents it two levels, etc. Moreover, with two
methods like this:

def test1():
    if True:
          print("test")

[cursor]def test2():
    if True:
          print("test")

pressing enter will also indent the def block, instead of just inserting
the empty line.

--000000000000228e00058f08e2a1
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">When pressing enter with the cursor like this:<div><br></d=
iv><div>def test():</div><div>=C2=A0 =C2=A0 print(&quot;test&quot;)</div><d=
iv>[cursor]</div><div><br></div><div>Emacs (26.1) correctly just inserts a =
blank line. However, with this:</div><div><br></div><div><div>def test():</=
div><div>=C2=A0 =C2=A0 if True:</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 print(&quot;test&quot;)</div><div>[cursor]</div><div><br></div></div><d=
iv>Emacs inserts a blank line and indents it one level. With this:</div><di=
v><br></div><div><div>def test():</div><div>=C2=A0 =C2=A0 if True:</div><di=
v>=C2=A0 =C2=A0 =C2=A0 =C2=A0 if False:<br></div><div>=C2=A0 =C2=A0=C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print(&quot;test&quot;)</div><div>[curso=
r]</div></div><div><br></div><div>it inserts a blank line and indents it tw=
o levels, etc. Moreover, with two methods like this:</div><div><br></div><d=
iv><div>def test1():</div><div>=C2=A0 =C2=A0 if True:</div><div>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 print(&quot;test&quot;)</div><div><br></div><div>[=
cursor]def test2():</div><div>=C2=A0 =C2=A0 if True:</div><div>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 print(&quot;test&quot;)</div></div><div><br></div>=
<div>pressing enter will also indent the def block, instead of just inserti=
ng the empty line.=C2=A0</div></div>

--000000000000228e00058f08e2a1--




Acknowledgement sent to Jarosław Rzeszótko <jrzeszotko@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#36884; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.