changeset 104913:67946512b0fd

(define-derived-mode): Give the mode's map, and syntax and abbrev tables basic docs, if they don't have any.
author Glenn Morris <rgm@gnu.org>
date Thu, 10 Sep 2009 06:21:23 +0000
parents ad1f780103d9
children 1a8afcc5fb20
files lisp/emacs-lisp/derived.el
diffstat 1 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/derived.el	Thu Sep 10 06:20:51 2009 +0000
+++ b/lisp/emacs-lisp/derived.el	Thu Sep 10 06:21:23 2009 +0000
@@ -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, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 1999, 2001, 2002, 2003, 2004, 2005, 2006,
+;;   2007, 2008, 2009  Free Software Foundation, Inc.
 
 ;; Author: David Megginson (dmeggins@aix1.uottawa.ca)
 ;; Maintainer: FSF
@@ -193,7 +193,7 @@
 		     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.
 No problems result if this variable is not bound.
@@ -202,16 +202,25 @@
        (unless (boundp ',map)
 	 (put ',map 'definition-name ',child))
        (defvar ,map (make-sparse-keymap))
+       (unless (get ',map 'variable-documentation)
+	 (put ',map 'variable-documentation
+	      ,(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
+		      ,(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
+			,(format "Abbrev table for `%s'." child))))))
        (put ',child 'derived-mode-parent ',parent)
        ,(if group `(put ',child 'custom-mode-group ,group))