From: Carlos Pita <carlosjosepita@gmail.com>
To: 37726@debbugs.gnu.org
Cc: Noam Postavsky <npostavs@gmail.com>
Subject: bug#37726:
Date: Sat, 19 Oct 2019 05:32:03 -0300 [thread overview]
Message-ID: <CAELgYhdUR1AOz+QEEtR1zK9NiE7MeDHfqjUEkX0S6Hb3BXJbCg@mail.gmail.com> (raw)
In-Reply-To: <CAELgYhf=tB6cr5h5y_ncGyer5n6oXCYzxpb9oaTFOsO_DkctNw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 90 bytes --]
This new patch:
* Removes accidentally introduced blank line.
* Improves commit message.
[-- Attachment #2: 0001-Indent-python-multiline-strings-to-start-and-previou.patch --]
[-- Type: text/x-patch, Size: 2257 bytes --]
From 7f43abe32bb553a20cf342ae9ab67becbf947fb2 Mon Sep 17 00:00:00 2001
From: memeplex <carlosjosepita@gmail.com>
Date: Sat, 12 Oct 2019 17:04:01 -0300
Subject: [PATCH] Indent python multiline strings to start and previous levels
(Bug#37726)
* progmodes/python.el (python-indent--calculate-indentation): Add an
additional indentation point to match indentation of previous line in
a multiline string. Then Tab iterates between 0, the start indentation
level and the previous line level.
---
lisp/progmodes/python.el | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 8f82353280..ef812f11c9 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1069,11 +1069,18 @@ python-indent--calculate-indentation
(`(:no-indent . ,_) (prog-first-column)) ; usually 0
(`(,(or :after-line
:after-comment
- :inside-string
:after-backslash) . ,start)
;; Copy previous indentation.
(goto-char start)
(current-indentation))
+ (`(,(or :inside-string
+ :inside-docstring) . ,start)
+ ;; Copy previous indentation inside string
+ (let ((prev (progn (forward-line -1)
+ (current-indentation)))
+ (base (progn (goto-char start)
+ (current-column))))
+ (sort (delete-dups (list 0 prev base)) #'<)))
(`(,(or :inside-paren-at-closing-paren
:inside-paren-at-closing-nested-paren) . ,start)
(goto-char (+ 1 start))
@@ -1082,12 +1089,6 @@ python-indent--calculate-indentation
(current-indentation)
;; Align with opening paren.
(current-column)))
- (`(:inside-docstring . ,start)
- (let* ((line-indentation (current-indentation))
- (base-indent (progn
- (goto-char start)
- (current-indentation))))
- (max line-indentation base-indent)))
(`(,(or :after-block-start
:after-backslash-first-line
:after-backslash-assignment-continuation
--
2.20.1
next prev parent reply other threads:[~2019-10-19 8:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-13 4:29 bug#37726: [PATCH] Indent python multiline strings to start and previous levels Carlos Pita
2019-10-13 5:04 ` bug#37726: Carlos Pita
2019-10-13 18:35 ` bug#37726: Carlos Pita
2019-10-13 19:06 ` bug#37726: Carlos Pita
2019-10-19 8:32 ` Carlos Pita [this message]
2019-10-23 0:25 ` bug#37726: [PATCH] Indent python multiline strings to start and previous levels Noam Postavsky
2020-08-09 18:46 ` bug#37726: Lars Ingebrigtsen
2020-08-09 21:44 ` bug#37726: Glenn Morris
2020-08-09 21:50 ` bug#37726: Lars Ingebrigtsen
2020-08-09 21:54 ` bug#37726: Lars Ingebrigtsen
2020-10-13 3:56 ` bug#37726: Lars Ingebrigtsen
2019-10-23 0:34 ` bug#37726: [PATCH] Indent python multiline strings to start and previous levels Noam Postavsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAELgYhdUR1AOz+QEEtR1zK9NiE7MeDHfqjUEkX0S6Hb3BXJbCg@mail.gmail.com \
--to=carlosjosepita@gmail.com \
--cc=37726@debbugs.gnu.org \
--cc=npostavs@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).