]> gitweb.michael.orlitzky.com - emacs.d.git/commitdiff
mode-hooks/python-mode-hooks.el: use "onetwo" style for docstrings
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 4 Mar 2026 03:20:51 +0000 (22:20 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Wed, 4 Mar 2026 03:20:51 +0000 (22:20 -0500)
I greatly prefer this, particularly for Sage docstrings, and it's
annoying to have to "git add -i" around it all the time.

mode-hooks/python-mode-hooks.el

index 9c3cf70d77a3f66107769c6a4553fb692a61373e..1968762e491d1bc4de41fa332b23e8ec943e1498 100644 (file)
@@ -4,10 +4,14 @@
   ;; my minibuffer in the process.
   (eldoc-mode 0)
 
-  ;; Use "django" style for python docstrings. This ensures that the
+  ;; Use "onetwo" style for python docstrings. This ensures that the
   ;; leading triple quotes remain on their own line when you paragraph-
-  ;; fill the first paragraph of the docstring.
-  (setq python-fill-docstring-style 'django)
+  ;; fill the first paragraph of the docstring, and that there is always
+  ;; a blank line at the end of the doctring before the trailing triple-
+  ;; quotes. This can look "wrong" in rare scenarios, but generally when
+  ;; you have several paragraphs and/or code blocks that are bounded
+  ;; above and below by whitespace, this will be more consistent.
+  (setq python-fill-docstring-style 'onetwo)
 )