?
Current Path : /usr/share/emacs/24.3/lisp/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : //usr/share/emacs/24.3/lisp/tempo.elc |
;ELC ;;; Compiled by mockbuild@buildfarm06-new.corp.cloudlinux.com on Fri Oct 11 10:06:31 2024 ;;; from file /builddir/build/BUILD/emacs-24.3/lisp/tempo.el ;;; in Emacs version 24.3.1 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. ;;; This file does not contain utf-8 non-ASCII characters, ;;; and so can be loaded in Emacs versions earlier than 23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301\302\303\304\305\306\307&\210\310\311\302\312\313\314\306\301&\210\310\315\302\316\313\314\306\301&\210\310\317\320\321\313\314\306\301&\210\310\322\302\323\313\314\306\301&\207" [custom-declare-group tempo nil "Flexible template insertion." :prefix "tempo-" :group tools custom-declare-variable tempo-interactive "Prompt user for strings in templates.\nIf this variable is non-nil, `tempo-insert' prompts the\nuser for text to insert in the templates." :type boolean tempo-insert-region "Automatically insert current region when there is a `r' in the template\nIf this variable is nil, `r' elements will be treated just like `p'\nelements, unless the template function is given a prefix (or a non-nil\nargument). If this variable is non-nil, the behavior is reversed.\n\nIn Transient Mark mode, this option is unused." tempo-show-completion-buffer t "If non-nil, show a buffer with possible completions, when only\na partial completion can be found." tempo-leave-completion-buffer "If nil, a completion buffer generated by \\[tempo-complete-tag]\ndisappears at the next keypress; otherwise, it remains forever."] 8) #@226 List of functions to run when inserting a string. Each function is called with a single arg, STRING and should return another string. This could be used for making all strings upcase by setting it to '(upcase), for example. (defvar tempo-insert-string-functions nil (#$ . 1692)) #@60 An association list with tags and corresponding templates. (defvar tempo-tags nil (#$ . 1978)) #@382 A list of locally installed tag completion lists. It is a association list where the car of every element is a symbol whose variable value is a template list. The cdr part, if non-nil, is a function or a regexp that defines the string to match. See the documentation for the function `tempo-complete-tag' for more info. `tempo-tags' is always in the last position in this list. (defvar tempo-local-tags '((tempo-tags)) (#$ . 2080)) #@62 A collection of all the tags defined for the current buffer. (defvar tempo-collection nil (#$ . 2521)) #@54 Indicates if the tag collection needs to be rebuilt. (defvar tempo-dirty-collection t (#$ . 2630)) #@87 A list of marks to jump to with `\[tempo-forward-mark]' and `\[tempo-backward-mark]'. (defvar tempo-marks nil (#$ . 2735)) #@863 The regexp or function used to find the string to match against tags. If `tempo-match-finder' is a string, it should contain a regular expression with at least one \( \) pair. When searching for tags, `tempo-complete-tag' calls `re-search-backward' with this string, and the string between the first \( and \) is used for matching against each string in the tag list. If one is found, the whole text between the first \( and the point is replaced with the inserted template. You will probably want to include \=\= at the end of the regexp to make sure that the string is matched only against text adjacent to the point. If `tempo-match-finder' is a symbol, it should be a function that returns a pair of the form (STRING . POS), where STRING is the string used for matching and POS is the buffer position after which text should be replaced with a template. (defvar tempo-match-finder "\\b\\([[:word:]]+\\)\\=" (#$ . 2865)) #@233 Element handlers for user-defined elements. A list of symbols which are bound to functions that take one argument. This function should return something to be sent to `tempo-insert' if it recognizes the argument, and nil otherwise. (defvar tempo-user-elements nil (#$ . 3800)) #@41 Temporary storage for named insertions. (defvar tempo-named-insertions nil (#$ . 4083)) #@48 Region start when inserting around the region. (defvar tempo-region-start (make-marker) (#$ . 4177)) #@47 Region stop when inserting around the region. (defvar tempo-region-stop (make-marker) (#$ . 4284)) (byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\207" [make-variable-buffer-local tempo-marks tempo-local-tags tempo-match-finder tempo-collection tempo-dirty-collection] 2) #@3049 Define a template. This function creates a template variable `tempo-template-NAME' and an interactive function `tempo-template-NAME' that inserts the template at the point. The created function is returned. NAME is a string that contains the name of the template, ELEMENTS is a list of elements in the template, TAG is the tag used for completion, DOCUMENTATION is the documentation string for the insertion command created, and TAGLIST (a symbol) is the tag list that TAG (if provided) should be added to. If TAGLIST is nil and TAG is non-nil, TAG is added to `tempo-tags'. The elements in ELEMENTS can be of several types: - A string: It is sent to the hooks in `tempo-insert-string-functions', and the result is inserted. - The symbol `p': This position is saved in `tempo-marks'. - The symbol `r': If `tempo-insert' is called with ON-REGION non-nil the current region is placed here. Otherwise it works like `p'. - (p PROMPT <NAME> <NOINSERT>): If `tempo-interactive' is non-nil, the user is prompted in the minibuffer with PROMPT for a string to be inserted. If the optional parameter NAME is non-nil, the text is saved for later insertion with the `s' tag. If there already is something saved under NAME that value is used instead and no prompting is made. If NOINSERT is provided and non-nil, nothing is inserted, but text is still saved when a NAME is provided. For clarity, the symbol `noinsert' should be used as argument. - (P PROMPT <NAME> <NOINSERT>): Works just like the previous tag, but forces `tempo-interactive' to be true. - (r PROMPT <NAME> <NOINSERT>): Like the previous tag, but if `tempo-interactive' is nil and `tempo-insert' is called with ON-REGION non-nil, the current region is placed here. This usually happens when you call the template function with a prefix argument. - (s NAME): Inserts text previously read with the (p ..) construct. Finds the insertion saved under NAME and inserts it. Acts like `p' if tempo-interactive is nil. - `&': If there is only whitespace between the line start and point, nothing happens. Otherwise a newline is inserted. - `%': If there is only whitespace between point and end of line, nothing happens. Otherwise a newline is inserted. - `n': Inserts a newline. - `>': The line is indented using `indent-according-to-mode'. Note that you often should place this item after the text you want on the line. - `r>': Like `r', but it also indents the region. - (r> PROMPT <NAME> <NOINSERT>): Like (r ...), but is also indents the region. - `n>': Inserts a newline and indents line. - `o': Like `%' but leaves the point before the newline. - nil: It is ignored. - Anything else: It is evaluated and the result is treated as an element to be inserted. One additional tag is useful for these cases. If an expression returns a list '(l foo bar), the elements after `l' will be inserted according to the usual rules. This makes it possible to return several elements from one expression. (defalias 'tempo-define-template #[(name elements &optional tag documentation taglist) "\306\307P!\211 L\210\n\310\311\312D\f\206 \313\314Q\315\316D\317\320 D\321\322\323\312D\312FE\257M\210 \2037 \324 #\210\n*\207" [name template-name command-name elements documentation tag intern "tempo-template-" lambda &optional arg "Insert a " "." interactive "*P" tempo-insert-template quote if tempo-insert-region not tempo-add-tag taglist] 12 (#$ . 4590)]) #@229 Insert a template. TEMPLATE is the template to be inserted. If ON-REGION is non-nil the `r' elements are replaced with the current region. In Transient Mark mode, ON-REGION is ignored and assumed true if the region is active. (defalias 'tempo-insert-template #[(template on-region) "\306\216\307\300!\203 \203 \203 \310\n\203( \311 `^\312\223\203( \f\311 `]\312\223\210\n\203/ b\210\212\313\314 !\210\315\316 J\"\210\313\314 !\210)\317 )\207" [transient-mark-mode mark-active on-region tempo-region-start tempo-region-stop template ((byte-code "\305 \210\306\300!\203\212 \203\212 \307\204 \205\210 \n\310=\203$ \242\310=\202% \n\203] \311 \203] \312 \203] \203@ \313\314\"\210\307\202] \315 \316 U\204] \317\314!\204T \320\314!\204] \313\314\315 \316 {\"\210 \204y \321=\204s \242\310=\203y A\204y \307\211\202\210 \242\310=\203\203 A\307\322\323!)\210\307\207" [transient-mark-mode force select-active-regions saved-region-selection mark-active tempo-forget-insertions boundp nil only region-active-p display-selections-p x-set-selection PRIMARY region-beginning region-end x-selection-owner-p x-selection-exists-p lambda run-hooks deactivate-mark-hook] 4)) boundp t mark nil tempo-insert-mark point-marker mapc #[(elt) "\302 \"\207" [elt on-region tempo-insert] 3] tempo-forward-mark] 3 (#$ . 8105)]) #@225 Insert a template element. Insert one element from a template. If ON-REGION is non-nil the `r' elements are replaced with the current region. See documentation for `tempo-define-template' for the kind of elements possible. (defalias 'tempo-insert #[(element on-region) ";\203 \304!\207:\203 @\305=\203 \306A!\207:\203. @\307=\203. \310\306A!)\207:\203F @\311=\203F \n\203A b\207\306A!\207:\203e @\312=\203e \n\203` b\210\313\314 `\315#\207\306A!\207:\203w @\316=\203w \317A@!\207:\203\211 @\320=\203\211 \321\322A\"\207\305=\203\224 \323\324 !\207\311=\203\246 \n\203\241 b\207\323\324 !\207\312=\203\277 \n\203\272 b\210\313\314 `\315#\207\323\324 !\207\325=\203\310 \326 \207\327=\203\342 i\330U\206\333 \212\331\332\315\310#)?\205=\333c\207\334=\203\372 l\206\363 \212\335\336\315\310#)?\205=\333c\207\337=\203\333c\207\340=\203\333c\210\326 \207\341=\203,\n\206$l\206$\212\335\336\315\310#)?\205=\342\343!\207?\206=\344\345!\206;\346!\n\"\207" [element tempo-interactive on-region tempo-region-stop tempo-process-and-insert-string p tempo-insert-prompt-compat P t r r> indent-region mark nil s tempo-insert-named l mapcar #[(elt) "\302 \"\207" [elt on-region tempo-insert] 3] tempo-insert-mark point-marker > indent-according-to-mode & 0 re-search-backward "^\\s-*\\=" "\n" % re-search-forward "\\=\\s-*$" n n> o open-line 1 tempo-insert tempo-is-user-element eval] 4 (#$ . 9444)]) #@142 Compatibility hack for `tempo-insert-prompt'. PROMPT can be either a prompt string, or a list of arguments to `tempo-insert-prompt', or nil. (defalias 'tempo-insert-prompt-compat #[(prompt) ":\203\n \301\302\"\207\302!\207" [prompt apply tempo-insert-prompt] 3 (#$ . 10891)]) #@572 Prompt for a text string and insert it in the current buffer. If the variable `tempo-interactive' is non-nil the user is prompted for a string in the minibuffer, which is then inserted in the current buffer. If `tempo-interactive' is nil, the current point is placed on `tempo-mark'. PROMPT is the prompt string, SAVE-NAME is a name to save the inserted text under. If the optional argument NO-INSERT is non-nil, no text is inserted. This can be useful when there is a SAVE-NAME. If there already is a value for SAVE-NAME, it is used and the user is never prompted. (defalias 'tempo-insert-prompt #[(prompt &optional save-name no-insert) "\306\205 \307! \203 \204 \310!\202H \203 \306\202H \f\203D ;\204. \311\312 \"\210\313 !\2049 \nc\210\205H \314\n\"\202H \315\316 !*\207" [save-name previous insertion no-insert tempo-interactive prompt nil tempo-lookup-named tempo-insert-named error "tempo: The prompt (%s) is not a string" read-string tempo-save-named tempo-insert-mark point-marker] 3 (#$ . 11177)]) #@71 Tries all the user-defined element handlers in `tempo-user-elements'. (defalias 'tempo-is-user-element #[(element) "\300\301\215\207" [found (byte-code "\301\302\"\210\303\304\305\"\207" [tempo-user-elements mapc #[(handler) " !\211\205\f \303\304\n\")\207" [handler element result throw found] 4] throw found nil] 3)] 2 (#$ . 12212)]) #@40 Forget all the saved named insertions. (defalias 'tempo-forget-insertions #[nil "\301\211\207" [tempo-named-insertions nil] 2 (#$ . 12557)]) #@235 Save some data for later insertion The contents of DATA is saved under the name NAME. The data can later be retrieved with `tempo-lookup-named'. This function returns nil, so it can be used in a template without inserting anything. (defalias 'tempo-save-named #[(name data) " B\nB\303\207" [name data tempo-named-insertions nil] 2 (#$ . 12706)]) #@100 Lookup some saved data under the name NAME. Returns the data if NAME was found, and nil otherwise. (defalias 'tempo-lookup-named #[(name) " \236A\207" [name tempo-named-insertions] 2 (#$ . 13063)]) #@213 Insert the previous insertion saved under a named specified in NAME. If there is no such name saved, a tempo mark is inserted. Note that if the data is a string, it will not be run through the string processor. (defalias 'tempo-insert-named #[(name) "\302!\211\204 \303\304 !\202 ;\203 c\202 \305 \306\")\207" [name insertion tempo-lookup-named tempo-insert-mark point-marker tempo-insert nil] 4 (#$ . 13269)]) #@132 Insert a string from a template. Run a string through the preprocessors in `tempo-insert-string-functions' and insert the results. (defalias 'tempo-process-and-insert-string #[(string) "\2034 9\203 !\2024 <\203/ \304\211\203+ @\211 !A\211\204 *\2024 \305\306\"\210 c\207" [tempo-insert-string-functions string fn --dolist-tail-- nil error "Bogus value in tempo-insert-string-functions: %s"] 4 (#$ . 13696)]) #@54 Insert a mark `tempo-marks' while keeping it sorted. (defalias 'tempo-insert-mark #[(mark) "\204 C\211\207 @W\203 B\211\207\211A\203, \nA@ X\203, \nA\211\202 \n@U?\205: \n \nAB\241)\207" [tempo-marks mark lp] 4 (#$ . 14127)]) #@53 Jump to the next mark in `tempo-forward-mark-list'. (defalias 'tempo-forward-mark #[nil "\301\302\215\211\205\n b)\207" [next-mark found (byte-code "\301\302\"\210\303\207" [tempo-marks mapc #[(mark) "`W\205\n \301\302\"\207" [mark throw found] 3] nil] 3)] 3 (#$ . 14373) nil]) #@54 Jump to the previous mark in `tempo-back-mark-list'. (defalias 'tempo-backward-mark #[nil "\301\302\215\211\205\n b)\207" [prev-mark found (byte-code "\302\303\304 \"\210)\207" [last tempo-marks nil mapc #[(mark) "`X\203 \302\303 \"\210\211\207" [mark last throw found] 3]] 3)] 3 (#$ . 14662) nil]) #@131 Add a template tag. Add the TAG, that should complete to TEMPLATE to the list in TAG-LIST, or to `tempo-tags' if TAG-LIST is nil. (defalias 'tempo-add-tag #[(tag template &optional tag-list) "\204 \303\304 J\"\204 \nBJBL\210\305 \207" [tag-list tag template tempo-tags assoc tempo-invalidate-collection] 3 (#$ . 14976) "sTag: \nCTemplate: "]) #@490 Install TAG-LIST to be used for template completion in the current buffer. TAG-LIST is a symbol whose variable value is a tag list created with `tempo-add-tag'. COMPLETION-FUNCTION is an obsolete option for specifying an optional function or string that is used by `\[tempo-complete-tag]' to find a string to match the tag against. It has the same definition as the variable `tempo-match-finder'. In this version, supplying a COMPLETION-FUNCTION just sets `tempo-match-finder' locally. (defalias 'tempo-use-tag-list #[(tag-list &optional completion-function) " \236\211\203 \n\241\210\202 B B)\203 \305 \207" [tag-list tempo-local-tags old completion-function tempo-match-finder tempo-invalidate-collection] 3 (#$ . 15334)]) #@87 Marks the tag collection as obsolete. Whenever it is needed again it will be rebuilt. (defalias 'tempo-invalidate-collection #[nil "\301\211\207" [tempo-dirty-collection t] 2 (#$ . 16080)]) #@117 Build a collection of all the tags and return it. If `tempo-dirty-collection' is nil, the old collection is reused. (defalias 'tempo-build-collection #[nil "\204 \206 \303\304\305\306\n\"\"\211\307\207" [tempo-dirty-collection tempo-collection tempo-local-tags apply append mapcar #[(tag-list) "\301@!\207" [tag-list eval] 2] nil] 5 (#$ . 16278)]) #@149 Find a string to be matched against a tag list. FINDER is a function or a string. Returns (STRING . POS), or nil if no reasonable string is found. (defalias 'tempo-find-match-string #[(finder) ";\203 \302\212\303\302\304#) \205 \305\224\305\225{\305\224B)\207 \207" [finder successful nil re-search-backward t 1] 4 (#$ . 16640)]) #@705 Look for a tag and expand it. All the tags in the tag lists in `tempo-local-tags' (this includes `tempo-tags') are searched for a match for the text before the point. The way the string to match for is determined can be altered with the variable `tempo-match-finder'. If `tempo-match-finder' returns nil, then the results are the same as no match at all. If a single match is found, the corresponding template is expanded in place of the matching string. If a partial completion or no match at all is found, and SILENT is non-nil, the function will give a signal. If a partial completion is found and `tempo-show-completion-buffer' is non-nil, a buffer containing possible completions is displayed. (defalias 'tempo-complete-tag #[(&optional silent) "\306 \307 !\211@\nA\310\"\211@\206 \n\205 \311\"\211\203) \f`|\210\n\2047 \206 \312 \202 \204F \206 \312 \202 \313=\203X \314\310\"A\315\"\202 \310\"\211\203j \314 A\315\"\202 c\210\204v \312 \210\205 \316\".\207" [collection tempo-match-finder match-info match-string match-start exact tempo-build-collection tempo-find-match-string assoc try-completion ding t tempo-insert-template nil tempo-display-completions compl silent tempo-show-completion-buffer] 5 (#$ . 16985) "*"]) #@59 Show a buffer containing possible completions for STRING. (defalias 'tempo-display-completions #[(string tag-list) "\203<