;ELC   
;;; Compiled by rms@psilocin.ai.mit.edu on Wed Jul  8 20:18:08 1998
;;; from file /gd/gnu/emacs/lisp/derived.el
;;; in Emacs version 20.2.97.2
;;; with bytecomp version 2.47
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.
(if (and (boundp 'emacs-version)
	 (< (aref emacs-version (1- (length emacs-version))) ?A)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19.29")))
    (error "`derived.el' was compiled for Emacs 19.29 or later"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


#@1256 Create a new mode as a variant of an existing mode.

The arguments to this command are as follow:

CHILD:     the name of the command for the derived mode.
PARENT:    the name of the command for the parent mode (ie. text-mode).
NAME:      a string which will appear in the status line (ie. "Hypertext")
DOCSTRING: an optional documentation string--if you do not supply one,
           the function will attempt to invent something useful.
BODY:      forms to execute just before running the
           hooks for the new mode.

Here is how you could define LaTeX-Thesis mode as a variant of LaTeX mode:

  (define-derived-mode LaTeX-thesis-mode LaTeX-mode "LaTeX-Thesis")

You could then make new key bindings for `LaTeX-thesis-mode-map'
without changing regular LaTeX mode.  In this example, BODY is empty,
and DOCSTRING is generated by default.

On a more complicated level, the following command uses sgml-mode as
the parent, and then sets the variable `case-fold-search' to nil:

  (define-derived-mode article-mode sgml-mode "Article"
    "Major mode for editing technical articles."
    (setq case-fold-search nil))

Note that if the documentation string had been left out, it would have
been generated automatically, with a reference to the keymap.
(defalias 'define-derived-mode '(macro . #[(child parent name &optional docstring &rest body) "\203 ;\204 	B\305\206 \306\n\"\307\310\311DD\312\311D\313\311\nDF\314\305\315\nC\316\317\311\nD\320BB\312\311D\321BBE\322\323\311DE\322\324\fE\325\311DD\326\311DD\327\311DD\330	\331\311DDC\"BBBBBBBBBBBBF\207" [docstring body parent child name nil derived-mode-make-docstring progn derived-mode-init-mode-variables quote put 'derived-mode-parent defun (interactive) if get ('special) ('special t) setq major-mode mode-name derived-mode-set-keymap derived-mode-set-syntax-table derived-mode-set-abbrev-table append derived-mode-run-hooks] 20 (#$ . 604)]))
#@172 Find the class of a major mode.
A mode's class is the first ancestor which is NOT a derived mode.
Use the `derived-mode-parent' property of the symbol to trace backwards.
(defalias 'derived-mode-class #[(mode) "\301N\203 \301N\211\202 \207" [mode derived-mode-parent] 3 (#$ . 2536)])
#@55 Construct a setup-function name based on a mode name.
(defalias 'derived-mode-setup-function-name #[(mode) "\301\302!\303P!\207" [mode intern symbol-name "-setup"] 3 (#$ . 2832)])
(put 'derived-mode-setup-function-name 'byte-optimizer 'byte-compile-inline-expand)
#@55 Construct the mode hook name based on mode name MODE.
(defalias 'derived-mode-hook-name #[(mode) "\301\302!\303P!\207" [mode intern symbol-name "-hook"] 3 (#$ . 3103)])
(put 'derived-mode-hook-name 'byte-optimizer 'byte-compile-inline-expand)
#@44 Construct a map name based on a mode name.
(defalias 'derived-mode-map-name #[(mode) "\301\302!\303P!\207" [mode intern symbol-name "-map"] 3 (#$ . 3353)])
(put 'derived-mode-map-name 'byte-optimizer 'byte-compile-inline-expand)
#@53 Construct a syntax-table name based on a mode name.
(defalias 'derived-mode-syntax-table-name #[(mode) "\301\302!\303P!\207" [mode intern symbol-name "-syntax-table"] 3 (#$ . 3589)])
(put 'derived-mode-syntax-table-name 'byte-optimizer 'byte-compile-inline-expand)
#@54 Construct an abbrev-table name based on a mode name.
(defalias 'derived-mode-abbrev-table-name #[(mode) "\301\302!\303P!\207" [mode intern symbol-name "-abbrev-table"] 3 (#$ . 3861)])
(put 'derived-mode-abbrev-table-name 'byte-optimizer 'byte-compile-inline-expand)
#@208 Initialise variables for a new mode. 
Right now, if they don't already exist, set up a blank keymap, an
empty syntax table, and an empty abbrev table -- these will be merged
the first time the mode is used.
(defalias 'derived-mode-init-mode-variables #[(mode) "\301\302\303!\304P!)!\2042 \305\306\302\303!\304P!)\307\310\311\"F!\210\312\302\303!\304P!)\313\314#\210\301\302\303!\315P!)!\204d \305\306\302\303!\315P!)\316\310\317\"F!\210\312\302\303!\315P!)\313\314#\210\301\302\303!\320P!)!\203u \314\207\305\306\302\303!\320P!)\321\310\322\"F!\207" [mode boundp intern symbol-name "-map" eval defvar (make-sparse-keymap) format "Keymap for %s." put derived-mode-unmerged t "-syntax-table" (make-char-table 'syntax-table nil) "Syntax table for %s." "-abbrev-table" (progn (define-abbrev-table (derived-mode-abbrev-table-name mode) nil) (make-abbrev-table)) "Abbrev table for %s."] 7 (#$ . 4135)])
#@59 Construct a docstring for a new mode if none is provided.
(defalias 'derived-mode-make-docstring #[(parent child) "\302\303	\211\211	&\207" [parent child format "This major mode is a variant of `%s', created by `define-derived-mode'.\nIt inherits all of the parent's attributes, but has its own keymap,\nabbrev table and syntax table:\n\n  `%s-map' and `%s-syntax-table'\n\nwhich more-or-less shadow\n\n  `%s-map' and `%s-syntax-table'\n\n\\{%s-map}"] 8 (#$ . 5065)])
#@64 Set the keymap of the new mode, maybe merging with the parent.
(defalias 'derived-mode-set-keymap #[(mode) "\304\305!\306P!)\307	!\310 \211\203! 	\311N\203! \312\n\"\210\313	\311\314#\210\315\n!+\207" [mode map-name new-map old-map intern symbol-name "-map" eval current-local-map derived-mode-unmerged derived-mode-merge-keymaps put nil use-local-map] 5 (#$ . 5542)])
#@70 Set the syntax table of the new mode, maybe merging with the parent.
(defalias 'derived-mode-set-syntax-table #[(mode) "\304\305!\306P!)\307 \310	!	\311N\203 \312\n\"\210\313	\311\314#\210\315!+\207" [mode table-name old-table new-table intern symbol-name "-syntax-table" syntax-table eval derived-mode-unmerged derived-mode-merge-syntax-tables put nil set-syntax-table] 4 (#$ . 5924)])
#@107 Set the abbrev table if it exists.  
Always merge its parent into it, since the merge is non-destructive.
(defalias 'derived-mode-set-abbrev-table #[(mode) "\305\306!\307P!)\n\310	!\311\f\"\210\f\211+\207" [mode table-name local-abbrev-table old-table new-table intern symbol-name "-abbrev-table" eval derived-mode-merge-abbrev-tables] 3 (#$ . 6327)])
#@29 Run the mode hook for MODE.
(defalias 'derived-mode-run-hooks #[(mode) "\302\303!\304P!)\305	!\205 \306	!)\207" [mode hooks-name intern symbol-name "-hook" boundp run-hooks] 3 (#$ . 6693)])
#@139 Merge an old keymap into a new one.
The old keymap is set to be the last cdr of the new one, so that there will
be automatic inheritance.
(defalias 'derived-mode-merge-keymaps #[(old new) "\211:\203t 	@:\203/ \306	@@!\307\n\"\307\f\n\"\310!\203. \310!\203. \311\"\210+\312	@!\203m 	@GS\211\f\313Y\203l \306\f!\307\n\"\307\f\n\"\310!\203b \310!\203b \311\"\210+\fS\211\f\202= )	A\211\202 )GS\233\f\241\207" [new tail key subnew old subold vector lookup-key keymapp derived-mode-merge-keymaps vectorp 0 i] 4 (#$ . 6895)])
#@121 Merge an old syntax table into a new one.
Where the new table already has an entry, nothing is copied from the old one.
(defalias 'derived-mode-merge-syntax-tables #[(old new) "\302	\"\207" [new old set-char-table-parent] 3 (#$ . 7448)])
(defalias 'derived-mode-merge-abbrev-tables #[(old new) "\205 \301\302\"\207" [old mapatoms #[(symbol) "\302\303!	\"\206 \304	\303!JK$\207" [symbol new intern-soft symbol-name define-abbrev] 5]] 3])
(provide 'derived)
