X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/ac3232837188f7e1c4ffe34b76edede0ccb54f5e..197daef4ab65cbb5d5add8bbc8e258aa26992d4f:/lisp/emacs-lisp/derived.el diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el index 83cb7aeee7..d6f717ccda 100644 --- a/lisp/emacs-lisp/derived.el +++ b/lisp/emacs-lisp/derived.el @@ -1,8 +1,8 @@ ;;; derived.el --- allow inheritance of major modes ;; (formerly mode-clone.el) -;; Copyright (C) 1993, 1994, 1999, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +;; Copyright (C) 1993, 1994, 1999, 2001, 2002, 2003, 2004, 2005, 2006, +;; 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ;; Author: David Megginson (dmeggins@aix1.uottawa.ca) ;; Maintainer: FSF @@ -193,25 +193,34 @@ See Info node `(elisp)Derived Modes' for more details." parent child docstring syntax abbrev)) `(progn - (unless (get ',hook 'variable-documentation) + (unless (get ',hook 'variable-documentation) (put ',hook 'variable-documentation - ,(format "Hook run when entering %s mode. + (purecopy ,(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))) + name)))) (unless (boundp ',map) (put ',map 'definition-name ',child)) (defvar ,map (make-sparse-keymap)) + (unless (get ',map 'variable-documentation) + (put ',map 'variable-documentation + (purecopy ,(format "Keymap for `%s'." child)))) ,(if declare-syntax `(progn (unless (boundp ',syntax) (put ',syntax 'definition-name ',child)) - (defvar ,syntax (make-syntax-table)))) + (defvar ,syntax (make-syntax-table)) + (unless (get ',syntax 'variable-documentation) + (put ',syntax 'variable-documentation + (purecopy ,(format "Syntax table for `%s'." child)))))) ,(if declare-abbrev `(progn (put ',abbrev 'definition-name ',child) (defvar ,abbrev - (progn (define-abbrev-table ',abbrev nil) ,abbrev)))) + (progn (define-abbrev-table ',abbrev nil) ,abbrev)) + (unless (get ',abbrev 'variable-documentation) + (put ',abbrev 'variable-documentation + (purecopy ,(format "Abbrev table for `%s'." child)))))) (put ',child 'derived-mode-parent ',parent) ,(if group `(put ',child 'custom-mode-group ,group)) @@ -221,7 +230,7 @@ No problems result if this variable is not bound. ; Run the parent. (delay-mode-hooks - (,(or parent 'kill-all-local-variables)) + (,(or parent 'fundamental-mode)) ; Identify the child mode. (setq major-mode (quote ,child)) (setq mode-name ,name)