bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#28475: 25.3; python double-indents multi-line function argument bloc


From: Noam Postavsky
Subject: bug#28475: 25.3; python double-indents multi-line function argument blocks
Date: Sun, 24 Sep 2017 13:42:12 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux)

Ross Donaldson <address@hidden> writes:

> From 83a622ec32a64ae30e68de18a84cc32fc6a811d9 Mon Sep 17 00:00:00 2001
> From: Ross Donaldson <address@hidden>
> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]