First type the Ctrl-x Ctrl-e 'eval expression' command. In the mini-buffer you can enter expressions which are C expressions. Typically the following forms are valid:
In this context, the Tab key can be used to expand the Smac functions, user functions and variables names. If the mini-buffer is empty, a complete list of these is displayed in the message box.
ATTENTION Don't forget the semicolon ';' at the end of the C expression you want to evaluate, otherwise you will get a parser error line 0: syntax error message.
\_
char (190);
Inserts the argument at the current position.The
function insert\_
char is one of the
built-in functions available in Smac to drive the
editor. This example shows how to insert a special
character (via its ASCII code).
This example shows how to change font in Latex mode.
\_
shell ( "date |
awk
'{
print $4}'
");
cmd\_
shell is a built-in editor function.
The argument is executed in a sub-shell and the
result is inserted at the current position.
\_
window (new\_
window
());read\_
file (file\_
select());
Opens a new text window, selects it, selects a file from a file-selector and loads it. Obviously it is easier to use the Window menu, but this example shows the Smac facilities to interpret built-in editor functions through an eval expression command.
\_
def ("C-mode", "^
xe",
"goto\_
end\_
of\_
file" );
In C-mode, binds goto\_
end\_
of\_
file
function to Ctrl-x e. The second argument syntax
(key\_
binding), can be:
"c" --> key. "^[c" --> Esc key. "^[^c" --> Esc Ctrl key. "^c" --> Ctrl-key. "^xc" --> Ctrl-x key. "^x^c" --> Ctrl-x Ctrl-key.
where `c'
is any character except `^'
.
Furthermore `^^'
appoints the character
`^'
(so ^x^^
is Ctrl-x ^
),
`^ '
and `^@'
appoint the character
null (code 0).
It is also possible to bind keysym keys such as Home:
"k" --> key. "^[k" --> Esc key. "^xk" --> Ctrl-x key.
where `k'
is a keysym name (see §7.3.11 page ).