summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2013-05-27 12:12:52 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2013-05-27 12:12:52 -0400
commit7f17cc40ef9120ba1b1715399432f26e8850505a (patch)
tree6192821a93b8623adf9d55c99b29ef67612fe323 /lisp/emacs-lisp
parent25c8401c40dd74028cdb8f86ec2b64f60998c939 (diff)
downloademacs-7f17cc40ef9120ba1b1715399432f26e8850505a.tar.gz
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.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/derived.el7
-rw-r--r--lisp/emacs-lisp/easy-mmode.el6
2 files changed, 9 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el
index 684f9d90878..96c223c9e18 100644
--- a/lisp/emacs-lisp/derived.el
+++ b/lisp/emacs-lisp/derived.el
@@ -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)))
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 718018fd2d9..ed10080cc35 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -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