aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2019-10-05 00:31:17 +0200
committerJuanma Barranquero2019-10-05 00:31:17 +0200
commitbbfa9995ff3bdb8a00fe3082bc3249cc1e68e1ab (patch)
tree06b5c96b1e81f1272108cffd7f7606e0180fa693
parent2ff16a483702ef064babf0823b20b2138fc1571a (diff)
downloademacs-bbfa9995ff3bdb8a00fe3082bc3249cc1e68e1ab.tar.gz
emacs-bbfa9995ff3bdb8a00fe3082bc3249cc1e68e1ab.zip
Improve docstrings auto-generated by `define-minor-mode'
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--mode-docstring): When using `easy-mmode--arg-docstring' to auto-generate a docstring, refill it up to `emacs-lisp-docstring-fill-column'.
-rw-r--r--lisp/emacs-lisp/easy-mmode.el14
1 files changed, 11 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 5e7b29eddf8..ccdb25ef60e 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -95,10 +95,18 @@ if ARG is `toggle'; disable the mode otherwise.")
95\\{%s}" mode-pretty-name keymap-sym)))) 95\\{%s}" mode-pretty-name keymap-sym))))
96 (if (string-match-p "\\bARG\\b" doc) 96 (if (string-match-p "\\bARG\\b" doc)
97 doc 97 doc
98 (let ((argdoc (format easy-mmode--arg-docstring 98 (let* ((fill-prefix nil)
99 mode-pretty-name))) 99 (docs-fc (bound-and-true-p emacs-lisp-docstring-fill-column))
100 (fill-column (if (integerp docs-fc) docs-fc 65))
101 (argdoc (format easy-mmode--arg-docstring mode-pretty-name))
102 (filled (if (fboundp 'fill-region)
103 (with-temp-buffer
104 (insert argdoc)
105 (fill-region (point-min) (point-max) 'left t)
106 (buffer-string))
107 argdoc)))
100 (replace-regexp-in-string "\\(\n\n\\|\\'\\)\\(.\\|\n\\)*\\'" 108 (replace-regexp-in-string "\\(\n\n\\|\\'\\)\\(.\\|\n\\)*\\'"
101 (concat argdoc "\\1") 109 (concat filled "\\1")
102 doc nil nil 1))))) 110 doc nil nil 1)))))
103 111
104;;;###autoload 112;;;###autoload