: [[image:iciclesimage]]

|| *Previous:*  [[Icicles - Global Filters]] || '''[[Icicles]]''' || IciclesIndex || *Next:* [[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 vanilla [[prefix completion]] (with `TAB') or [[apropos completion]] (with `S-TAB').  They can alternatively use other completion methods with `TAB' and `S-TAB':

* They can use '''`##C-(##'''' during completion to cycle among `TAB'
completion methods.

* They can use '''`##M-(##'''' to cycle among `S-TAB' completion methods.

* They can customize [[option]]s '''`<tt>[[Icicles - Customization and General Tips#icicle-TAB-completion-methods|icicle-TAB-completion-methods]]</tt>'''' and '''`<tt>[[Icicles - Customization and General Tips#icicle-S-TAB-completion-methods-alist|icicle-S-TAB-completion-methods-alist]]</tt>'''', to define the completion methods among which they can cycle.

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

* If you want the command to use fuzzy completion for `TAB' by default, then bind `icicle-fuzzy-completion-flag' to non-`nil'.  Users can still use `##C-(##' to toggle fuzzy completion off.

* If you want the command to use a particular string-matching function for `S-TAB' completion by default, then bind variable `icicle-apropos-complete-match-fn' to that function.  Users can still use `##M-(##' to cycle among the other matching functions for `S-TAB'.

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 Filters]] || '''[[Icicles]]''' || IciclesIndex || *Next:* [[Icicles - Defining Completion for Comint Modes]] ||



DrewsElispLibraries referenced here: Lisp:icicles.el


CategoryCommands 
CategoryBufferSwitching
CategoryCompletion
CategoryRegexp
CategoryProgrammerUtils
CategoryCode




