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

23. Hippie Expand

hippie-expand is a single function for a lot of different kinds of completions and expansions. Called repeatedly it tries all possible completions in succession. Which kinds of completions to try, and in which order, is determined by the contents of hippie-expand-try-functions-list. Much customization of hippie-expand can be made by changing the order of, removing, or inserting new functions in this list. Given a positive numeric argument, hippie-expand jumps directly ARG functions forward in this list. Given some other argument (a negative argument or just C-u) it undoes the tried completion.

If the variable hippie-expand-verbose is non-nil, hippie-expand outputs in a message which try-function in the list that is used currently (ie. was used currently and will be tried first the next time).

The variable hippie-expand-max-buffers determines in how many buffers, apart from the current, to search for expansions in. It is used by the try-functions named "-all-buffers". The variable hippie-expand-ignore-buffers is a list of regexps matching buffer names (as strings) or major modes (as atoms) of buffers that should not be searched by the try-functions named "-all-buffers". See also the macro make-hippie-expand-function below.

A short description of the current try-functions in this file:

try-complete-file-name

Very convenient to have in any buffer, and not just in the minibuffer or (some) shell-mode. It goes through all possible completions instead of just completing as much as is unique.

try-complete-file-name-partially

To insert in the list just before try-complete-file-name for those who want first to get a file name completed only as many characters as is unique.

try-expand-all-abbrevs

Can be removed if you don’t use abbrevs. Otherwise it looks through all abbrev-tables, starting with the local followed by the global.

try-expand-line

Searches the buffer for an entire line that begins exactly as the current line. Convenient sometimes, for example as a substitute for (or complement to) the history list in shell-like buffers. At other times, only confusing.

try-expand-line-all-buffers

Like try-expand-line but searches in all buffers (except the current). (This may be a little slow, don’t use it unless you are really fond of hippie-expand.)

`try-expand-list

Tries to expand the text back to the nearest open delimiter, to a whole list from the buffer. Convenient for example when writing lisp or TeX.

try-expand-list-all-buffers

Like try-expand-list but searches in all buffers (except the current).

try-expand-dabbrev

Works exactly as dabbrev-expand (but of course in a way compatible with the other try-functions).

try-expand-dabbrev-all-buffers

Perhaps the most useful of them, like dabbrev-expand but searches all Emacs buffers (except the current) for matching words. (No, I don’t find this one particularly slow.)

try-expand-dabbrev-visible

Searches the currently visible parts of all windows. Can be put before try-expand-dabbrev-all-buffers to first try the expansions you can see.

try-expand-dabbrev-from-kill

Searches the kill ring for a suitable completion of the word. Good to have, just in case the word was not found elsewhere.

try-expand-whole-kill

Tries to complete text with a whole entry from the kill ring. May be good if you don’t know how far up in the kill-ring the required entry is, and don’t want to mess with "Choose Next Paste".

try-complete-lisp-symbol

Like lisp-complete-symbol, but goes through all possibilities instead of completing what is unique. Might be tedious (usually a lot of possible completions) and since its function is much like lisp-complete-symbol, which already has a key of its own, you might want to remove this.

try-complete-lisp-symbol-partially

To insert in the list just before try-complete-lisp-symbol for those who first want to get completion of what is unique in the name.

Not all of the above functions are by default in hippie-expand-try-functions-list. This variable is better set in your initialization file to make hippie-expand behave maximally convenient according to personal taste. Also, instead of loading the variable with all kinds of try-functions above, it might be an idea to use make-hippie-expand-function to construct different hippie-expand-like functions, with different try-lists and bound to different keys. It is also possible to make hippie-expand-try-functions-list a buffer local variable, and let it depend on the mode (by setting it in the mode-hooks).


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

This document was generated by Aidan Kehoe on December 27, 2016 using texi2html 1.82.