Always defvar a mode's hook and provide a docstring.
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): * lisp/emacs-lisp/derived.el (define-derived-mode): Always defvar the mode hook and provide a docstring.
This commit is contained in:
parent
25c8401c40
commit
7f17cc40ef
3 changed files with 15 additions and 4 deletions
|
@ -192,12 +192,11 @@ See Info node `(elisp)Derived Modes' for more details."
|
|||
parent child docstring syntax abbrev))
|
||||
|
||||
`(progn
|
||||
(unless (get ',hook 'variable-documentation)
|
||||
(put ',hook 'variable-documentation
|
||||
(purecopy ,(format "Hook run when entering %s mode.
|
||||
(defvar ,hook nil
|
||||
,(format "Hook run after entering %s mode.
|
||||
No problems result if this variable is not bound.
|
||||
`add-hook' automatically binds it. (This is true for all hook variables.)"
|
||||
name))))
|
||||
name))
|
||||
(unless (boundp ',map)
|
||||
(put ',map 'definition-name ',child))
|
||||
(with-no-warnings (defvar ,map (make-sparse-keymap)))
|
||||
|
|
|
@ -296,6 +296,12 @@ the mode if ARG is omitted or nil, and toggle it if ARG is `toggle'.
|
|||
;; up-to-here.
|
||||
:autoload-end
|
||||
|
||||
(defvar ,hook nil
|
||||
,(format "Hook run after entering or leaving `%s'.
|
||||
No problems result if this variable is not bound.
|
||||
`add-hook' automatically binds it. (This is true for all hook variables.)"
|
||||
mode))
|
||||
|
||||
;; Define the minor-mode keymap.
|
||||
,(unless (symbolp keymap) ;nil is also a symbol.
|
||||
`(defvar ,keymap-sym
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue