%PDF- %PDF-
Direktori : /usr/local/share/emacs/27.2/lisp/emacs-lisp/ |
Current File : //usr/local/share/emacs/27.2/lisp/emacs-lisp/derived.elc |
;ELC ;;; Compiled ;;; in Emacs version 27.2 ;;; with all optimizations. ;;; This file contains utf-8 non-ASCII characters, ;;; and so cannot be loaded into Emacs 22 or earlier. (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (string-lessp emacs-version "23") (error "`%s' was compiled for Emacs 23 or later" #$)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #@50 Construct a mode-hook name based on a MODE name. (defalias 'derived-mode-hook-name #[(mode) "\301\302!\303P!\207" [mode intern symbol-name "-hook"] 3 (#$ . 408)]) (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 (#$ . 652)]) (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 (#$ . 887)]) (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 (#$ . 1158)]) (put 'derived-mode-abbrev-table-name 'byte-optimizer 'byte-compile-inline-expand) #@2452 Create a new mode CHILD which is a variant of an existing mode PARENT. The arguments are as follows: CHILD: the name of the command for the derived mode. PARENT: the name of the command for the parent mode (e.g. `text-mode') or nil if there is no parent. 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. KEYWORD-ARGS: optional arguments in the form of pairs of keyword and value. The following keyword arguments are currently supported: :group GROUP Declare the customization group that corresponds to this mode. The command `customize-mode' uses this. :syntax-table TABLE Use TABLE instead of the default (CHILD-syntax-table). A nil value means to simply use the same syntax-table as the parent. :abbrev-table TABLE Use TABLE instead of the default (CHILD-abbrev-table). A nil value means to simply use the same abbrev-table as the parent. :after-hook FORM A single lisp form which is evaluated after the mode hooks have been run. It should not be quoted. BODY: forms to execute just before running the hooks for the new mode. Do not use `interactive' here. 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. As a more complex example, 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. The new mode runs the hook constructed by the function `derived-mode-hook-name'. See Info node `(elisp)Derived Modes' for more details. (fn CHILD PARENT NAME [DOCSTRING] [KEYWORD-ARGS...] &rest BODY) (defalias 'define-derived-mode '(macro . #[(child parent name &optional docstring &rest body) "\203 ;\204 B\306\n\307=\203 \306\310\311\f!\312P!)\310\311\f!\313P!)\310\311\f!\314P!)\315\211\310\311\f!\316P!)\306\211@ABCDEF\317 @!\203\234 \211A\242\211G\320\267\202\223 \211A\242@\202\230 \211A\242D\306C\202\230 \211A\242E\306B\202\230 \211A\242\202\230 \211A\210)\202R \321\nED%\322\323A\324BB\325\326\327AD\330BB\331\327AD\332\333\334H\"FE\325\335\327FDD\331\327FD\336\327DFE\337\323F\340BBD\325\326\327FD\341BB\331\327FD\342\343\333\344\"DFEB\205.\322\323ED\325\335\327EDD\331\327ED\345\327DF\323E\346BBF\325\326\327ED\347BB\331\327ED\350\343\333\351\"DFEFC\205r\322\323DD\325\335\327DDD\331\327DD\352\327DF\323D\322\353\327DD\354BBDEEF\325\326\327DD\355BB\331\327DD\356\343\333\357\"DFEF\331\327D\360\327\nDF@\205\210\331\327D\361@F\362\306\363\364\n\206\223\365C\366\367\327DE\366\370HE\n\205\322\371\326\327\nD\372BB\331\327D\373\326\327\nD\374BBFE\325\375FD\376F\377BBEB\205\347\201I \302\201J EDDC\325\201K \201L E\201M BBEEC\205\325\201N \201O D\201P BB\201Q D\201R BBE\201S D\201T BBE\257\201U FDE\205#\201V EDD\205/\366\201W DE BBBBBBBB\201X \205N\201Y \201Z \306 E\201[ BBC\201\\ \327ADDC\"BBBBBB\257.\207" [docstring body parent child mode after-hook nil fundamental-mode intern symbol-name "-map" "-syntax-table" "-abbrev-table" t "-hook" keywordp #s(hash-table size 4 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (:group 102 :abbrev-table 112 :syntax-table 125 :after-hook 138)) derived-mode-make-docstring progn defvar (nil) unless get quote ('variable-documentation) put 'variable-documentation format "Hook run after entering %s mode.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" boundp 'definition-name with-no-warnings ((make-sparse-keymap)) ('variable-documentation) 'variable-documentation purecopy "Keymap for `%s'." 'definition-name ((make-syntax-table)) ('variable-documentation) 'variable-documentation "Syntax table for `%s'." 'definition-name define-abbrev-table (nil) ('variable-documentation) 'variable-documentation "Abbrev table for `%s'." 'derived-mode-parent 'custom-mode-group defun (interactive) delay-mode-hooks kill-all-local-variables setq major-mode mode-name if ('mode-class) 'mode-class ('mode-class) keymap-parent set-keymap-parent ((current-local-map)) group hook declare-syntax declare-abbrev abbrev syntax map #1=#:val name let char-table-parent (and parent (not (eq parent (standard-syntax-table)))) set-char-table-parent ((syntax-table)) or abbrev-table-get (:parents) eq (local-abbrev-table) abbrev-table-put (:parents (list local-abbrev-table)) use-local-map set-syntax-table local-abbrev-table append push lambda (delayed-after-hook-functions) run-mode-hooks] 30 (#$ . 1433)])) (byte-code "\300\301\302\303#\210\304\301\305\306#\300\207" [put define-derived-mode edebug-form-spec (&define name symbolp sexp [&optional stringp] [&rest keywordp sexp] def-body) function-put doc-string-elt 4] 4) #@59 Construct a docstring for a new mode if none is provided. (defalias 'derived-mode-make-docstring #[(parent child &optional docstring syntax abbrev) "\306\307 !\310P!)\306\307 !\311P!)\f;\204\277 \204L \312\313$\2039 \312\314%\2032 \315\2023 \316$#\202: \317%\203G \312\320%\"\202H \317$\202\276 \312\321 $\203] %\203] \322\202p $\203f \323\202p %\203o \324\202p \317$\203\205 %\203\205 \312\325$%#\202\235 $\204\217 %\203\234 \312\326$\206\230 %\"\202\235 \317$\204\247 %\203\253 \317\202\254 \327 $\204\267 %\203\273 \327\202\274 \317&\330\331\307\n!!\f\"\204\360 \f \204\323 \332\202\351 \333\330\312\334\331\307 !!\"\f\"?\205\347 \312\335 \"\336Q\312\337\n\"\340R\330\341\f\"\204\377 \f\342\307!\343R\f*\207" [child mode hook map docstring parent intern symbol-name "-map" "-hook" format "Major-mode.\nUses keymap `%s'%s%s." "%s abbrev table `%s'" "," " and" "" " and syntax-table `%s'" "Major mode derived from `%s' by `define-derived-mode'.\nIt inherits all of the parent's attributes, but has its own keymap%s:\n\n `%s'%s\n\nwhich more-or-less shadow%s %s's corresponding table%s." ",\nabbrev table and syntax table" "\nand abbrev table" "\nand syntax table" ", `%s' and `%s'" " and `%s'" "s" string-match regexp-quote "\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 or penultimate step\nduring initialization." "\\\\[{[]" "\n\n\\{" "}" abbrev syntax] 9 (#$ . 7057)]) #@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 (#$ . 8582)]) (put 'derived-mode-setup-function-name 'byte-optimizer 'byte-compile-inline-expand) #@207 Initialize 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 (#$ . 8854)]) #@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 (#$ . 9783)]) #@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 (#$ . 10165)]) #@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 (#$ . 10569)]) #@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 (#$ . 10943)]) #@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 (#$ . 11146)]) #@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 (#$ . 11700)]) (defalias 'derived-mode-merge-abbrev-tables #[(old new) "\205 \301\302\"\207" [old mapatoms #[(symbol) "\302\303! \"\206 \304 \303!JK$\207" [symbol new intern-soft symbol-name define-abbrev] 5]] 3]) (provide 'derived)