;ELC ;;; compiled by rms@mole.gnu.ai.mit.edu on Sun Jun 5 15:32:31 1994 ;;; from file /home/fsf/rms/e19/lisp/derived.el ;;; emacs version 19.25.5. ;;; 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"))) (error "`/home/fsf/rms/e19/lisp/derived.el' was compiled for Emacs 19")) (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 "\ Create a new mode as a variant of an existing mode. The arguments to this command are as follow: PARENT: the name of the command for the parent mode (ie. text-mode). CHILD: the name of the command for the derived 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 'derived-mode-class #[(mode) "ÁNƒÁN‰‚‡" [mode derived-mode-parent] 3 "\ 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-setup-function-name #[(mode) "ÀÁ\n!ÃP!‡" [intern symbol-name mode "-setup"] 3 "\ Construct a setup-function name based on a mode name."]) (put (quote derived-mode-setup-function-name) (quote byte-optimizer) (quote byte-compile-inline-expand)) (defalias 'derived-mode-hooks-name #[(mode) "ÀÁ\n!ÃP!‡" [intern symbol-name mode "-hooks"] 3 "\ Construct a hooks name based on a mode name."]) (put (quote derived-mode-hooks-name) (quote byte-optimizer) (quote byte-compile-inline-expand)) (defalias 'derived-mode-map-name #[(mode) "ÀÁ\n!ÃP!‡" [intern symbol-name mode "-map"] 3 "\ Construct a map name based on a mode name."]) (put (quote derived-mode-map-name) (quote byte-optimizer) (quote byte-compile-inline-expand)) (defalias 'derived-mode-syntax-table-name #[(mode) "ÀÁ\n!ÃP!‡" [intern symbol-name mode "-syntax-table"] 3 "\ Construct a syntax-table name based on a mode name."]) (put (quote derived-mode-syntax-table-name) (quote byte-optimizer) (quote byte-compile-inline-expand)) (defalias 'derived-mode-abbrev-table-name #[(mode) "ÀÁ\n!ÃP!‡" [intern symbol-name mode "-abbrev-table"] 3 "\ Construct an abbrev-table name based on a mode name."]) (put (quote derived-mode-abbrev-table-name) (quote byte-optimizer) (quote byte-compile-inline-expand)) (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-vector 256 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 "\ 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-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 "\ Construct a docstring for a new mode if none is provided."]) (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] 4 "\ Set the keymap 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 "\ Set the syntax table of the new mode, maybe merging with the parent."]) (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 "\ Set the abbrev table if it exists. Always merge its parent into it, since the merge is non-destructive."]) (defalias 'derived-mode-run-hooks #[(mode) "ÁÂ!ÃP!)Å\f!…Æ\f!)‡" [mode intern symbol-name "-hooks" hooks-name boundp run-hooks] 3 "\ Run the hooks if they exist."]) (defalias 'derived-mode-merge-keymaps #[(old new) "GS› ¡‡" [new old] 2 "\ Merge an old keymap into a new one. The old keymap is set to be the cdr of the new one, so that there will be automatic inheritance."]) (defalias 'derived-mode-merge-syntax-tables #[(old new) "À G\nG^‰ W…\" \fH„ \f\n\fHIˆ\fT‰‚ *‡" [0 new old end idx] 5 "\ Merge an old syntax table into a new one. Where the new table already has an entry, nothing is copied from the old one."]) (byte-code "ÀÁÂ\"ˆÃÄ!‡" [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 derived] 3)