Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Emacs predictive completion manual.V0.12.2.pdf
Скачиваний:
12
Добавлен:
23.08.2013
Размер:
270.17 Кб
Скачать

Chapter 4: Completing Words

5

4.1.2 Deleting Characters

predictive-backward-delete

(DEL) Reject current completion, if there is one, and delete backwards. A prefix argument sets the number of characters to delete. If this deletes into a word, complete what remains of that word.

predictive-backward-delete works very like backward-delete-untabify), but first rejects any provisional completion that had been inserted at the point. It also re-completes the string remaining before the point after the characters have been deleted.

4.2 Dynamic Completion

Dynamic completion is controlled by the completion-use-dynamic customisation variable. When it is non-nil, the most likely completion is provisionally inserted in the bu er after the point and highlighted to indicate that it has not yet been accepted. Unless you change the default settings, typing more word-constituent characters will add them to the word, and update the most likely completion. Typing any end-of-word character (such as a space or a punctuation character) will accept the completion.

The current syntax table (see section “Syntax” in GNU Emacs Manual) determines which characters are word-constituents and which are not (although the behaviour of individual characters can be overridden). See Section 5.1 [Character Syntax and Key Bindings], page 8, for details.

The following commands help control dynamic completion:

completion-accept

Accept the current completion, and move the point just beyond it.

completion-reject

(M-SPACE) Abandon the current completion, removing the provisionally inserted (i.e. highlighted) characters.

Note that since the completion-reject command ends the completion process, if you want to find completions for the word again you have to do it manually with predictive- complete-word-at-point. See Section 4.1.1 [Inserting Completions], page 4.

completion-scoot-ahead

(C-TAB) Insert the characters from the current completion as though typed manually, and look for completions of the resulting, longer string.

4.3 Completion Hotkeys

When the customisation variable completion-use-hotkeys is non-nil, you will be able to select a completion by typing a single character (the numerical characters 0–9 are used by default).

You will probably also want to display a list of the possible completions, so that you know which completion each character will select (see Section 4.4 [Displaying a List of Candidates], page 6).

The following variables a ect the behaviour of the completion hotkeys:

Chapter 4: Completing Words

6

completion-hotkey-list

List of keys to use for selecting completions. Default is numerical characters 0 to 9. Note that this variable must be set before loading the predictive mode libraries, e.g. in your ‘.emacs’ file. See Section 5.1.1 [Keymaps and Key Bindings], page 8.

However many characters are in completion-hotkey-list, there cannot be more completions available than the number actually found! The maximum number to find is limited by predictive-max-completions, Section 4.6 [Miscellaneous Options], page 6.

4.4 Displaying a List of Candidates

If the customisation variable completion-use-help-echo is non-nil, a list of completion candidates to be displayed in the echo area. Similarly, if the customisation variable completion-tooltip is non-nil, completion candidates will be displayed in a tooltip beneath the point. If completion-use-hotkeys is also enabled, hotkey characters will be displayed next to the completions they select.

The following variables control the completion tooltip:

completion-tooltip-delay

The number of seconds Emacs must be idle before the completion tooltip is displayed. If nil, the tooltip is displayed immediately.

4.5 Completion Menu and Browser

When completion-use-menu is non-nil, running completion-show-menu (or hitting M- Down) when completing will bring up the completion menu, from which you can select a completion to insert. If completion-use-hotkeys is enabled, the menu will also display the hotkeys next to the completions they select, although you will have to exit the menu before you can use them (see Section 4.3 [Completion Hotkeys], page 5).

The completion menu also contains a Browser entry, which replaces the completion menu with the completion browser. This hierarchically lists all possible completions, irrespective of the setting of predictive-max-completions (see Section 4.6 [Miscellaneous Options], page 6). If it’s taking too long to construct the browser, you can hit C-g to cancel it.

4.6 Miscellaneous Options

The following variables a ect the overall behaviour of predictive mode:

predictive-max-completions

Maximum number of completions to find. Default is 10.

Setting predictive-max-completions to a large number is probably not useful, and will slow predictive mode down. It is easier to type a few extra characters than cycle through lots of completions, and the number available via hotkeys is limited by the number of characters that can be used to select them (see Section 4.3 [Completion Hotkeys], page 5).

predictive-ignore-initial-caps

Controls whether predictive mode should ignore initial capital letters when searching for completions. If non-nil (the default), completions for the uncapitalised string are also found.

Chapter 4: Completing Words

7

Only the first capital letter of a string is ignored. Thus typing A would find ‘and’ (which would complete to ‘And’), ‘Alaska’ and ‘ANSI’, but typing AN would only find ‘ANSI’, whilst typing a would only find ‘and’.

completion-min-chars

Minimum number of characters that must be typed before the various completion mechanisms are activated. Note that you can still explicitly invoke completion on a shorter prefix using the completion-tab-complete or completioncycle commands (see Section 4.1.1 [Inserting Completions], page 4).

completion-delay

Number of seconds Emacs must be idle before the various completion mechanisms are activated.

completion-resolve-old-method

Determines what to do with a provisional completion if you move the point away from it and start typing elsewhere. The options are: ’leave, which just leaves the old provisional completion in place to return to later if you so desire, ’accept and ’reject, which accept or reject the old completion, and ’ask, which asks you whether you want to accept or reject.

Соседние файлы в предмете Электротехника