Skip to content

Commit 5cb26db

Browse files
authoredJul 25, 2023
optionally auto fill paragraphs (#16)
1 parent 935e6cb commit 5cb26db

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed
 

‎NEWS.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# numpydoc.el NEWS -- history of user visible changes
22

3-
## Unreleased
3+
## 0.9 (July 24, 2023)
44

5-
...
5+
### Changes
6+
7+
- Add new `defcustom`: `numpydoc-auto-fill-paragraphs`, which when set
8+
to `t` (the default) will enable automatic paragraph filling for
9+
(somewhat) long descriptions.
10+
([#16](https://github.com/douglasdavis/numpydoc.el/pull/16)).
611

712
## 0.8 (March 20, 2023)
813

‎README.md

+5
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ RET numpydoc</kbd>
135135
All function parameters with names listed here will be ignored
136136
when generating a docstring.
137137
</dd>
138+
<dt>numpydoc-auto-fill-paragraphs</dt>
139+
<dd>
140+
If <code>t</code> text that is inserted in a prompt will be
141+
automatically paragraph-filled.
142+
</dd>
138143
</dl>
139144

140145
## Examples

‎numpydoc.el

+14-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
;; Maintainer: Doug Davis <ddavis@ddavis.io>
77
;; URL: https://github.com/douglasdavis/numpydoc.el
88
;; SPDX-License-Identifier: GPL-3.0-or-later
9-
;; Version: 0.8
9+
;; Version: 0.9
1010
;; Package-Requires: ((emacs "25.1") (s "1.12.0") (dash "2.18.0"))
1111
;; Keywords: convenience
1212

@@ -133,6 +133,13 @@ when generating a docstring."
133133
:group 'numpydoc
134134
:type '(repeat string))
135135

136+
(defcustom numpydoc-auto-fill-paragraphs t
137+
"Flag to control automatic paragraph filling.
138+
If set to t text that is inserted in a prompt will be automatically
139+
paragraph-filled."
140+
:group 'numpydoc
141+
:type 'boolean)
142+
136143
;;; package implementation code.
137144

138145
(cl-defstruct numpydoc--def
@@ -391,7 +398,8 @@ This function assumes the cursor to be in the function body."
391398
(unless (string-empty-p ld)
392399
(insert "\n")
393400
(numpydoc--insert indent ld)
394-
(numpydoc--fill-last-insertion)
401+
(when numpydoc-auto-fill-paragraphs
402+
(numpydoc--fill-last-insertion))
395403
(insert "\n")))
396404
(insert "\n")
397405
(numpydoc--insert indent tmpl)
@@ -429,7 +437,8 @@ This function assumes the cursor to be in the function body."
429437
element))
430438
tmpd))))
431439
(numpydoc--insert indent desc)
432-
(numpydoc--fill-last-insertion)
440+
(when numpydoc-auto-fill-paragraphs
441+
(numpydoc--fill-last-insertion))
433442
(insert "\n")))
434443

435444
(defun numpydoc--insert-parameters (indent fnargs)
@@ -466,7 +475,8 @@ This function assumes the cursor to be in the function body."
466475
(if (numpydoc--prompt-p)
467476
(read-string "Description for return: ")
468477
tmpr)))
469-
(numpydoc--fill-last-insertion)
478+
(when numpydoc-auto-fill-paragraphs
479+
(numpydoc--fill-last-insertion))
470480
(insert "\n"))))
471481

472482
(defun numpydoc--insert-exceptions (indent fnexcepts)

0 commit comments

Comments
 (0)
Please sign in to comment.