[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4. Lightning completion

Suppose you want to find a file, and you want to use lightning completion on file names. One way to accomplish this is to run find-file (by hitting C-x C-f, say), then once in the minibuffer, either running completing-insert-according-to-mode or completing-insert-file-name (by hitting C-x c F, say, if you have turned on the option lc-ctrl-x-c-is-completion (see section 2. Completion functions)).

Another way to accomplish this is to have lightning completion potentially active whenever you enter the minibuffer, and to specify when "potentially active" should mean "active".

4.1 Enabling automatic lightning completion  
4.2 Settings for lightning completion  Disabling lightning completion in certain circumstances


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.1 Enabling automatic lightning completion

To use lightning completion automatically in the minibuffer (in various circumstances), you should turn on the option toggle-lightning-completion, either by customization or by setting the variable toggle-lightning-completion to t. Once you've done this, then the variable lightning-completion-list specifies in which contexts lightning completion should be active; the possible contexts are:

file names

commands

lisp functions

lisp variables

lisp objects

user variables

buffer names

info menu items

query-replace
Enable lightning completion on buffer contents when using query-replace. This may not work very well, but I'm working on it...

miscellaneous
Enable lightning completion on everything else.

The easiest way to specify which contexts you want to enable is to customize the variable lightning-completion-list (in the customization group lightning-completion). For each context, you can turn lightning completion on (with the default delay time) or off, or you can also specify a number. If the number is negative, lightning completion is off; otherwise, lightning completion is on, with that number for the delay time for that context. (You can instead use the lightnify function to turn completion on or off, if you prefer. This function is a bit obsolete; in particular, it does not allow you to set a different delay time for each context.)

I suppose I should explain the effect of the "miscellaneous" context. Basically, if in some situation you can complete in the minibuffer by hitting the TAB key, then enabling miscellaneous completion means that lightning completion will be on in that situation. For example, in the news-reader Gnus, if you hit j (to run gnus-group-jump-to-group), then you will be thrown into lightning completion mode, completing on newsgroup names (you will see the message "Completing something...").


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2 Settings for lightning completion

Lightning completion doesn't always work the way you want it, so there are some ways of partially disabling it.

For example, lightning completion doesn't work terribly well with recursive minibuffers, so there is a customizable variable lc-dark-recursive-minibufs. If this is nil, then lightning completion proceeds unhindered. If this has a numerical value N, then lightning completion is disabled when the recursion depth is larger than N. If this has some other non-nil value, then it is treated as if it had value 1 (disabling lightning completion in any recursive situation).

You might also want to, say, enable lightning completion on file names, but disable it for particular commands. To do this, customize the variable lc-dark-commands, which is a list of functions. For example, if you want to disable lightning completion when using insert-file, then add insert-file to this list. If you want two versions of a command like insert-file, only one of which uses lightning completion, then make an alias to insert-file, and disable lightning completion on that function:

 
(defalias 'insert-file-dark 'insert-file)

and add insert-file-dark to lc-dark-commands. I personally have functions like dired-create-directory, dired-do-symlink, and query-replace-regexp in my list of dark commands.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated on September, 30 2005 using texi2html