Next: , Previous: Editing, Up: Editing


2.1 Completion

Sepia implements partial-word completion that communicates with the inferior Perl process. For example, `%S:X:v_u' completes to `%Sepia::Xref::var_use' when Sepia is loaded. This completion only operates on functions and global variables known to the Perl interpreter, so it works best when code and interpreter are in sync.

More precisely, completion examines the text before point and tries each of the following in turn, using the first successful approach:

  1. If the text looks like a method call (e.g. `$object->f' or `Class->f'), complete on methods.
  2. If it looks like a variable (e.g. `%hash' or `$scalar'), complete on variables.
  3. Complete on modules and functions.
  4. Otherwise, complete on Perl built-in operators.

For each of the first three cases, completions candidates are first generated by splitting the text on characters [:_] and matching the resulting word parts. For example, `X:a_b' will complete to all symbols matching `^X[^:]*:+a[^:_]*_b' such as `Xref::a_bug' and `X::always_bites_me'. If no matches result, the text is treated as an acronym. For example, `dry' will complete to `dont_repeat_yourself'.

Completion is performed by the following commands:

M-x sepia-complete-symbol
Complete the symbol before point as described above. Note that this does not consider lexical scope, and is always case-sensitive, independent of completion-ignore-case.
TAB
M-x sepia-indent-or-complete
First try to reindent the current line. If its indentation does not change, then try to expand an abbrev at point (unless sepia-indent-expand-abbrev is nil). If no abbrev is expanded, then call sepia-complete-symbol.