summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/easy-mmode.el
diff options
context:
space:
mode:
authorPhil Sainty <psainty@orcon.net.nz>2017-10-16 23:38:42 +1300
committerNoam Postavsky <npostavs@gmail.com>2017-10-31 08:20:30 -0400
commit3e7ebbe1bd5d33476190c789d17e4dd2d5f1bdfb (patch)
tree9b4eb6814ee124c10d1b4e2dc4c06385a160a515 /lisp/emacs-lisp/easy-mmode.el
parent9c8fe0248b95b1faa9f97d14fe16d3356130dee8 (diff)
downloademacs-3e7ebbe1bd5d33476190c789d17e4dd2d5f1bdfb.tar.gz
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.
Diffstat (limited to 'lisp/emacs-lisp/easy-mmode.el')
-rw-r--r--lisp/emacs-lisp/easy-mmode.el8
1 files changed, 5 insertions, 3 deletions
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'.
;; up-to-here.
:autoload-end
- (defvar ,hook nil
- ,(format "Hook run after entering or leaving `%s'.
+ (defvar ,hook nil)
+ (unless (get ',hook 'variable-documentation)
+ (put ',hook 'variable-documentation
+ ,(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.)"
- modefun))
+ modefun)))
;; Define the minor-mode keymap.
,(unless (symbolp keymap) ;nil is also a symbol.