Don't clobber docstrings of explicitly-defined mode hook variables
* lisp/emacs-lisp/derived.el (define-derived-mode): * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): When defining the mode hook variable, do not clobber pre-existing docstrings.
This commit is contained in:
parent
9c8fe0248b
commit
3e7ebbe1bd
2 changed files with 10 additions and 6 deletions
|
@ -203,11 +203,13 @@ See Info node `(elisp)Derived Modes' for more details."
|
||||||
parent child docstring syntax abbrev))
|
parent child docstring syntax abbrev))
|
||||||
|
|
||||||
`(progn
|
`(progn
|
||||||
(defvar ,hook nil
|
(defvar ,hook nil)
|
||||||
|
(unless (get ',hook 'variable-documentation)
|
||||||
|
(put ',hook 'variable-documentation
|
||||||
,(format "Hook run after entering %s mode.
|
,(format "Hook run after entering %s mode.
|
||||||
No problems result if this variable is not bound.
|
No problems result if this variable is not bound.
|
||||||
`add-hook' automatically binds it. (This is true for all hook variables.)"
|
`add-hook' automatically binds it. (This is true for all hook variables.)"
|
||||||
name))
|
name)))
|
||||||
(unless (boundp ',map)
|
(unless (boundp ',map)
|
||||||
(put ',map 'definition-name ',child))
|
(put ',map 'definition-name ',child))
|
||||||
(with-no-warnings (defvar ,map (make-sparse-keymap)))
|
(with-no-warnings (defvar ,map (make-sparse-keymap)))
|
||||||
|
|
|
@ -309,11 +309,13 @@ the mode if ARG is omitted or nil, and toggle it if ARG is `toggle'.
|
||||||
;; up-to-here.
|
;; up-to-here.
|
||||||
:autoload-end
|
:autoload-end
|
||||||
|
|
||||||
(defvar ,hook nil
|
(defvar ,hook nil)
|
||||||
|
(unless (get ',hook 'variable-documentation)
|
||||||
|
(put ',hook 'variable-documentation
|
||||||
,(format "Hook run after entering or leaving `%s'.
|
,(format "Hook run after entering or leaving `%s'.
|
||||||
No problems result if this variable is not bound.
|
No problems result if this variable is not bound.
|
||||||
`add-hook' automatically binds it. (This is true for all hook variables.)"
|
`add-hook' automatically binds it. (This is true for all hook variables.)"
|
||||||
modefun))
|
modefun)))
|
||||||
|
|
||||||
;; Define the minor-mode keymap.
|
;; Define the minor-mode keymap.
|
||||||
,(unless (symbolp keymap) ;nil is also a symbol.
|
,(unless (symbolp keymap) ;nil is also a symbol.
|
||||||
|
|
Loading…
Add table
Reference in a new issue