diff options
| author | Phil Sainty | 2017-10-16 23:38:42 +1300 |
|---|---|---|
| committer | Noam Postavsky | 2017-10-31 08:20:30 -0400 |
| commit | 3e7ebbe1bd5d33476190c789d17e4dd2d5f1bdfb (patch) | |
| tree | 9b4eb6814ee124c10d1b4e2dc4c06385a160a515 | |
| parent | 9c8fe0248b95b1faa9f97d14fe16d3356130dee8 (diff) | |
| download | emacs-3e7ebbe1bd5d33476190c789d17e4dd2d5f1bdfb.tar.gz emacs-3e7ebbe1bd5d33476190c789d17e4dd2d5f1bdfb.zip | |
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.
| -rw-r--r-- | lisp/emacs-lisp/derived.el | 8 | ||||
| -rw-r--r-- | lisp/emacs-lisp/easy-mmode.el | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el index 3fa3818526c..751291afa88 100644 --- a/lisp/emacs-lisp/derived.el +++ b/lisp/emacs-lisp/derived.el | |||
| @@ -203,11 +203,13 @@ See Info node `(elisp)Derived Modes' for more details." | |||
| 203 | parent child docstring syntax abbrev)) | 203 | parent child docstring syntax abbrev)) |
| 204 | 204 | ||
| 205 | `(progn | 205 | `(progn |
| 206 | (defvar ,hook nil | 206 | (defvar ,hook nil) |
| 207 | ,(format "Hook run after entering %s mode. | 207 | (unless (get ',hook 'variable-documentation) |
| 208 | (put ',hook 'variable-documentation | ||
| 209 | ,(format "Hook run after entering %s mode. | ||
| 208 | No problems result if this variable is not bound. | 210 | No problems result if this variable is not bound. |
| 209 | `add-hook' automatically binds it. (This is true for all hook variables.)" | 211 | `add-hook' automatically binds it. (This is true for all hook variables.)" |
| 210 | name)) | 212 | name))) |
| 211 | (unless (boundp ',map) | 213 | (unless (boundp ',map) |
| 212 | (put ',map 'definition-name ',child)) | 214 | (put ',map 'definition-name ',child)) |
| 213 | (with-no-warnings (defvar ,map (make-sparse-keymap))) | 215 | (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 bf087fc2e9a..ac8dcc69d21 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el | |||
| @@ -309,11 +309,13 @@ the mode if ARG is omitted or nil, and toggle it if ARG is `toggle'. | |||
| 309 | ;; up-to-here. | 309 | ;; up-to-here. |
| 310 | :autoload-end | 310 | :autoload-end |
| 311 | 311 | ||
| 312 | (defvar ,hook nil | 312 | (defvar ,hook nil) |
| 313 | ,(format "Hook run after entering or leaving `%s'. | 313 | (unless (get ',hook 'variable-documentation) |
| 314 | (put ',hook 'variable-documentation | ||
| 315 | ,(format "Hook run after entering or leaving `%s'. | ||
| 314 | No problems result if this variable is not bound. | 316 | No problems result if this variable is not bound. |
| 315 | `add-hook' automatically binds it. (This is true for all hook variables.)" | 317 | `add-hook' automatically binds it. (This is true for all hook variables.)" |
| 316 | modefun)) | 318 | modefun))) |
| 317 | 319 | ||
| 318 | ;; Define the minor-mode keymap. | 320 | ;; Define the minor-mode keymap. |
| 319 | ,(unless (symbolp keymap) ;nil is also a symbol. | 321 | ,(unless (symbolp keymap) ;nil is also a symbol. |