SiteMap Search ElispArea HowTo Glossary RecentChanges News Problems Suggestions

Icicles - Completion in Other Buffers

iciclesimage
Previous: Icicles - Fuzzy CompletionIciclesIciclesIndexNext: Icicles - Customization and General Tips

Completion in Other Buffers

In addition to input completion, you can use Icicles to complete words and symbols in other buffers, besides the minibuffer. Icicles enhances this completion in these ways:

  1. Lisp symbol completion via ‘M-TAB’ (‘lisp-complete-symbol’). (This is also ‘ESC-TAB’ and ‘C-M-i’.)
  2. Word completion using the dynamic abbreviation of standard Emacs library `dabbrev.el’, via ‘C-M-/’.
  3. Mailing information completion for BBDB (Insidious Big Brother Database).
  4. Word completion using the words and phrases in a thesaurus, via ‘C-c /’ (requires library synonyms.el – see Synonyms).
  5. ‘TAB’ completion of the following in ShellMode and ESS modes (and other, similar interpreters):
    1. Commands
    2. Previous inputs – commands plus their arguments
    3. File names
    4. Environment variables

Whenever multiple completion candidates are available, you can use Icicles completion, with all of its features: cycling of candidates (‘TAB’, ‘down’, or ‘next’), apropos (regexp) completion (‘S-TAB’), progressive completion (‘S-SPC’), help on individual candidates (‘C-M-RET’), and so on.

Dynamic Abbreviation

Library dabbrev.el lets you type a few characters in a buffer and then prefix-complete them (in the same buffer) to a full word or symbol name. The completion candidates come from words or symbol names in buffers that you are editing. This functionality is called “dynamic abbreviation”, though that is not a very good term for it (words are completed, not abbreviated, dynamically).

In Emacs, there are two ways to “dynamically abbreviate” text:

If there are many candidate completions, then cycling among them with ‘M-/’ can be tedious. You can use ‘M-C-/’ to complete to a common prefix, thus narrowing the set of candidates, but then you lose the ability to cycle among them.

If user option `icicle-top-level-key-bindings’ contains an entry for ‘dabbrev-completion’ then Icicles remaps keys normally bound to command ‘dabbrev-completion’ to command ‘icicle-dabbrev-completion’, which uses Icicles completion whenever there are multiple completion candidates. You can then use any Icicles features, such as apropos completion and candidate cycling. In addition, you can complete an empty prefix, starting from scratch with apropos completion.

BBDB Completion

Library bbdb.el is a rolodex-like database program for GNU Emacs – see BbdbMode. You can obtain a recent version, such as 3.02, from http://melpa.milkbox.net/, or you can pick up an older version, such as 2.35, from http://bbdb.sourceforge.net/.

If user option `icicle-functions-to-redefine’ contains an entry for ‘bbdb-complete-mail’ (for BBDB version 3.02) or ‘bbdb-complete-name’ (for BBDB version 2.35), then Icicles redefines that command so that it uses Icicles completion when there are multiple completions.

You can use any Icicles features, such as apropos completion and candidate cycling. For this feature to take effect, you must load BBDB before you load Icicles. Option ‘icicle-functions-to-redefine’ includes entries for both ‘bbdb-complete-mail’ and ‘bbdb-complete-name’ by default.

Thesaurus Lookup and Completion

Library synonyms.el provides various features for defining a thesaurus and looking up words and phrases in it. Icicles provides a multi-command version (alias ‘icicle-synonyms’) of the command ‘synonyms’, which shows all of the synonyms that match a regular expression (e.g. a word or phrase) and lets you navigate among hyperlinked thesaurus entries.

Command ‘icicle-complete-thesaurus-entry’ completes a word in a text buffer to any word or phrase in the thesaurus. With the default value of option `icicle-top-level-key-bindings’, this is bound to ‘C-c /’ in Icicle mode.

Tip: You can use ‘icicle-complete-thesaurus-entry’ to quickly check the spelling of a word. If it is correctly spelled, then it appears as a complete completion (is highlighted as such in the minibuffer).

Another Icicles (multi-)command that uses the thesaurus is ‘icicle-insert-thesaurus-entry’. It lets you use Icicles completion, cycling, and so on to insert thesaurus words and phrases in any buffer. It does not complete the word at point. Within a single call to it, insert any number of thesaurus entries, in succession. If you wanted to, you could write an entire book using a single call to ‘icicle-insert-thesaurus-entry’!

All of these commands require that you load library synonyms.el.

See Synonyms for more information on the features of library synonyms.el.

Completion in Comint Modes

‘TAB’ in a shell or similar buffer provides Icicles completion for command names, file names, and environment variables that are known to the shell (or other interpreter). Starting with Emacs 23, Icicles completion is available also when you use `M-!’ (‘shell-command’) or `M-|’ (‘shell-command-on-region’).

In a shell or similar buffer you can also complete input using your previous inputs as the set of candidates. Just type something at the prompt, hit `C-c `’, and pick one or more previous inputs to execute again (this uses ‘icicle-search’, so it is a multi-command). You need not re-execute the exact same shell command; you can edit your previous input before hitting ‘RET’ to enter the command.

These features are available for ComintMode and several modes that inherit from it, including ShellMode, Shell Script mode (ShMode), various ESS modes (EmacsSpeaksStatistics), InferiorEmacsLispMode (IELM), GrandUnifiedDebugger (GUD) mode, TclMode, RloginMode, and NS Lookup mode.

See Also:


Previous: Icicles - Fuzzy CompletionIciclesIciclesIndexNext: Icicles - Customization and General Tips

DrewsElispLibraries referenced here: Lisp:icicles.el, Lisp:synonyms.el

CategoryCommands CategoryCompletion CategorySpelling CategoryModes CategoryProgrammerUtils CategoryCode CategoryBbdb CategoryESS