;ELC   
;;; compiled by roland@churchy.gnu.ai.mit.edu on Wed Oct 25 12:38:08 1995
;;; from file /gd/gnu/emacs/19.0/lisp/derived.el
;;; emacs version 19.29.1.3.
;;; bytecomp version FSF 2.10
;;; optimization is on.
;;; this file uses opcodes which do not exist in Emacs 18.

(if (and (boundp 'emacs-version)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19.28.90")))
    (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) "ƒ ;„ 	BÂ† Ã\f\"ÆÇÈDDÉÂÊ\fCËÌÈ\fDÍBBÎÈDÏBBEÐÑÈDEÐÒEÔÈDDÕÈDDÖÈDD×	ØÈDDC\"BBBBBBBBBBBBE‡" [docstring body nil derived-mode-make-docstring parent child progn derived-mode-init-mode-variables quote defun (interactive) if get ((quote special)) put ((quote special) t) setq major-mode mode-name name derived-mode-set-keymap derived-mode-set-syntax-table derived-mode-set-abbrev-table append derived-mode-run-hooks] 19 (#$ . 483)]))
#@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) "ÁNƒ ÁN‰‚ ‡" [mode derived-mode-parent] 3 (#$ . 2287)])
#@55 Construct a setup-function name based on a mode name.
(defalias 'derived-mode-setup-function-name #[(mode) "ÀÁ\n!ÃP!‡" [intern symbol-name mode "-setup"] 3 (#$ . 2565)])
(put (quote derived-mode-setup-function-name) (quote byte-optimizer) (quote byte-compile-inline-expand))
#@46 Construct a hooks name based on a mode name.
(defalias 'derived-mode-hooks-name #[(mode) "ÀÁ\n!ÃP!‡" [intern symbol-name mode "-hooks"] 3 (#$ . 2846)])
(put (quote derived-mode-hooks-name) (quote byte-optimizer) (quote byte-compile-inline-expand))
#@44 Construct a map name based on a mode name.
(defalias 'derived-mode-map-name #[(mode) "ÀÁ\n!ÃP!‡" [intern symbol-name mode "-map"] 3 (#$ . 3100)])
(put (quote derived-mode-map-name) (quote byte-optimizer) (quote byte-compile-inline-expand))
#@53 Construct a syntax-table name based on a mode name.
(defalias 'derived-mode-syntax-table-name #[(mode) "ÀÁ\n!ÃP!‡" [intern symbol-name mode "-syntax-table"] 3 (#$ . 3346)])
(put (quote derived-mode-syntax-table-name) (quote byte-optimizer) (quote byte-compile-inline-expand))
#@54 Construct an abbrev-table name based on a mode name.
(defalias 'derived-mode-abbrev-table-name #[(mode) "ÀÁ\n!ÃP!‡" [intern symbol-name mode "-abbrev-table"] 3 (#$ . 3628)])
(put (quote derived-mode-abbrev-table-name) (quote byte-optimizer) (quote 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) "À	ÂÃ	!ÄP!)!„2 ÅÆ	ÂÃ	!ÄP!)ÇÈÉ	\"F!ˆÊ	ÂÃ	!ÄP!)ËÌ#ˆÀ	ÂÃ	!ÍP!)!„d ÅÆ	ÂÃ	!ÍP!)ÎÈÏ	\"F!ˆÊ	ÂÃ	!ÍP!)ËÌ#ˆÀ	ÂÃ	!ÐP!)!ƒu Ì‡ÅÆ	ÂÃ	!ÐP!)ÑÈÒ	\"F!‡" [boundp mode intern symbol-name "-map" eval defvar (make-sparse-keymap) format "Keymap for %s." put derived-mode-unmerged t "-syntax-table" (make-char-table (quote 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 (#$ . 3912)])
#@59 Construct a docstring for a new mode if none is provided.
(defalias 'derived-mode-make-docstring #[(parent child) "ÀÁ\n‰\n‰&‡" [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}" parent child] 8 (#$ . 4675)])
#@64 Set the keymap of the new mode, maybe merging with the parent.
(defalias 'derived-mode-set-keymap #[(mode) "ÁÂ!ÃP!)Å\f!Ç ‰ƒ% \fÉNƒ% Ê\"ˆË\fÉÌ#ˆÍ!+‡" [mode intern symbol-name "-map" map-name eval new-map current-local-map old-map derived-mode-unmerged derived-mode-merge-keymaps put nil use-local-map] 5 (#$ . 5139)])
#@70 Set the syntax table of the new mode, maybe merging with the parent.
(defalias 'derived-mode-set-syntax-table #[(mode) "ÁÂ!ÃP!)Å Ç\f!\fÉNƒ! Ê\"ˆË\fÉÌ#ˆÍ!+‡" [mode intern symbol-name "-syntax-table" table-name syntax-table old-table eval new-table derived-mode-unmerged derived-mode-merge-syntax-tables put nil set-syntax-table] 4 (#$ . 5476)])
#@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) "ÁÂ!ÃP!)Ç\f!É\"ˆ‰+‡" [mode intern symbol-name "-abbrev-table" table-name local-abbrev-table old-table eval new-table derived-mode-merge-abbrev-tables] 3 (#$ . 5841)])
#@30 Run the hooks if they exist.
(defalias 'derived-mode-run-hooks #[(mode) "ÁÂ!ÃP!)Å\f!… Æ\f!)‡" [mode intern symbol-name "-hooks" hooks-name boundp run-hooks] 3 (#$ . 6186)])
#@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) "‰:ƒ| 	@:ƒ3 Â	@@!Ä\"Ä\"È!ƒ2 È!ƒ2 É\"ˆ+Ê	@!ƒu 	@GS‰ÌYƒt Â!Ä\"Ä\"È!ƒj È!ƒj É\"ˆ+S‰‚A )	A‰‚ )GS›¡‡" [new tail vector key lookup-key subnew old subold keymapp derived-mode-merge-keymaps vectorp i 0] 4 (#$ . 6371)])
#@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) "ÀÁ\n\"‡" [map-char-table #[(key value) "À	\n\"†\f Ã	\n\f#‡" [char-table-range new key set-char-table-range value] 4] old] 3 (#$ . 6823)])
(defalias 'derived-mode-merge-abbrev-tables #[(old new) "… ÁÂ\"‡" [old mapatoms #[(symbol) "ÀÁ\n!\"† ÄÁ\n!\nJ\nK$‡" [intern-soft symbol-name symbol new define-abbrev] 5]] 3])
(provide (quote derived))
