summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/python.el1
-rw-r--r--test/lisp/progmodes/python-tests.el18
2 files changed, 19 insertions, 0 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 188bc973d99..e1f9a33a691 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -5379,6 +5379,7 @@ REPORT-FN is Flymake's callback function."
(set (make-local-variable 'paragraph-start) "\\s-*$")
(set (make-local-variable 'fill-paragraph-function)
#'python-fill-paragraph)
+ (set (make-local-variable 'fill-indent-according-to-mode) t) ; Bug#36056.
(set (make-local-variable 'beginning-of-defun-function)
#'python-nav-beginning-of-defun)
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index a5179097172..87cee189eac 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -1341,6 +1341,24 @@ this is an arbitrarily
expected)))))
+;;; Autofill
+
+(ert-deftest python-auto-fill-docstring ()
+ (python-tests-with-temp-buffer
+ "\
+def some_function(arg1,
+ arg2):
+ \"\"\"
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
+ (auto-fill-mode +1)
+ (goto-char (point-max))
+ (newline)
+ (search-backward "Lorem")
+ (let ((docindent (current-indentation)))
+ (forward-line 1)
+ (should (= docindent (current-indentation))))))
+
+
;;; Mark
(ert-deftest python-mark-defun-1 ()