Commit c59ecb00 authored by Ross Donaldson's avatar Ross Donaldson Committed by Noam Postavsky
Browse files

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
parent 4e20c8f2
...@@ -1037,6 +1037,13 @@ located and whether GnuPG's option '--homedir' is used or not. ...@@ -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'. *** 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 ** Tramp
+++ +++
......
...@@ -752,6 +752,12 @@ It makes underscores and dots word constituent chars.") ...@@ -752,6 +752,12 @@ It makes underscores and dots word constituent chars.")
:type '(repeat symbol) :type '(repeat symbol)
:group 'python) :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 (defvar python-indent-current-level 0
"Deprecated var available for compatibility.") "Deprecated var available for compatibility.")
...@@ -1071,9 +1077,9 @@ possibilities can be narrowed to specific indentation points." ...@@ -1071,9 +1077,9 @@ possibilities can be narrowed to specific indentation points."
(current-indentation))) (current-indentation)))
opening-block-start-points)))) opening-block-start-points))))
(`(,(or :inside-paren-newline-start-from-block) . ,start) (`(,(or :inside-paren-newline-start-from-block) . ,start)
;; Add two indentation levels to make the suite stand out.
(goto-char start) (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) (defun python-indent--calculate-levels (indentation)
"Calculate levels list given INDENTATION. "Calculate levels list given INDENTATION.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment