]> code.delx.au - gnu-emacs/commitdiff
(define-derived-mode): Remove defvar for mode hook. (It conflicted
authorLuc Teirlinck <teirllm@auburn.edu>
Mon, 14 Nov 2005 23:05:53 +0000 (23:05 +0000)
committerLuc Teirlinck <teirllm@auburn.edu>
Mon, 14 Nov 2005 23:05:53 +0000 (23:05 +0000)
with defcustoms for some mode hooks.)  Use the `variable-documentation'
property to give the mode hook a docstring and expand that docstring.

lisp/emacs-lisp/derived.el

index 8e1f79f95ee39a8386b8215d5785bedcffc8fb16..e595ff92a39a5180c9c5847a3ce7665a5a4718b5 100644 (file)
@@ -194,7 +194,12 @@ See Info node `(elisp)Derived Modes' for more details."
                     parent child docstring syntax abbrev))
 
     `(progn
-       (defvar ,hook nil ,(format "Hook run when entering %s mode." name))
+       (unless (get  ',hook 'variable-documentation)
+        (put ',hook 'variable-documentation
+             ,(format "Hook run when 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)))
        (defvar ,map (make-sparse-keymap))
        ,(if declare-syntax
            `(defvar ,syntax (make-syntax-table)))