diff options
| author | Stefan Monnier | 2013-05-27 12:12:52 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-05-27 12:12:52 -0400 |
| commit | 7f17cc40ef9120ba1b1715399432f26e8850505a (patch) | |
| tree | 6192821a93b8623adf9d55c99b29ef67612fe323 | |
| parent | 25c8401c40dd74028cdb8f86ec2b64f60998c939 (diff) | |
| download | emacs-7f17cc40ef9120ba1b1715399432f26e8850505a.tar.gz emacs-7f17cc40ef9120ba1b1715399432f26e8850505a.zip | |
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.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/emacs-lisp/derived.el | 7 | ||||
| -rw-r--r-- | lisp/emacs-lisp/easy-mmode.el | 6 |
3 files changed, 15 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8f070f1c9e7..509c940a8f4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-05-27 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * emacs-lisp/easy-mmode.el (define-minor-mode): | ||
| 4 | * emacs-lisp/derived.el (define-derived-mode): Always defvar the | ||
| 5 | mode hook and provide a docstring. | ||
| 6 | |||
| 1 | 2013-05-27 Alan Mackenzie <acm@muc.de> | 7 | 2013-05-27 Alan Mackenzie <acm@muc.de> |
| 2 | 8 | ||
| 3 | Remove spurious syntax-table text properties inserted by C-y. | 9 | Remove spurious syntax-table text properties inserted by C-y. |
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." | |||
| 192 | parent child docstring syntax abbrev)) | 192 | parent child docstring syntax abbrev)) |
| 193 | 193 | ||
| 194 | `(progn | 194 | `(progn |
| 195 | (unless (get ',hook 'variable-documentation) | 195 | (defvar ,hook nil |
| 196 | (put ',hook 'variable-documentation | 196 | ,(format "Hook run after entering %s mode. |
| 197 | (purecopy ,(format "Hook run when entering %s mode. | ||
| 198 | No problems result if this variable is not bound. | 197 | No problems result if this variable is not bound. |
| 199 | `add-hook' automatically binds it. (This is true for all hook variables.)" | 198 | `add-hook' automatically binds it. (This is true for all hook variables.)" |
| 200 | name)))) | 199 | name)) |
| 201 | (unless (boundp ',map) | 200 | (unless (boundp ',map) |
| 202 | (put ',map 'definition-name ',child)) | 201 | (put ',map 'definition-name ',child)) |
| 203 | (with-no-warnings (defvar ,map (make-sparse-keymap))) | 202 | (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'. | |||
| 296 | ;; up-to-here. | 296 | ;; up-to-here. |
| 297 | :autoload-end | 297 | :autoload-end |
| 298 | 298 | ||
| 299 | (defvar ,hook nil | ||
| 300 | ,(format "Hook run after entering or leaving `%s'. | ||
| 301 | No problems result if this variable is not bound. | ||
| 302 | `add-hook' automatically binds it. (This is true for all hook variables.)" | ||
| 303 | mode)) | ||
| 304 | |||
| 299 | ;; Define the minor-mode keymap. | 305 | ;; Define the minor-mode keymap. |
| 300 | ,(unless (symbolp keymap) ;nil is also a symbol. | 306 | ,(unless (symbolp keymap) ;nil is also a symbol. |
| 301 | `(defvar ,keymap-sym | 307 | `(defvar ,keymap-sym |