| www.delorie.com/gnu/docs/emacs/sc_27.html | search |
![]() Buy the book! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Regi works by interpreting frames with the function
regi-interpret. A frame is a list of arbitrary size where each
element is a entry of the following form:
(pred func [negate-p [case-fold-search]]) |
Regi starts with the first entry in a frame, evaluating the pred
of that entry against the beginning of the line that `point' is on.
If the pred evaluates to true (or false if the optional
negate-p is non-nil), then the func for that entry is
evaluated. How processing continues is determined by the return
value for func, and is described below. If pred was false
the next entry in the frame is checked until all entries have been
matched against the current line. If no entry matches, `point' is
moved forward one line and the frame is reset to the first entry.
pred can be a string, a variable, a list or one of the following
symbols: t, begin, end, or every. If
pred is a string, or a variable or list that evaluates to a
string, it is interpreted as a regular expression. This regexp is
matched against the current line, from the beginning, using
looking-at. This match folds case if the optional
case-fold-search is non-nil. If pred is not a
string, or does not evaluate to a string, it is interpreted as a
binary value (nil or non-nil).
The four special symbol values for pred are recognized:
t
begin
end
every
Note that negate-p and case-fold-search are ignored if pred is one of these special symbols. Only the first occurrence of each symbol in a frame is used; any duplicates are ignored. Also note that for performance reasons, the entries associated with these symbols are removed from the frame during the main interpreting loop.
Your func can return certain values which control continued Regi
processing. By default, if your func returns nil (as it
should be careful to do explicitly), Regi will reset the frame to the
first entry, and advance `point' to the beginning of the next line.
If a list is returned from your function, it can contain any combination
of the following elements:
continue
abort
end
entry is still processed.
(frame . newframe)
(step . step)
During execution of your func, the following variables will be temporarily bound to some useful information:
curline
looking-at, as a string.
curframe
curentry
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |