Lugaru's Epsilon
Programmer's
Editor

Identifier Completion

Epsilon can finish typing long identifier names for you. If you've typed WM_QUERYEN, for example, Epsilon can insert DSESSION after to finish the name of the Windows message WM_QUERYENDSESSION. Press Alt-= to complete the current word in the buffer manually. You must be at the end of a word. If no in-place completion is possible, Epsilon shows a list of words that start with what you've typed, and you can select one. (Completion is case-sensitive.)

You can also set Epsilon to auto-complete in C/C++/Java/EEL buffers by setting the variable auto-complete to 1. Auto-completion works by noticing whenever you start typing an identifier. As you type, Epsilon consults a list of words and finds those that match what you've typed so far. If there's only one, or if all of them have a certain number of characters in common, Epsilon completes the word for you by inserting as much text as it can, and highlights what it inserted. You can press <Enter> or <Tab> to accept the completion, and Epsilon will move after the inserted text and remove the highlight. Type other text and Epsilon removes the completion before acting on the key. (Or type <Backspace> to remove the completion.) Movement and other keys retain the completion by default; set auto-complete to 2 and they will remove it.

You can also set auto-complete to 3. Epsilon will then display a message like Alt-= changes conti => continue whenever completion is possible, but it won't insert the completion unless you press Alt-=.

Some variables control when Epsilon will check for auto-completion. A word must have at least completion-minimum-start characters before Epsilon will check it. If a completion would add fewer than completion-minimum-add characters, Epsilon ignores it. These variables have no effect on manual completion.

Epsilon gets possible completions from four sources.

First, Epsilon uses all identifiers in the current tag file, loading the tag file if necessary. You can use the select-tag-file command to use a different file. See Tags for more information on tags.

Second, Epsilon scans the current buffer and extracts all its identifiers. (This is useful since a tag file doesn't include local variables.) When Epsilon does auto-completion, it only scans the buffer the first time it tries to complete in a particular buffer. Whenever you use Alt-= to manually complete, Epsilon rescans the buffer to pick up any new identifiers.

Finally, Epsilon consults two files for additional completion words. The file epsilon.xpn is provided with Epsilon and contains keywords for various languages and identifier names from various common libraries. The file custom.xpn, if it exists, can contain your own standard completion words. (You can add to epsilon.xpn too if you like, but you'd have to merge your changes when you get a new version of Epsilon with a new epsilon.xpn.) Invoke Alt-= with a numeric argument (for instance, by typing Alt-<Minus> Alt-=) if you've modified an .xpn file and you want Epsilon to reread it. Epsilon searches for .xpn files according to the EPSPATH configuration variable. See Configuration Variables for more information on Epsilon's searching rules.

The completion-sources variable tells Epsilon which of these four sources to use. Set it to 1 to use only tag names, 2 to only use the current file's identifiers, or 4 or 8 to use only epsilon.xpn or custom.xpn file entries, respectively. Add these values together to use multiple sources. The default value of 15 gets identifier names from all the above sources.

An .xpn file contains possible completion words, one per line. Epsilon ignores anything on the first line, which is normally a comment. Lines starting with any character that isn't valid in an identifier, such as ;, serve as comments.

Lines in an .xpn file starting with =cond are conditions. You can use conditions to tell Epsilon to only use a group of words in certain cases. For instance, Epsilon shouldn't complete on C++ keywords if you're not writing C++.

Every group of one or more adjacent =cond lines begins a block, and the conditions they specify affect all lines until the next =cond line (or the end of the file). If a block starts with more than one condition line, they must all be true for Epsilon to use the names in the block that follows.

Conditions are written using a simple syntax that resembles C or EEL. Each condition line contains one or more terms separated by && or ||. A term consists of the name of an EEL variable, an operator, and a constant value. If the variable is numeric, the constant value must be a decimal number (or 0x1f for hexadecimal, 0o57 for octal, or 0b01100 for binary). If the variable is of string type, the constant value must be text enclosed in double-quote characters (").

For strings, you can use the operators == and != which have their usual meaning. For numbers, you can use those operators and also & (contains the bit pattern) and !& (does not contain the bit pattern).

Conditions are evaluated left to right, with no precedence rules and no parentheses. Each =cond line is evaluated independently.

Standard bindings:

    complete-identifier
 


complete-identifier

Finish typing an identifier.  Alt-=

Type part of the name of an identifier and invoke this command to finish typing it (in C/C++/Java buffers). Epsilon displays possible matches if no completion is possible.

Epsilon determines possible identifier names by reading the current tag file, consulting standard files, and by scanning the current buffer to extract local variable names. It normally scans the buffer just once, when you first use completion in a buffer. Use a numeric argument to tell Epsilon to scan again and pick up new local variables, and to reread its standard files. When automatic completion is on (see auto-complete) manually completing with complete-identifier always rescans the current buffer.



auto-complete: preference variable

Default value: 0

When you begin to type an identifier in a C/C++/Java mode buffer, Epsilon can finish it for you automatically, as if you had pressed Alt-= to run the complete-identifier command. Set this variable to 1 to enable auto-completing.

Auto-completing works by noticing whenever you start typing an identifier. As you type, Epsilon consults a list of words and finds those that match what you've typed so far. If there's only one, or if all of them have a certain number of characters in common, Epsilon completes the word for you by inserting as much text as it can, and highlights what it inserted. You can press <Enter> or <Tab> to accept the completion, and Epsilon will move after the inserted text and remove the highlight. Type other text and Epsilon removes the completion before acting on the key. (Or type <Backspace> to remove the completion.)

Movement and other keys retain the completion by default; set auto-complete to 2 instead and they will remove it. Set auto-complete to 3 and Epsilon won't actually auto-complete; instead it will report in the echo area whenever completion is possible and suggest pressing Alt-= to manually complete.


completion-minimum-start: preference variable

Default value: 3

When auto-completing identifiers, Epsilon doesn't begin to check for a completion until an identifier has at least this many characters.


completion-minimum-add: preference variable

Default value: 2

When auto-completing identifiers, if a completion would add fewer than this number of characters, Epsilon won't insert it.



completion-sources: preference variable

Default value: 15

The completion-sources variable tells Epsilon where it should look when completing identifiers. Set it to 1 to use only the names of identifiers in the current tag file. Set it to 2 to extract identifiers mentioned in the current file. Set it to 4 to use identifiers listed in an epsilon.xpn file, or 8 to use identifiers listed in a custom.xpn file. Add these values together to use multiple sources. The default value of 15 gets completion names from all the above sources.

Copyright (C) 1984, 2000 Lugaru Software Ltd. All Rights Reserved.