: [[image:iciclesimage]]

|| *Previous:*  [[Icicles - Google Matching]] || '''[[Icicles]]''' || IciclesIndex || *Next:* [[Icicles - File-Name Input]] ||

----


== Buffer-Name Input ==

The '''Icicles''' [[command]]s that read [[buffer]] names are [[multi-command]]s, so you can act on more than one
buffer during a given command invocation.

These commands all let you use a [[prefix argument]] to control which
buffers are completion candidates.  It is the numeric value of the
prefix argument that matters  Candidates are only the buffers that
satisfy these conditions:

* '''Plain `C-u'''': whose ''[[major mode|mode]]'' is ''derived'' from the current buffer mode
* '''`C-u C-u'''' ('''double'''): are ''visible'' (possibly in an iconified frame)
* '''`C-u C-u C-u'''' ('''triple'''): ''invisible''
* '''`-'''' (plain `-'): are modified (unsaved)
* '''= 0''': whose ''mode'' is the ''same'' as the current buffer mode
* '''> 0''': are visiting ''files''
* '''< 0''' (and '''not''' plain `-'): are associated with the selected ''[[frame]]''

Those are the default behaviors, but you can change them using
[[option]] '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-prefix-arg-filtering|icicle-buffer-prefix-arg-filtering]]</tt>'''' 


`icicle-buffer' (`C-x b' in ''Icicle'' mode, by default) is a [[multi-command]] that accepts [[multi-completion]] input: the first part
matches buffer names, and the second part, which is optional,
matches buffer content.  So for example:


: '''##C-x b##'''## f o o##   -> Match buffer names against `foo'

: '''##C-x b  C-M-j##'''## t o t o## -> Match buffer contents against `toto'

: '''##C-x b##'''## f o o ##'''##C-M-j##'''## t o t o## -> Match both buffer name and contents


([[option|Options]] '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-include-cached-files-nflag|icicle-buffer-include-cached-files-nflag]]</tt>'''' and
'''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-include-recent-files-nflag|icicle-buffer-include-recent-files-nflag]]</tt>'''' have no effect on
command `icicle-kill-buffer'.  Its candidates are only existing
buffer names.)

You can use option '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-skip-functions|icicle-buffer-skip-functions]]</tt>'''' to specify patterns
for buffer names to exclude from content-searching when you
provide a content-matching pattern to `icicle-buffer'.

Remember that you can use all of the usual Icicles multi-command
keys.  In particular, you can use '''`##C-!##'''' to ''act on all'' matching
buffers.  So for example, you can use `C-x k'
(`icicle-kill-buffer'), filter buffer-name candidates in various
ways (including [[progressive completion]]), and then use `##C-!##' to
kill all of the remaining candidate buffers.


In addition to the usual '''Icicles''' key bindings, during buffer-name
completion you can use additional keys, which are defined by
option '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-candidate-key-bindings|icicle-buffer-candidate-key-bindings]]</tt>''''.  These are the keys
provided by the default value of the option:

[:icicle-toggle-include-cached-files]
[:icicle-buffer-include-cached-files-nflag]
* '''`C-x F'''' ('''`icicle-toggle-include-cached-files'''') Toggle whether
`icicle-buffer' includes cached file names as candidates.  That
is, toggle [[option]] '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-include-cached-files-nflag|icicle-buffer-include-cached-files-nflag]]</tt>''''.  A [[prefix argument]] sets the option value to the numeric prefix value.
 
[:icicle-toggle-include-recent-files]
[:icicle-buffer-include-recent-files-nflag]
* '''`C-x R'''' ('''`icicle-toggle-include-recent-files'''') Toggle whether
`icicle-buffer' includes the names of recently accessed files as candidates.  That
is, toggle option '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-include-recent-files-nflag|icicle-buffer-include-recent-files-nflag]]</tt>''''.  A prefix argument sets the option value to the numeric prefix value.

[:icicle-bookmark-non-file-other-window]
* '''`C-x m'''' ('''`icicle-bookmark-non-file-other-window'''') Visit a
  [[BookmarkPlus#AdditionalTypes|bookmarked buffer]].  This is available only if you use library
  '''[[Bookmark+]]'''.  This too is a [[multi-command]], so you can actually
  visit any number of buffer bookmarks with one use of `C-x m'.  When finished, you can
  continue with non-bookmark buffer-name completion.

[:icicle-remove-buffer-cands-for-derived-mode]
* '''`C-x C-m -'''' ('''`icicle-remove-buffer-cands-for-derived-mode'''') ''Remove'' the
  buffer-name candidates with a major
  mode that is ''derived from'' a given ''mode''.  You are prompted for the mode.  You can repeat this key to narrow buffer candidates by mode.  (`C-m' is the same key as `RET'.)

[:icicle-keep-only-buffer-cands-for-derived-mode]
* '''`##C-x C-m +##'''' ('''`icicle-keep-only-buffer-cands-for-derived-mode'''') ''Keep only'' the
  buffer-name candidates with a major
  mode that is ''derived from'' a given ''mode''.  You are prompted for the mode.   (`C-m' is the same key as `RET'.)

[:icicle-remove-buffer-cands-for-mode]
* '''`C-x M -'''' ('''`icicle-remove-buffer-cands-for-mode'''') Same as `C-x C-m -', but excludes ancestor modes.

[:icicle-keep-only-buffer-cands-for-mode]
* '''`##C-x M +##'''' ('''`icicle-keep-only-buffer-cands-for-mode'''') Same as `##C-x C-m +##', but excludes ancestor modes.

[:icicle-remove-buffer-cands-for-modified]
* '''`C-x * -'''' ('''`icicle-remove-buffer-cands-for-modified'''')  ''Remove''
the buffer-name candidates for ''modified'' buffers.

[:icicle-keep-only-buffer-cands-for-modified]
* '''`##C-x * +##'''' ('''`icicle-keep-only-buffer-cands-for-modified'''') ''Keep
only'' the buffer-name candidates for ''modified'' buffers.

[:icicle-remove-buffer-cands-for-indirect]
* '''`##C-x i -##'''' ('''`icicle-remove-buffer-cands-for-indirect'''') ''Remove'' the
buffer-name candidates for indirect buffers.

[:icicle-keep-buffer-cands-for-indirect]
* '''`##C-x i +##'''' ('''`icicle-remove-buffer-cands-for-indirect'''') ''Keep only'' the
buffer-name candidates for indirect buffers.

[:icicle-remove-buffer-cands-for-visible]
* '''`C-x v -'''' ('''`icicle-remove-buffer-cands-for-visible'''') ''Remove''
the candidate buffers that are ''visible''.  This includes buffers
that are in iconified frames.

[:icicle-keep-only-buffer-cands-for-visible]
* '''`##C-x v +##'''' ('''`icicle-keep-only-buffer-cands-for-visible'''') ''Keep
only'' the candidate buffers that are ''visible''.  This includes
buffers that are in iconified frames.

* '''`S-delete'''' ''Kill'' the buffer named by the current completion
  candidate.

When cached or recently used file names are included as candidates, option '''`<tt>[[Icicles - Customization and General Tips#icicle-file-skip-functions|icicle-file-skip-functions]]</tt>'''' is used to exclude
files from content-searching whose names match its patterns,
similarly to what `icicle-buffer-skip-functions' does for buffer names.

[:sorting]
During completion, candidate sorting is specific to buffer names.
`##C-,##' cycles among the following ''sort orders'':

* by ''last access''
* `##*## ... ##*##' last: put buffers such as `*Messages*' and `*Help*' last
* by buffer ''size''
* by ''major mode'' name
* by mode-line mode name (''mode name'' that appears in the [[mode line]])
* by (absolute) ''file'' or ''process'' name

Remember too that the [[mode line|mode-line]] candidate help for a buffer-name
candidate includes the mode name, buffer size, and associated
file or directory, if any.  The directory name can be especially helpful for [[Dired]]
buffer candidates, since the buffer name does not tell you the
full directory.  For example, if you do `C-u C-x b' from Dired, so
the candidates are names of Dired buffers only, then cycling shows you
the directory for each one.

Similarly, the more detailed help available from `C-M-RET'
etc. also lists the full name of the file or directory associated
with the buffer.


The following [[user option]]s control buffer-name completion.

* '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-candidate-key-bindings|icicle-buffer-candidate-key-bindings]]</tt>'''' 
* '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-extras|icicle-buffer-extras]]</tt>'''' (*)
* '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-ignore-space-prefix-flag|icicle-buffer-ignore-space-prefix-flag]]</tt>'''' 
* '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-include-cached-files-nflag|icicle-buffer-include-cached-files-nflag]]</tt>'''' 
* '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-include-recent-files-nflag|icicle-buffer-include-recent-files-nflag]]</tt>'''' 
* '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-match-regexp|icicle-buffer-match-regexp]]</tt>'''' (*)
* '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-no-match-regexp|icicle-buffer-no-match-regexp]]</tt>'''' (*)
* '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-predicate|icicle-buffer-predicate]]</tt>'''' (*)
* '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-prefix-arg-filtering|icicle-buffer-prefix-arg-filtering]]</tt>''''
* '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-require-match-flag|icicle-buffer-require-match-flag]]</tt>''''
* '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-skip-functions|icicle-buffer-skip-functions]]</tt>''''
* '''`<tt>[[Icicles - Customization and General Tips#icicle-buffer-sort|icicle-buffer-sort]]</tt>'''' (*)

You can use option `icicle-buffer-configs' to define buffer
configurations: persistent sets of the option values marked (*).



'''See Also:'''

* [[Icicles - Searching Named Containers]]
* [[Icicles - Customization and General Tips#icicle-buffer-match-regexp|buffer-name options]]
and [[Icicles - Global Filters]] for information about user options affecting buffer-name completion
* [[Icicles - Searching Named Containers]] about content-searching
* [[Icicles - File-Name Input#MatchFileContent|Match File Names and File Content Too]] about content-searching of files
* [[Icicles - Ido and IswitchB]] to use '''Icicles''' with a buffer-switching
  behavior that is similar to [[Ido]] and [[IswitchB]]
* [[Icicles - Progressive Completion#Predicates]] to filter the
  buffer candidates on the fly in multiple ways (e.g. size)

----


|| *Previous:*  [[Icicles - Google Matching]] || '''[[Icicles]]''' || IciclesIndex || *Next:* [[Icicles - File-Name Input]] ||



DrewsElispLibraries referenced here: Lisp:icicles.el

CategoryCommands 
CategoryCompletion
CategoryBufferSwitching

