summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Donaldson <gastove@gmail.com>2017-12-25 12:51:19 -0800
committerNoam Postavsky <npostavs@gmail.com>2018-01-01 11:16:00 -0500
commitc59ecb005e560420d927ad7884c9030ba15319a4 (patch)
treea3cbff6c48e362e44da3e91ee00f9ab261020866
parent4e20c8f22031d6f19e70f0dfcb11c09606446d88 (diff)
downloademacs-c59ecb005e560420d927ad7884c9030ba15319a4.tar.gz
New customization variable for python-mode indentation (Bug#28475)
* lisp/progmodes/python.el (python-indent-def-block-scale): New variable. (python-indent--calculate-indentation): Let it control how many indent levels are inserted for multi-line function signatures. Copyright-paperwork-exempt: yes
-rw-r--r--etc/NEWS7
-rw-r--r--lisp/progmodes/python.el10
2 files changed, 15 insertions, 2 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 55385f59a80..b4c489cf7bd 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1037,6 +1037,13 @@ located and whether GnuPG's option '--homedir' is used or not.
---
*** Deleting a package no longer respects 'delete-by-moving-to-trash'.
+** Python
+
++++
+*** The new variable 'python-indent-def-block-scale' has been added.
+It controls the depth of indentation of arguments inside multi-line
+function signatures.
+
** Tramp
+++
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 68926b275ea..5baf6e0f80a 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -752,6 +752,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.1"
+ :type 'integer
+ :safe 'natnump)
+
(defvar python-indent-current-level 0
"Deprecated var available for compatibility.")
@@ -1071,9 +1077,9 @@ 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.