GNU bug report logs -
#28475
25.3; python double-indents multi-line function argument blocks
Previous Next
Reported by: Ross Donaldson <gastove <at> gmail.com>
Date: Sat, 16 Sep 2017 19:07:02 UTC
Severity: normal
Tags: fixed
Found in version 25.3
Fixed in version 26.1
Done: Noam Postavsky <npostavs <at> users.sourceforge.net>
Bug is archived. No further changes may be made.
Full log
Message #20 received at 28475 <at> debbugs.gnu.org (full text, mbox):
Ross Donaldson <gastove <at> gmail.com> writes:
> From 83a622ec32a64ae30e68de18a84cc32fc6a811d9 Mon Sep 17 00:00:00 2001
> From: Ross Donaldson <gastove <at> 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.
You're missing the ChangeLog style entry here, see CONTRIBUTE under
"Commit messages" for details. Also, an imperative style usually reads
more concisely ("Provide customization..." rather than "This
provides...").
I think a NEWS entry would be appropriate as well.
> - :safe' booleanp)
> + :safe 'booleanp)
It's better not to mix up your change with unrelated whitespace fixes.
> (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"
This should rather be "26.1", as released Emacs versions always end in ".1".
> + :type 'integer
> + :safe (lambda (i) (and (integerp i) (< 0 i))))
I would probably go with 'natnump here. This does also allow 0 which is
probably not generally wanted, but still "safe", I think.
> (`(,(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)))))))
A line break here would keep the line to within a reasonable width
(generally we try to stay in 80 columns).
Thanks for working on this.
This bug report was last modified 7 years and 140 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.