;ELC   
;;; Compiled by pot@pot.cnuce.cnr.it on Tue Mar 18 15:37:45 2003
;;; from file /home/pot/gnu/emacs-pretest.new/lisp/derived.el
;;; in Emacs version 21.3
;;; with bytecomp version 2.85.4.1
;;; 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"))

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


#@1262 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 (e.g. `text-mode').
NAME:      a string which will appear in the status line (e.g. "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\306\n\204 \307\310\311\f!\312P!)\310\311\f!\313P!)\310\311\f!\314P!)\310\311\f!\315P!)\316\n#9:;\317\320;\321BB\320:\322BB\3209D\323\3249D\325BB\326\324D\327\324\nDF\330\306\331\nC\332\333\324\nD\334BB\326\324D\335BBE\336\337\324DE\336\340<E\341\342;D\343;\344BBE\345\302\346:DDC\341\347\350:\351BBEE\352\353\354\355\356\357\360\3619E\3629\363BBEE\364BBE\365;D\366:D\336\3539E\367	\370\324DDC\"BBBBBBBBBBBBBBB\257-\207" [docstring body parent child mode hook nil fundamental-mode intern symbol-name "-map" "-syntax-table" "-abbrev-table" "-hook" derived-mode-make-docstring progn defvar ((make-sparse-keymap)) ((make-char-table 'syntax-table nil)) define-abbrev-table quote (nil) put 'derived-mode-parent defun (interactive) if get ('special) ('special t) setq major-mode mode-name unless keymap-parent set-keymap-parent ((current-local-map)) let char-table-parent (and parent (not (eq parent (standard-syntax-table)))) set-char-table-parent ((syntax-table)) when local-abbrev-table mapatoms lambda (symbol) or intern-soft (symbol-name symbol) define-abbrev ((symbol-name symbol) (symbol-value symbol) (symbol-function symbol)) (local-abbrev-table) use-local-map set-syntax-table append run-hooks abbrev syntax map name] 27 (#$ . 618)]))
#@139 Non-nil if the current major mode is derived from one of MODES.
Uses the `derived-mode-parent' property of the symbol to trace backwards.
(defalias 'derived-mode-p #[(&rest modes) "	\n>\204 	\303N\211\204 	)\207" [major-mode parent modes derived-mode-parent] 2 (#$ . 3278)])
#@313 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.
Since major-modes might derive from each other and from `fundamental-mode',
this function is not very useful.  Use `derived-mode-p' instead.
(defalias 'derived-mode-class #[(mode) "\301N\203 \301N\211\202 \207" [mode derived-mode-parent] 3 (#$ . 3565)])
#@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 (#$ . 4002)])
(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 (#$ . 4252)])
(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 (#$ . 4488)])
(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 (#$ . 4760)])
(put 'derived-mode-abbrev-table-name 'byte-optimizer 'byte-compile-inline-expand)
#@59 Construct a docstring for a new mode if none is provided.
(defalias 'derived-mode-make-docstring #[(parent child &optional docstring) "\306\307	!\310P!)\306\307	!\311P!)\306\307	!\312P!)\306\307	!\313P!);\204? \314\315\f&\316\317\307\n!!\"\204w \320=\203X \321\202o \322\316\317\314\323\"!\"?\205m \314\324\"\325Q\314\326\n\"\327R\316\330\"\204\211 \331\307!\332R,\207" [child mode hook abbrev syntax map intern symbol-name "-map" "-syntax-table" "-abbrev-table" "-hook" format "Major mode derived from `%s' 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', `%s' and `%s'\n\nwhich more-or-less shadow %s's corresponding tables." string-match regexp-quote fundamental-mode "\n\nThis mode " "\n\nIn addition to any hooks its parent mode " "`%s'" "`%s' " "might have run,\nthis mode " "runs the hook `%s'" ", as the final step\nduring initialization." "\\\\[{[]" "\n\n\\{" "}" docstring parent] 7 (#$ . 5033)])
#@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 (#$ . 6081)])
(put 'derived-mode-setup-function-name 'byte-optimizer 'byte-compile-inline-expand)
#@207 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 (#$ . 6353)])
#@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 (#$ . 7282)])
#@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 (#$ . 7664)])
#@114 Set the abbrev table for MODE 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 (#$ . 8067)])
#@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 (#$ . 8440)])
#@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 (#$ . 8642)])
#@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 (#$ . 9195)])
(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)
