all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ross Donaldson <gastove@gmail.com>
To: Noam Postavsky <npostavs@users.sourceforge.net>
Cc: 28475@debbugs.gnu.org
Subject: bug#28475: 25.3; python double-indents multi-line function argument blocks
Date: Sun, 24 Sep 2017 17:02:05 +0000	[thread overview]
Message-ID: <CAC+S337NyyEYJF6VT9j8Bw7J0GzVVwvNatMv6-MJLbSgQre9Ww@mail.gmail.com> (raw)
In-Reply-To: <87ing8m4kb.fsf@users.sourceforge.net>


[-- Attachment #1.1: Type: text/plain, Size: 1049 bytes --]

Ahhh, I see. Well! This patch didn't need to touch either function, so!

Here we are.

On Sun, Sep 24, 2017 at 9:42 AM Noam Postavsky <
npostavs@users.sourceforge.net> wrote:

> Ross Donaldson <gastove@gmail.com> writes:
>
> > I was thrown off by the `prog-FOO` commands because of this message
> > in the ChangeLog:
> >
> > ```
> > 2016-03-27  Dmitry Gutov  <dgutov@yandex.ru>
> >
> > Remove prog-indentation-context
> >
> > * lisp/progmodes/prog-mode.el: (prog-indentation-context)
> > (prog-first-column, prog-widen): Remove, as discussed in
> > http://lists.gnu.org/archive/html/emacs-devel/2016-03/msg01425.html.
> > ```
>
> Oh, that is a bit confusing, but now I see what happened: it was indeed
> removed for Emacs-25, but is still present in Emacs-26 and later.  If
> you look to the end of that message you will see
>
>         Do not merge to master.
>
> Which gives the hint.
>
>
> > I haven't assigned copyright to Emacs yet; I'd be happy to, and also,
> > I suspect this patch will be quite short. I'll send it over soon.
>
> Thanks!
>

[-- Attachment #1.2: Type: text/html, Size: 1718 bytes --]

[-- Attachment #2: scale-by-const.patch --]
[-- Type: application/octet-stream, Size: 1975 bytes --]

From 83a622ec32a64ae30e68de18a84cc32fc6a811d9 Mon Sep 17 00:00:00 2001
From: Ross Donaldson <gastove@gmail.com>
Date: Sun, 24 Sep 2017 09:42:23 -0700
Subject: [PATCH] Rather than scaling certain python blocks by a constant,
 scale by a defcustom

This provides customization of the number of indent levels in
multi-line `def` blocks in python; it also corrects a nearby (but
unrelated) incorrect symbol quote.
---
 lisp/progmodes/python.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index f3513ced4b..3181353d20 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -738,7 +738,7 @@ It makes underscores and dots word constituent chars.")
   :version "25.1"
   :type 'boolean
   :group 'python
-  :safe' booleanp)
+  :safe 'booleanp)
 
 (defcustom python-indent-trigger-commands
   '(indent-for-tab-command yas-expand yas/expand)
@@ -746,6 +746,12 @@ It makes underscores and dots word constituent chars.")
   :type '(repeat symbol)
   :group 'python)
 
+(defcustom python-indent-def-block-scale 2
+  "Multiplier applied to indentation inside multi-line def blocks."
+  :version "26.0"
+  :type 'integer
+  :safe (lambda (i) (and (integerp i) (< 0 i))))
+
 (define-obsolete-variable-alias
   'python-indent 'python-indent-offset "24.3")
 
@@ -1075,9 +1081,8 @@ possibilities can be narrowed to specific indentation points."
                          (current-indentation)))
                      opening-block-start-points))))
         (`(,(or :inside-paren-newline-start-from-block) . ,start)
-         ;; Add two indentation levels to make the suite stand out.
          (goto-char start)
-         (+ (current-indentation) (* python-indent-offset 2)))))))
+         (+ (current-indentation) (* python-indent-offset python-indent-def-block-scale)))))))
 
 (defun python-indent--calculate-levels (indentation)
   "Calculate levels list given INDENTATION.
-- 
2.14.1


  reply	other threads:[~2017-09-24 17:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-16 18:42 bug#28475: 25.3; python double-indents multi-line function argument blocks Ross Donaldson
2017-09-24 12:26 ` Noam Postavsky
2017-09-24 16:25   ` Ross Donaldson
2017-09-24 16:42     ` Noam Postavsky
2017-09-24 17:02       ` Ross Donaldson [this message]
2017-09-24 17:42         ` Noam Postavsky
2017-10-12 21:11           ` Ross Donaldson
2017-11-07  1:10             ` Noam Postavsky
2017-12-25 20:54               ` Ross Donaldson
2018-01-01 16:17                 ` Noam Postavsky
2018-01-02 17:55                   ` Ross Donaldson
2017-09-26  0:50       ` Dmitry Gutov

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAC+S337NyyEYJF6VT9j8Bw7J0GzVVwvNatMv6-MJLbSgQre9Ww@mail.gmail.com \
    --to=gastove@gmail.com \
    --cc=28475@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.