From unknown Sun Jun 22 00:26:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13888: patch for python indentation Resent-From: Aaron Ecay Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Mar 2013 07:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13888 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 13888@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.136255412819366 (code B ref -1); Wed, 06 Mar 2013 07:16:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Mar 2013 07:15:28 +0000 Received: from localhost ([127.0.0.1]:33502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UD8ZT-00052J-JQ for submit@debbugs.gnu.org; Wed, 06 Mar 2013 02:15:28 -0500 Received: from eggs.gnu.org ([208.118.235.92]:43525) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UD8ZQ-000520-6w for submit@debbugs.gnu.org; Wed, 06 Mar 2013 02:15:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UD8Yv-0006vU-7a for submit@debbugs.gnu.org; Wed, 06 Mar 2013 02:14:54 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-102.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:56278) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UD8Yv-0006vN-53 for submit@debbugs.gnu.org; Wed, 06 Mar 2013 02:14:53 -0500 Received: from eggs.gnu.org ([208.118.235.92]:54867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UD8Yt-0005DJ-Ni for bug-gnu-emacs@gnu.org; Wed, 06 Mar 2013 02:14:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UD8Ys-0006rz-Ad for bug-gnu-emacs@gnu.org; Wed, 06 Mar 2013 02:14:51 -0500 Received: from mail-qe0-f53.google.com ([209.85.128.53]:57951) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UD8Ys-0006rl-60 for bug-gnu-emacs@gnu.org; Wed, 06 Mar 2013 02:14:50 -0500 Received: by mail-qe0-f53.google.com with SMTP id cz11so5112580qeb.40 for ; Tue, 05 Mar 2013 23:14:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:user-agent:date:message-id:mime-version :content-type; bh=jMFP6OuMqzSb53Sk0yy1pbSRQ5aVmNF2kqXOvhye0Wg=; b=oIU7QlpoEShFZPnMWJ4rMGDyI5PZkgRrd70NuBSQMc3MX2Z/OaEYJmngkZp8EfVcAu HnHZHE4NiM+Gz3siV++pjw2Te5tboeQDXb4mDpXI5G5jn5eAxNhoMpTCe+QmfjgGJSju V3LBpt7lVEvxwRPiARDLeV0/g9z76vqG/3rkiBkeDkngTAcRUJaMwy3e7RBToEAmhrXb 3re4JYyFAWMlUiuKw8hx6htPCYIFmPb1nzZUnPn/2mwzfWDcO2uvGc/biO9TQU3Wj2OI Fm1UjGuAOXovgEIrz49MM8x9EpIvDoMA8tX/ZQBpr41HfE0GsugibRXlJud1ghihpbGv xbnQ== X-Received: by 10.224.179.133 with SMTP id bq5mr16169336qab.9.1362554089606; Tue, 05 Mar 2013 23:14:49 -0800 (PST) Received: from localhost (c-68-80-94-73.hsd1.pa.comcast.net. [68.80.94.73]) by mx.google.com with ESMTPS id o5sm47283212qao.12.2013.03.05.23.14.48 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 05 Mar 2013 23:14:49 -0800 (PST) From: Aaron Ecay User-Agent: Notmuch/0.15.2+43~ge848af8 (http://notmuchmail.org) Emacs/24.3.50.1 (x86_64-unknown-linux-gnu) Date: Wed, 06 Mar 2013 02:14:48 -0500 Message-ID: <878v61kniv.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -3.4 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable A previous version of emacs=E2=80=99 python-mode would unindent the line af= ter a pass or retrun keyword, which end the current block. The current version does not do so. The attached patch restores this behavior. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Improve-python-indentation-after-return-or-pass.patch >From f695ce5ade65d3be0c34ec74443bb65f8cfa688b Mon Sep 17 00:00:00 2001 From: Aaron Ecay Date: Wed, 6 Mar 2013 01:33:48 -0500 Subject: [PATCH] Improve python indentation after return or pass * progmodes/python.el (python-indent-calculate-indentation): Unindent after a return or pass keyword on the previous line. --- lisp/ChangeLog | 5 +++++ lisp/progmodes/python.el | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 88b9992..1cd9dc2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-03-06 Aaron Ecay + + * progmodes/python.el (python-indent-calculate-indentation): + Unindent after a return or pass keyword on the previous line. + 2013-03-05 Michael Albinus * net/tramp-compat.el (tramp-compat-delete-directory): Implement diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index f0f67d0..6102490 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -763,9 +763,15 @@ START is the buffer position where the sexp starts." (save-excursion (goto-char context-start) (current-indentation)) - (if (progn - (back-to-indentation) - (looking-at (regexp-opt python-indent-dedenters))) + (if (or (progn + (back-to-indentation) + (looking-at (regexp-opt python-indent-dedenters))) + (progn + (back-to-indentation) + (skip-chars-backward (rx (or whitespace ?\n))) + (back-to-indentation) + (looking-at (rx (or "pass" "return") + (or " " "\n"))))) python-indent-offset 0))) ;; When inside of a string, do nothing. just use the current -- 1.8.1.5 --=-=-= Content-Type: text/plain -- Aaron Ecay --=-=-=-- From unknown Sun Jun 22 00:26:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13888: patch for python indentation Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Mar 2013 22:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13888 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: =?UTF-8?Q?Fabi=C3=A1n?= Ezequiel Gallina Cc: 13888@debbugs.gnu.org Received: via spool by 13888-submit@debbugs.gnu.org id=B13888.136355920421838 (code B ref 13888); Sun, 17 Mar 2013 22:27:02 +0000 Received: (at 13888) by debbugs.gnu.org; 17 Mar 2013 22:26:44 +0000 Received: from localhost ([127.0.0.1]:60387 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UHM2L-0005g7-6S for submit@debbugs.gnu.org; Sun, 17 Mar 2013 18:26:43 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:15005) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UHM2K-0005fv-3z for 13888@debbugs.gnu.org; Sun, 17 Mar 2013 18:26:40 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgEFABK/CFFFpYZL/2dsb2JhbABEhke4Rxdzgh4BAQQBIzMjBQsLEQMBAgMCGA4CAhQNCw0WDhOHfwMJBq5fiGwNiVWBI4pvg2WBEwOUN40PgzSBXoMT X-IPAS-Result: AgEFABK/CFFFpYZL/2dsb2JhbABEhke4Rxdzgh4BAQQBIzMjBQsLEQMBAgMCGA4CAhQNCw0WDhOHfwMJBq5fiGwNiVWBI4pvg2WBEwOUN40PgzSBXoMT X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="5114472" Received: from 69-165-134-75.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([69.165.134.75]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 17 Mar 2013 18:25:02 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 366F6AE1BB; Sun, 17 Mar 2013 18:25:04 -0400 (EDT) From: Stefan Monnier Message-ID: References: <878v61kniv.fsf@gmail.com> Date: Sun, 17 Mar 2013 18:25:04 -0400 In-Reply-To: <878v61kniv.fsf@gmail.com> (Aaron Ecay's message of "Wed, 06 Mar 2013 02:14:48 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > A previous version of emacs=E2=80=99 python-mode would unindent the line = after a > pass or retrun keyword, which end the current block. The current > version does not do so. The attached patch restores this behavior. Fabi=C3=A1n, podr=C3=ADas mirar eso, por favor? Stefan >> From f695ce5ade65d3be0c34ec74443bb65f8cfa688b Mon Sep 17 00:00:00 2001 > From: Aaron Ecay > Date: Wed, 6 Mar 2013 01:33:48 -0500 > Subject: [PATCH] Improve python indentation after return or pass > * progmodes/python.el (python-indent-calculate-indentation): Unindent > after a return or pass keyword on the previous line. > --- > lisp/ChangeLog | 5 +++++ > lisp/progmodes/python.el | 12 +++++++++--- > 2 files changed, 14 insertions(+), 3 deletions(-) > diff --git a/lisp/ChangeLog b/lisp/ChangeLog > index 88b9992..1cd9dc2 100644 > --- a/lisp/ChangeLog > +++ b/lisp/ChangeLog > @@ -1,3 +1,8 @@ > +2013-03-06 Aaron Ecay > + > + * progmodes/python.el (python-indent-calculate-indentation): > + Unindent after a return or pass keyword on the previous line. > + > 2013-03-05 Michael Albinus =20 > * net/tramp-compat.el (tramp-compat-delete-directory): Implement > diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el > index f0f67d0..6102490 100644 > --- a/lisp/progmodes/python.el > +++ b/lisp/progmodes/python.el > @@ -763,9 +763,15 @@ START is the buffer position where the sexp starts." > (save-excursion > (goto-char context-start) > (current-indentation)) > - (if (progn > - (back-to-indentation) > - (looking-at (regexp-opt python-indent-dedenters))) > + (if (or (progn > + (back-to-indentation) > + (looking-at (regexp-opt python-indent-dedenters))) > + (progn > + (back-to-indentation) > + (skip-chars-backward (rx (or whitespace ?\n))) > + (back-to-indentation) > + (looking-at (rx (or "pass" "return") > + (or " " "\n"))))) > python-indent-offset > 0))) > ;; When inside of a string, do nothing. just use the current > --=20 > 1.8.1.5 > --=20 > Aaron Ecay From unknown Sun Jun 22 00:26:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13888: References: <878v61kniv.fsf@gmail.com> In-Reply-To: <878v61kniv.fsf@gmail.com> Resent-From: Fabian Ezequiel Gallina Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Mar 2013 17:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13888 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 13888@debbugs.gnu.org Received: via spool by 13888-submit@debbugs.gnu.org id=B13888.136475030618900 (code B ref 13888); Sun, 31 Mar 2013 17:19:01 +0000 Received: (at 13888) by debbugs.gnu.org; 31 Mar 2013 17:18:26 +0000 From: Fabian Ezequiel Gallina Date: Mon, 25 Mar 2013 23:10:36 -0300 Message-Id: <874nfysyg3.fsf@gnu.org> User-agent: mu4e 0.9.9.5-dev6; emacs 24.3.1 I just pushed a fix for this in revno 111338. From unknown Sun Jun 22 00:26:04 2025 Received: (at control) by debbugs.gnu.org; 31 Mar 2013 17:18:26 +0000 From: Fabian Ezequiel Gallina Subject: To: "GNU bug tracker automated control server" Message-Id: <8738visy05.fsf@gnu.org> X-Debbugs-Envelope-To: control Date: Mon, 25 Mar 2013 23:20:10 -0300 User-agent: mu4e 0.9.9.5-dev6; emacs 24.3.1 tags 13888 +fixed close 13888