ErgoEmacsEmacsLispBlogEmacsLispBuy Tutorial
Web Hosting by 1&1

8.3.4 Completion Options

If completion-auto-help is set to nil, the completion commands never display the completion list buffer; you must type ? to display the list. If the value is lazy, Emacs only shows the completion list buffer on the second attempt to complete. In other words, if there is nothing to complete, the first <TAB> echoes ‘Next char not unique’; the second <TAB> does the completion list buffer.

When completing file names, certain file names are usually ignored. The variable completion-ignored-extensions contains a list of strings; a file name ending in any of those strings is ignored as a completion candidate. The standard value of this variable has several elements including ".o", ".elc", and "~". For example, if a directory contains ‘foo.c’ and ‘foo.elc’, ‘foo’ completes to ‘foo.c’. However, if all possible completions end in “ignored” strings, they are not ignored: in the previous example, ‘foo.e’ completes to ‘foo.elc’. Displaying a list of possible completions disregards completion-ignored-extensions; it shows them all.

If an element of completion-ignored-extensions ends in a slash (/), it's a subdirectory name; that directory and its contents are ignored. Elements of completion-ignored-extensions that do not end in a slash are ordinary file names.

When completing file names, Emacs ignores case differences if the variable read-file-name-completion-ignore-case is non-nil. The default value is nil on systems that have case-sensitive file-names, such as GNU/Linux; it is non-nil on systems that have case-insensitive file-names, such as Microsoft Windows. When completing buffer names, Emacs ignores case differences if read-buffer-completion-ignore-case is non-nil (the default value is nil).

You can customize the matching rules for completion alternatives using the variable completion-styles. Its value should be a list of symbols, each representing a completion style; valid style symbols are basic, partial-completion, emacs22, emacs21, and initials. When completing, Emacs attempts to use the first completion style in the list; if this does not return any completion alternatives, it tries the next completion style in the list, and so on. The completion rules described in Completion Commands correspond to the default value of completion-styles, which is (basic partial-completion emacs22).

Icomplete mode presents a constantly-updated display that tells you what completions are available for the text you've entered so far. The command to enable or disable this minor mode is M-x icomplete-mode.

blog comments powered by Disqus