KeySee

This page is about library keysee.el, which provides completion of key sequences and menu-bar menus. It requires library sortie.el (see Sortie), which lets you sort completion candidates in different ways interactively.

It is essentially a reduced-functionality version of Icicles key completion.

Turn on minor mode ‘kc-mode’ to enable completion on demand whenever you hit ‘S-TAB’, for keys and menu-bar menus. (You can customize the key(s) for this, using option ‘kc-completion-keys’.)

This means you can hit ‘S-TAB’ at top level, to see all possible keys, or after any prefix key, to see all possible keys at that level.

If you want to complete just menu-bar menus, you can use command ‘kc-complete-menu-bar’.

In addition to key completion on demand, you can automatically complete prefix keys using minor mode ‘kc-auto-mode’. After a short delay when you hit a prefix key, it provides the same kind of completion as ‘kc-mode’. You can customize the delay with option ‘kc-auto-delay’.

‘kc-auto-mode’ includes the on-demand completion of ‘kc-mode’, so you can still use ‘S-TAB’ at top level. And if you have a long enough ‘kc-auto-delay’ you can take time to think or use ‘S-TAB’ at any level to show completions immediately.

Turning on ‘kc-auto-mode’ thus turns on ‘kc-mode’. Turning either mode off turns off the other as well. So if you want both, turn on ‘kc-auto-mode’; if you want only on-demand completion, turn on ‘kc-mode’.

When completions are shown, the completion candidates have one of these forms:

  ..
  PREFIX-KEY  =  ...
  KEY  =  COMMAND

Completion uses the completion styles defined by option ‘kc-completion-styles’, not those of standard option ‘completion-styles’. This means you can have different preferred styles for key completion. By default, the setting favors ‘substring’, and then ‘flex’ (Emacs 27 or later) completion.

You can use option ‘kc-separator’ to customize the separator ` = ’. The default value has 2 space chars on each side of `=’, so you can more easily match menu candidates that contain a space char.

Completion is as usual in vanilla Emacs: type characters to match completion candidates, use ‘TAB’ to complete, use ‘RET’ to accept a completion.

The following completion-candidate sort orders are available. You can cycle among them during completion using the key that is the value of option ‘sorti-sort-cycle-key’ (`C-,’ by default).

You can cycle candidates using ‘TAB’, according to option ‘completion-cycle-threshold’.

For top-level key completion (keys in ‘kc-completion-keys’, e.g. ‘S-TAB’), you can use option ‘kc-keymaps-for-key-completion’ to choose which keymaps in which to bind ‘S-TAB’ to ‘kc-complete-keys’. Normally, if a key in ‘kc-keymaps-for-key-completion’ is already bound in a map listed in that option value then that binding is respected - the key is not bound to ‘kc-complete-keys’. You can override this by customizing option ‘kc-bind-completion-keys-anyway-flag’ to non-‘nil’.

Suggested key binding:

  (global-set-key (kbd "S-<f10>") kc-complete-menu-bar)

CategoryCompletion CategoryHelp CategoryKeys