Icicles - Specifying Match Functions for Commands

iciclesimage
Previous: Icicles - Global FiltersIciclesIciclesIndexNext: Icicles - Defining Completion for Comint Modes

Defining Commands that Use Specific Match Functions

This section is for EmacsLisp programmers.

By default, Icicles lets users use basic prefix completion (with ‘TAB’) or apropos completion (with ‘S-TAB’). They can alternatively use other completion methods with ‘TAB’ and ‘S-TAB’:

When you define an Icicles command, you can specify which string-matching functions the command uses during completion:

You can bind ‘icicle-apropos-complete-match-fn’ to any function that matches strings. You will probably also want to ensure that it is available for `M-(’ cycling, by adding it to ‘icicle-S-TAB-completion-methods-alist’ in a ‘let’ binding. For example, to use matching function ‘my-match’ in ‘my-cmd’, you might do this:

  (defun my-cmd ()
    "..."
    (interactive)
    (let ((icicle-apropos-complete-match-fn  'my-match)
          (icicle-S-TAB-completion-methods-alist
           (cons (cons "mine" 'my-match)
                 icicle-S-TAB-completion-methods-alist)))
      (do-something (completing-read "Choose: " ...) ...)))

Previous: Icicles - Global FiltersIciclesIciclesIndexNext: Icicles - Defining Completion for Comint Modes

DrewsElispLibraries referenced here: Lisp:icicles.el

CategoryCommands CategoryBufferSwitching CategoryCompletion CategoryRegexp CategoryProgrammerUtils CategoryCode