Fill some auto-generated docstrings
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode) (define-globalized-minor-mode): Fill auto-generated documentation strings. (Bug#44858) * lisp/subr.el (internal--fill-string-single-line) (internal--format-docstring-line): New functions.
This commit is contained in:
parent
0ebea8ffbf
commit
6b8bb47ac0
3 changed files with 61 additions and 38 deletions
|
@ -306,11 +306,13 @@ No problems result if this variable is not bound.
|
|||
;; Use a default docstring.
|
||||
(setq docstring
|
||||
(if (null parent)
|
||||
;; FIXME filling.
|
||||
(format "Major-mode.\nUses keymap `%s'%s%s." map
|
||||
(if abbrev (format "%s abbrev table `%s'"
|
||||
(if syntax "," " and") abbrev) "")
|
||||
(if syntax (format " and syntax-table `%s'" syntax) ""))
|
||||
(concat
|
||||
"Major-mode.\n"
|
||||
(internal--format-docstring-line
|
||||
"Uses keymap `%s'%s%s." map
|
||||
(if abbrev (format "%s abbrev table `%s'"
|
||||
(if syntax "," " and") abbrev) "")
|
||||
(if syntax (format " and syntax-table `%s'" syntax) "")))
|
||||
(format "Major mode derived from `%s' by `define-derived-mode'.
|
||||
It inherits all of the parent's attributes, but has its own keymap%s:
|
||||
|
||||
|
@ -336,20 +338,22 @@ which more-or-less shadow%s %s's corresponding table%s."
|
|||
(unless (string-match (regexp-quote (symbol-name hook)) docstring)
|
||||
;; Make sure the docstring mentions the mode's hook.
|
||||
(setq docstring
|
||||
(concat docstring
|
||||
(if (null parent)
|
||||
"\n\nThis mode "
|
||||
(concat
|
||||
"\n\nIn addition to any hooks its parent mode "
|
||||
(if (string-match (format "[`‘]%s['’]"
|
||||
(regexp-quote
|
||||
(symbol-name parent)))
|
||||
docstring)
|
||||
nil
|
||||
(format "`%s' " parent))
|
||||
"might have run,\nthis mode "))
|
||||
(format "runs the hook `%s'" hook)
|
||||
", as the final or penultimate step\nduring initialization.")))
|
||||
(concat docstring "\n\n"
|
||||
(internal--format-docstring-line
|
||||
"%s%s%s"
|
||||
(if (null parent)
|
||||
"This mode "
|
||||
(concat
|
||||
"In addition to any hooks its parent mode "
|
||||
(if (string-match (format "[`‘]%s['’]"
|
||||
(regexp-quote
|
||||
(symbol-name parent)))
|
||||
docstring)
|
||||
nil
|
||||
(format "`%s' " parent))
|
||||
"might have run, this mode "))
|
||||
(format "runs the hook `%s'" hook)
|
||||
", as the final or penultimate step during initialization."))))
|
||||
|
||||
(unless (string-match "\\\\[{[]" docstring)
|
||||
;; And don't forget to put the mode's keymap.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue