diff options
| author | Juanma Barranquero | 2019-10-04 01:26:07 +0200 |
|---|---|---|
| committer | Juanma Barranquero | 2019-10-04 01:26:56 +0200 |
| commit | a397fa06d18d6ae37a3a1288f269e1ae9eb3b569 (patch) | |
| tree | 6e6b02ba92984f0788d9424bf67e2856c4fc4b08 | |
| parent | 93dd959711222cf594051fa397d6a6e324e136fc (diff) | |
| download | emacs-a397fa06d18d6ae37a3a1288f269e1ae9eb3b569.tar.gz emacs-a397fa06d18d6ae37a3a1288f269e1ae9eb3b569.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.el | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 5e7b29eddf8..6d5b5141aaf 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el | |||
| @@ -95,11 +95,17 @@ 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 | (docstring-fc (bound-and-true-p emacs-lisp-docstring-fill-column)) |
| 100 | (replace-regexp-in-string "\\(\n\n\\|\\'\\)\\(.\\|\n\\)*\\'" | 100 | (fill-column (if (integerp docstring-fc) docstring-fc 65)) |
| 101 | (concat argdoc "\\1") | 101 | (argdoc (format easy-mmode--arg-docstring |
| 102 | doc nil nil 1))))) | 102 | mode-pretty-name))) |
| 103 | (with-temp-buffer | ||
| 104 | (insert (replace-regexp-in-string "\\(\n\n\\|\\'\\)\\(.\\|\n\\)*\\'" | ||
| 105 | (concat argdoc "\\1") | ||
| 106 | doc nil nil 1)) | ||
| 107 | (fill-region (point-min) (point-max) 'left t) | ||
| 108 | (buffer-string)))))) | ||
| 103 | 109 | ||
| 104 | ;;;###autoload | 110 | ;;;###autoload |
| 105 | (defalias 'easy-mmode-define-minor-mode 'define-minor-mode) | 111 | (defalias 'easy-mmode-define-minor-mode 'define-minor-mode) |