;ELC
;;; Compiled
;;; in Emacs version 27.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\312\313\314DD\315\316\317\306\301&\210\310\320\312\313\321DD\322\316\317\306\301&\210\310\323\312\313\324DD\325\316\317\306\301&\210\310\326\312\313\327DD\330\316\317\306\301&\207" [custom-declare-group tempo nil "Flexible template insertion." :prefix "tempo-" :group tools custom-declare-variable tempo-interactive funcall function #[0 "\300\207" [nil] 1] "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 #[0 "\300\207" [nil] 1] "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 #[0 "\300\207" [t] 1] "If non-nil, show a buffer with possible completions, when only\na partial completion can be found." tempo-leave-completion-buffer #[0 "\300\207" [nil] 1] "If nil, a completion buffer generated by \\[tempo-complete-tag]\ndisappears at the next keypress; otherwise, it remains forever."] 8)
#@225 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 (#$ . 1701))
#@60 An association list with tags and corresponding templates.
(defvar tempo-tags nil (#$ . 1986))
#@383 A list of locally installed tag completion lists.
It is an 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)) (#$ . 2088))
(make-variable-buffer-local 'tempo-local-tags)
#@62 A collection of all the tags defined for the current buffer.
(defvar tempo-collection nil (#$ . 2577))
(make-variable-buffer-local 'tempo-collection)
#@54 Indicates if the tag collection needs to be rebuilt.
(defvar tempo-dirty-collection t (#$ . 2733))
(make-variable-buffer-local 'tempo-dirty-collection)
#@87 A list of marks to jump to with `\[tempo-forward-mark]' and `\[tempo-backward-mark]'.
(defvar tempo-marks nil (#$ . 2891))
(make-variable-buffer-local 'tempo-marks)
#@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:]]+\\)\\=" (#$ . 3063))
(make-variable-buffer-local 'tempo-match-finder)
#@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 (#$ . 4047))
#@41 Temporary storage for named insertions.
(defvar tempo-named-insertions nil (#$ . 4330))
(make-variable-buffer-local 'tempo-named-insertions)
#@48 Region start when inserting around the region.
(defvar tempo-region-start (make-marker) (#$ . 4477))
(make-variable-buffer-local 'tempo-region-start)
#@47 Region stop when inserting around the region.
(defvar tempo-region-stop (make-marker) (#$ . 4633))
(make-variable-buffer-local 'tempo-region-stop)
#@3273 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: Each function in `tempo-user-elements' is called
with it as argument until one of them returns non-nil, and the
result is inserted. If all of them return nil, 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.
(fn NAME ELEMENTS &optional TAG DOCUMENTATION TAGLIST)
(defalias 'tempo-define-template #[1282 "\300\301P!\211L\210\211\302\303\304D\206 \305\n\306Q\307\310D\311\312D\313\314\315\304D\304FE\257M\210\2039 \316#\210\207" [intern "tempo-template-" lambda &optional arg "Insert a " "." interactive "*P" tempo-insert-template quote if tempo-insert-region not tempo-add-tag] 18 (#$ . 4788)])
#@254 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.
(fn TEMPLATE ON-REGION)
(defalias 'tempo-insert-template #[514 "\211C\304\216\203 \203 \211\305\240\210\211\242\203' \n\306 `^\307\223\203' \306 `]\307\223\210\211\242\203/ \nb\210\212\310\311 !\210\312\313\314\315\316\317!\320\"\321\322%J\"\210\310\311 !\210)\323 )\207" [transient-mark-mode mark-active tempo-region-start tempo-region-stop #[0 "\301 \210\205 \302 \207" [transient-mark-mode tempo-forget-insertions deactivate-mark] 1] t mark nil tempo-insert-mark point-marker mapc make-byte-code 257 "\301\300\242\"\207" vconcat vector [tempo-insert] 4 "\n\n(fn ELT)" tempo-forward-mark] 10 (#$ . 8414)])
#@249 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.
(fn ELEMENT ON-REGION)
(defalias 'tempo-insert #[514 ";\203 \302!\207:\203 @\303=\203 \304A!\207:\203. @\305=\203. \306\304A!)\207:\203F @\307=\203F \211\203A b\207\304A!\207:\203e @\310=\203e \211\203` b\210\311\312 `\313#\207\304A!\207:\203w @\314=\203w \315A@!\207:\203\225 @\316=\203\225 \317\320\321\322\323\324!\325\"\326\327%A\"\207\330\267\202\331\332 !\207\211\203\247 b\207\331\332 !\207\211\203\272 b\210\311\312 `\313#\207\331\332 !\207\333 \207i\334U\206\317 \212\335\336\313\306#)?\205\337c\207l\206\341 \212\340\341\313\306#)?\205\337c\207\337c\207\337c\210\333 \207\211\206 l\206 \212\340\341\313\306#)?\205\342\343!\207?\206\344\345!\206\346!\"\207" [tempo-interactive 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 make-byte-code 257 "\301\300\"\207" vconcat vector [tempo-insert] 4 "\n\n(fn ELT)" #s(hash-table size 9 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (p 155 r 160 r> 172 > 191 & 194 % 214 n 232 n> 235 o 241)) tempo-insert-mark point-marker indent-according-to-mode 0 re-search-backward "^\\s-*\\=" "\n" re-search-forward "\\=\\s-*$" open-line 1 tempo-insert tempo-is-user-element eval] 9 (#$ . 9269)])
#@155 Compatibility hack for `tempo-insert-prompt'.
PROMPT can be either a prompt string, or a list of arguments to
`tempo-insert-prompt', or nil.
(fn PROMPT)
(defalias 'tempo-insert-prompt-compat #[257 "\211:\203\n \300\301\"\207\301!\207" [apply tempo-insert-prompt] 4 (#$ . 10798)])
#@615 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.
(fn PROMPT &optional SAVE-NAME NO-INSERT)
(defalias 'tempo-insert-prompt #[769 "\301\205 \302!\211\203 \204 \303!\202H \211\203 \301\202H \203D ;\204- \304\305\"\210\306!\262\2049 c\210\205H \307\"\202H \310\311 !\207" [tempo-interactive 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] 8 (#$ . 11088)])
#@85 Tries all the user-defined element handlers in `tempo-user-elements'.
(fn ELEMENT)
(defalias 'tempo-is-user-element #[257 "\3012 \302\303\304\305\306\307!\310\"\311\312%\"\210\313\301\314\"0\207" [tempo-user-elements found mapc make-byte-code 257 "\211\300!\211\205 \301\302\"\207" vconcat vector [throw found] 5 "\n\n(fn HANDLER)" throw nil] 8 (#$ . 12090)])
#@40 Forget all the saved named insertions.
(defalias 'tempo-forget-insertions #[0 "\301\211\207" [tempo-named-insertions nil] 2 (#$ . 12463)])
#@251 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.
(fn NAME DATA)
(defalias 'tempo-save-named #[514 "BB\301\207" [tempo-named-insertions nil] 4 (#$ . 12610)])
#@111 Lookup some saved data under the name NAME.
Returns the data if NAME was found, and nil otherwise.
(fn NAME)
(defalias 'tempo-lookup-named #[257 "\211\236A\207" [tempo-named-insertions] 3 (#$ . 12964)])
#@224 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.
(fn NAME)
(defalias 'tempo-insert-named #[257 "\300!\211\204 \301\302 !\202 \211;\203 \211c\202 \303\304\"\207" [tempo-lookup-named tempo-insert-mark point-marker tempo-insert nil] 5 (#$ . 13176)])
#@145 Insert a string from a template.
Run a string through the preprocessors in `tempo-insert-string-functions'
and insert the results.
(fn STRING)
(defalias 'tempo-process-and-insert-string #[257 "\2032 9\203 !\262\2022 <\203- \211\203) \211@\211!\262A\266\202\202 \210\2022 \301\302\"\210\211c\207" [tempo-insert-string-functions error "Bogus value in tempo-insert-string-functions: %s"] 5 (#$ . 13600)])
#@65 Insert a mark `tempo-marks' while keeping it sorted.
(fn MARK)
(defalias 'tempo-insert-mark #[257 "\204 \211C\211\207\211@W\203 \211B\211\207\211A\203+ \211A@X\203+ \211A\262\202 @U?\2059 \211AB\241\207" [tempo-marks] 5 (#$ . 14022)])
#@53 Jump to the next mark in `tempo-forward-mark-list'.
(defalias 'tempo-forward-mark #[0 "\3012 \302\303\"\210\3040\211\205 \211b\207" [tempo-marks found mapc #[257 "`W\205\n \300\301\"\207" [throw found] 4 "\n\n(fn MARK)"] nil] 3 (#$ . 14279) nil])
#@54 Jump to the previous mark in `tempo-back-mark-list'.
(defalias 'tempo-backward-mark #[0 "\3012 \302C\303\304\305\306\307\310!\311\"\312\313%\"\210\211\242\2620\211\205\"