Current File : //proc/self/root/kunden/usr/share/emacs/27.2/lisp/tempo.elc |
;ELC
;;; Compiled
;;; in Emacs version 27.2
;;; 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'