-
Notifications
You must be signed in to change notification settings - Fork 8
Adds defcustom numpydoc-newline-after-opening-quotes #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -140,6 +140,13 @@ paragraph-filled." | |||||||||||||||||||||||
| :group 'numpydoc | ||||||||||||||||||||||||
| :type 'boolean) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| (defcustom numpydoc-newline-after-opening-quotes t | ||||||||||||||||||||||||
| "Flag to control insertion of newline after the opening quotes. | ||||||||||||||||||||||||
| If set to t a newline will be inserted after the opening quotes of | ||||||||||||||||||||||||
| the docstring to comply with numpydoc validation rule GL01." | ||||||||||||||||||||||||
| :group 'numpydoc | ||||||||||||||||||||||||
| :type 'boolean) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ;;; package implementation code. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| (cl-defstruct numpydoc--def | ||||||||||||||||||||||||
|
|
@@ -385,10 +392,12 @@ This function assumes the cursor to be in the function body." | |||||||||||||||||||||||
| (insert "\n") | ||||||||||||||||||||||||
| (numpydoc--insert indent | ||||||||||||||||||||||||
| (concat (make-string 3 numpydoc-quote-char) | ||||||||||||||||||||||||
| (if numpydoc-newline-after-opening-quotes | ||||||||||||||||||||||||
| "\n ") | ||||||||||||||||||||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean indenting to align with the docstring indent i.e. there may be no need for the spaces after the carriage return?
Suggested change
Not sure, I'll check it out and report back.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checked this, if the spaces aren't there then the text isn't indented to align with the start of the Looking at the code (not being very conversant in Emacs Lisp) it looks like its I tried adding
Suggested change
..without any success, insert Short Description was at the start of the line. Then I realised there is
Suggested change
Next I tried placing it outside if the surrounding
Suggested change
...which didn't work either, it resulted in exceeding the nesting Looking further down I see that the "Long description" I think the following... (if (numpydoc--prompt-p)
(progn
(setq ld (read-string (concat "Long description "
"(or press return to skip): ")
nil nil "" nil)) ;; This captures the text to be inserted
(unless (string-empty-p ld)
(insert "\n")
(numpydoc--insert indent ld) ;; This inserts the value of ld
(when numpydoc-auto-fill-paragraphs ;; auto-fill/wrap paragraphs
(numpydoc--fill-last-insertion))
(insert "\n")))
(insert "\n")
(numpydoc--insert indent tmpl)
(insert "\n"))))So I tried using that as a template.... (numpydoc--insert indent
(concat (make-string 3 numpydoc-quote-char)
(if numpydoc-newline-after-opening-quotes
"\n")
(if (numpydoc--prompt-p)
(progn
(setq ld (read-string (format "Short description: ")
tmps))
(unless (string-empty-p ld)
(insert "\n")
(numpydoc--insert indent ld)
(when numpydoc-auto-fill-paragraphs
(numpydoc--fill-last-insertion))
(insert "\n")))
(insert "\n")
(make-string 3 numpydoc-quote-char))No dice, feel like I'm out of my depth here but keen to learn what it is I'm missing/not understanding. |
||||||||||||||||||||||||
| (if (numpydoc--prompt-p) | ||||||||||||||||||||||||
| (read-string | ||||||||||||||||||||||||
| (format "Short description: ")) | ||||||||||||||||||||||||
| tmps) | ||||||||||||||||||||||||
| tmps) | ||||||||||||||||||||||||
| "\n\n") | ||||||||||||||||||||||||
| (make-string 3 numpydoc-quote-char)) | ||||||||||||||||||||||||
| (forward-line -1) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.