view man/xemacs/mini.texi @ 2367:ecf1ebac70d8

[xemacs-hg @ 2004-11-04 23:05:23 by ben] commit mega-patch configure.in: Turn off -Winline and -Wchar-subscripts. Use the right set of cflags when compiling modules. Rewrite ldap configuration to separate the inclusion of lber (needed in recent Cygwin) from the basic checks for the needed libraries. add a function for MAKE_JUNK_C; initially code was added to generate xemacs.def using this, but it will need to be rewritten. add an rm -f for junk.c to avoid weird Cygwin bug with cp -f onto an existing file. Sort list of auto-detected functions and eliminate unused checks for stpcpy, setlocale and getwd. Add autodetection of Cygwin scanf problems BETA: Rewrite section on configure to indicate what flags are important and what not. digest-doc.c, make-dump-id.c, profile.c, sorted-doc.c: Add proper decls for main(). make-msgfile.c: Document that this is old junk. Move proposal to text.c. make-msgfile.lex: Move proposal to text.c. make-mswin-unicode.pl: Convert error-generating code so that the entire message will be seen as a single unrecognized token. mule/mule-ccl.el: Update docs. lispref/mule.texi: Update CCL docs. ldap/eldap.c: Mule-ize. Use EXTERNAL_LIST_LOOP_2 instead of deleted EXTERNAL_LIST_LOOP. * XEmacs 21.5.18 "chestnut" is released. --------------------------------------------------------------- MULE-RELATED WORK: --------------------------------------------------------------- --------------------------- byte-char conversion --------------------------- buffer.c, buffer.h, insdel.c, text.c: Port FSF algorithm for byte-char conversion, replacing broken previous version. Track the char position of the gap. Add functions to do char-byte conversion downwards as well as upwards. Move comments about algorithm workings to internals manual. --------------------------- work on types --------------------------- alloc.c, console-x-impl.h, dump-data.c, dump-data.h, dumper.c, dialog-msw.c, dired-msw.c, doc.c, editfns.c, esd.c, event-gtk.h, event-msw.c, events.c, file-coding.c, file-coding.h, fns.c, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-shared.c, glyphs-x.c, glyphs.c, glyphs.h, gui.c, hpplay.c, imgproc.c, intl-win32.c, lrecord.h, lstream.c, keymap.c, lisp.h, libsst.c, linuxplay.c, miscplay.c, miscplay.h, mule-coding.c, nas.c, nt.c, ntheap.c, ntplay.c, objects-msw.c, objects-tty.c, objects-x.c, print.c, process-nt.c, process.c, redisplay.h, select-common.h, select-gtk.c, select-x.c, sgiplay.c, sound.c, sound.h, sunplay.c, sysfile.h, sysdep.c, syswindows.h, text.c, unexnt.c, win32.c, xgccache.c: Further work on types. This creates a full set of types for all the basic semantics of `char' that I have so far identified, so that its semantics can always be identified for the purposes of proper Mule-safe code, and the raw use of `char' always avoided. (1) More type renaming, for consistency of naming. Char_ASCII -> Ascbyte UChar_ASCII -> UAscbyte Char_Binary -> CBinbyte UChar_Binary -> Binbyte SChar_Binary -> SBinbyte (2) Introduce Rawbyte, CRawbyte, Boolbyte, Chbyte, UChbyte, and Bitbyte and use them. (3) New types Itext, Wexttext and Textcount for separating out the concepts of bytes and textual units (different under UTF-16 and UTF-32, which are potential internal encodings). (4) qxestr*_c -> qxestr*_ascii. lisp.h: New; goes with other qxe() functions. #### Maybe goes in a different section. lisp.h: Group generic int-type defs together with EMACS_INT defs. lisp.h: * lisp.h (WEXTTEXT_IS_WIDE) New defns. lisp.h: New type to replace places where int occurs as a boolean. It's signed because occasionally people may want to use -1 as an error value, and because unsigned ints are viral -- see comments in the internals manual against using them. dynarr.c: int -> Bytecount. --------------------------- Mule-izing --------------------------- device-x.c: Partially Mule-ize. dumper.c, dumper.h: Mule-ize. Use Rawbyte. Use stderr_out not printf. Use wext_*(). sysdep.c, syswindows.h, text.c: New Wexttext API for manipulation of external text that may be Unicode (e.g. startup code under Windows). emacs.c: Mule-ize. Properly deal with argv in external encoding. Use wext_*() and Wexttext. Use Rawbyte. #if 0 some old junk on SCO that is unlikely to be correct. Rewrite allocation code in run-temacs. emacs.c, symsinit.h, win32.c: Rename win32 init function and call it even earlier, to initialize mswindows_9x_p even earlier, for use in startup code (XEUNICODE_P). process.c: Use _wenviron not environ under Windows, to get Unicode environment variables. event-Xt.c: Mule-ize drag-n-drop related stuff. dragdrop.c, dragdrop.h, frame-x.c: Mule-ize. text.h: Add some more stand-in defines for particular kinds of conversion; use in Mule-ization work in frame-x.c etc. --------------------------- Freshening --------------------------- intl-auto-encap-win32.c, intl-auto-encap-win32.h: Regenerate. --------------------------- Unicode-work --------------------------- intl-win32.c, syswindows.h: Factor out common options to MultiByteToWideChar and WideCharToMultiByte. Add convert_unicode_to_multibyte_malloc() and convert_unicode_to_multibyte_dynarr() and use. Add stuff for alloca() conversion of multibyte/unicode. alloc.c: Use dfc_external_data_len() in case of unicode coding system. alloc.c, mule-charset.c: Don't zero out and reinit charset Unicode tables. This fucks up dump-time loading. Anyway, either we load them at dump time or run time, never both. unicode.c: Dump the blank tables as well. --------------------------------------------------------------- DOCUMENTATION, MOSTLY MULE-RELATED: --------------------------------------------------------------- EmacsFrame.c, emodules.c, event-Xt.c, fileio.c, input-method-xlib.c, mule-wnnfns.c, redisplay-gtk.c, redisplay-tty.c, redisplay-x.c, regex.c, sysdep.c: Add comment about Mule work needed. text.h: Add more documentation describing why DFC routines were not written to return their value. Add some other DFC documentation. console-msw.c, console-msw.h: Add pointer to docs in win32.c. emacs.c: Add comments on sources of doc info. text.c, charset.h, unicode.c, intl-win32.c, intl-encap-win32.c, text.h, file-coding.c, mule-coding.c: Collect background comments and related to text matters and internationalization, and proposals for work to be done, in text.c or Internals manual, stuff related to specific textual API's in text.h, and stuff related to internal implementation of Unicode conversion in unicode.c. Put lots of pointers to the comments to make them easier to find. s/mingw32.h, s/win32-common.h, s/win32-native.h, s/windowsnt.h, win32.c: Add bunches of new documentation on the different kinds of builds and environments under Windows and how they work. Collect this info in win32.c. Add pointers to these docs in the relevant s/* files. emacs.c: Document places with long comments. Remove comment about exiting, move to internals manual, put in pointer. event-stream.c: Move docs about event queues and focus to internals manual, put in pointer. events.h: Move docs about event stream callbacks to internals manual, put in pointer. profile.c, redisplay.c, signal.c: Move documentation to the Internals manual. process-nt.c: Add pointer to comment in win32-native.el. lisp.h: Add comments about some comment conventions. lisp.h: Add comment about the second argument. device-msw.c, redisplay-msw.c: @@#### comments are out-of-date. --------------------------------------------------------------- PDUMP WORK (MOTIVATED BY UNICODE CHANGES) --------------------------------------------------------------- alloc.c, buffer.c, bytecode.c, console-impl.h, console.c, device.c, dumper.c, lrecord.h, elhash.c, emodules.h, events.c, extents.c, frame.c, glyphs.c, glyphs.h, mule-charset.c, mule-coding.c, objects.c, profile.c, rangetab.c, redisplay.c, specifier.c, specifier.h, window.c, lstream.c, file-coding.h, file-coding.c: PDUMP: Properly implement dump_add_root_block(), which never worked before, and is necessary for dumping Unicode tables. Pdump name changes for accuracy: XD_STRUCT_PTR -> XD_BLOCK_PTR. XD_STRUCT_ARRAY -> XD_BLOCK_ARRAY. XD_C_STRING -> XD_ASCII_STRING. *_structure_* -> *_block_*. lrecord.h: some comments added about dump_add_root_block() vs dump_add_root_block_ptr(). extents.c: remove incorrect comment about pdump problems with gap array. --------------------------------------------------------------- ALLOCATION --------------------------------------------------------------- abbrev.c, alloc.c, bytecode.c, casefiddle.c, device-msw.c, device-x.c, dired-msw.c, doc.c, doprnt.c, dragdrop.c, editfns.c, emodules.c, file-coding.c, fileio.c, filelock.c, fns.c, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-x.c, gui-msw.c, gui-x.c, imgproc.c, intl-win32.c, lread.c, menubar-gtk.c, menubar.c, nt.c, objects-msw.c, objects-x.c, print.c, process-nt.c, process-unix.c, process.c, realpath.c, redisplay.c, search.c, select-common.c, symbols.c, sysdep.c, syswindows.h, text.c, text.h, ui-byhand.c: New macros {alloca,xnew}_{itext,{i,ext,raw,bin,asc}bytes} for more convenient allocation of these commonly requested items. Modify functions to use alloca_ibytes, alloca_array, alloca_extbytes, xnew_ibytes, etc. also XREALLOC_ARRAY, xnew. alloc.c: Rewrite the allocation functions to factor out repeated code. Add assertions for freeing dumped data. lisp.h: Moved down and consolidated with other allocation stuff. lisp.h, dynarr.c: New functions for allocation that's very efficient when mostly in LIFO order. lisp.h, text.c, text.h: Factor out some stuff for general use by alloca()-conversion funs. text.h, lisp.h: Fill out convenience routines for allocating various kinds of bytes and put them in lisp.h. Use them in place of xmalloc(), ALLOCA(). text.h: Fill out the convenience functions so the _MALLOC() kinds match the alloca() kinds. --------------------------------------------------------------- ERROR-CHECKING --------------------------------------------------------------- text.h: Create ASSERT_ASCTEXT_ASCII() and ASSERT_ASCTEXT_ASCII_LEN() from similar Eistring checkers and change the Eistring checkers to use them instead. --------------------------------------------------------------- MACROS IN LISP.H --------------------------------------------------------------- lisp.h: Redo GCPRO declarations. Create a "base" set of functions that can be used to generate any kind of gcpro sets -- regular, ngcpro, nngcpro, private ones used in GC_EXTERNAL_LIST_LOOP_2. buffer.c, callint.c, chartab.c, console-msw.c, device-x.c, dialog-msw.c, dired.c, extents.c, ui-gtk.c, rangetab.c, nt.c, mule-coding.c, minibuf.c, menubar-msw.c, menubar.c, menubar-gtk.c, lread.c, lisp.h, gutter.c, glyphs.c, glyphs-widget.c, fns.c, fileio.c, file-coding.c, specifier.c: Eliminate EXTERNAL_LIST_LOOP, which does not check for circularities. Use EXTERNAL_LIST_LOOP_2 instead or EXTERNAL_LIST_LOOP_3 or EXTERNAL_PROPERTY_LIST_LOOP_3 or GC_EXTERNAL_LIST_LOOP_2 (new macro). Removed/redid comments on EXTERNAL_LIST_LOOP. --------------------------------------------------------------- SPACING FIXES --------------------------------------------------------------- callint.c, hftctl.c, number-gmp.c, process-unix.c: Spacing fixes. --------------------------------------------------------------- FIX FOR GEOMETRY PROBLEM IN FIRST FRAME --------------------------------------------------------------- unicode.c: Add workaround for newlib bug in sscanf() [should be fixed by release 1.5.12 of Cygwin]. toolbar.c: bug fix for problem of initial frame being 77 chars wide on Windows. will be overridden by my other ws. --------------------------------------------------------------- FIX FOR LEAKING PROCESS HANDLES: --------------------------------------------------------------- process-nt.c: Fixes for leaking handles. Inspired by work done by Adrian Aichner <adrian@xemacs.org>. --------------------------------------------------------------- FIX FOR CYGWIN BUG (Unicode-related): --------------------------------------------------------------- unicode.c: Add workaround for newlib bug in sscanf() [should be fixed by release 1.5.12 of Cygwin]. --------------------------------------------------------------- WARNING FIXES: --------------------------------------------------------------- console-stream.c: `reinit' is unused. compiler.h, event-msw.c, frame-msw.c, intl-encap-win32.c, text.h: Add stuff to deal with ANSI-aliasing warnings I got. regex.c: Gather includes together to avoid warning. --------------------------------------------------------------- CHANGES TO INITIALIZATION ROUTINES: --------------------------------------------------------------- buffer.c, emacs.c, console.c, debug.c, device-x.c, device.c, dragdrop.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, font-lock.c, frame-msw.c, glyphs-widget.c, glyphs.c, gui-x.c, insdel.c, lread.c, lstream.c, menubar-gtk.c, menubar-x.c, minibuf.c, mule-wnnfns.c, objects-msw.c, objects.c, print.c, scrollbar-x.c, search.c, select-x.c, text.c, undo.c, unicode.c, window.c, symsinit.h: Call reinit_*() functions directly from emacs.c, for clarity. Factor out some redundant init code. Move disallowed stuff that had crept into vars_of_glyphs() into complex_vars_of_glyphs(). Call init_eval_semi_early() from eval.c not in the middle of vars_of_() in emacs.c since there should be no order dependency in the latter calls. --------------------------------------------------------------- ARMAGEDDON: --------------------------------------------------------------- alloc.c, emacs.c, lisp.h, print.c: Rename inhibit_non_essential_printing_operations to inhibit_non_essential_conversion_operations. text.c: Assert on !inhibit_non_essential_conversion_operations. console-msw.c, print.c: Don't do conversion in SetConsoleTitle or FindWindow to avoid problems during armageddon. Put #errors for NON_ASCII_INTERNAL_FORMAT in places where problems would arise. --------------------------------------------------------------- CHANGES TO THE BUILD PROCEDURE: --------------------------------------------------------------- config.h.in, s/cxux.h, s/usg5-4-2.h, m/powerpc.h: Add comment about correct ordering of this file. Rearrange everything to follow this -- put all #undefs together and before the s&m files. Add undefs for HAVE_ALLOCA, C_ALLOCA, BROKEN_ALLOCA_IN_FUNCTION_CALLS, STACK_DIRECTION. Remove unused HAVE_STPCPY, HAVE_GETWD, HAVE_SETLOCALE. m/gec63.h: Deleted; totally broken, not used at all, not in FSF. m/7300.h, m/acorn.h, m/alliant-2800.h, m/alliant.h, m/altos.h, m/amdahl.h, m/apollo.h, m/att3b.h, m/aviion.h, m/celerity.h, m/clipper.h, m/cnvrgnt.h, m/convex.h, m/cydra5.h, m/delta.h, m/delta88k.h, m/dpx2.h, m/elxsi.h, m/ews4800r.h, m/gould.h, m/hp300bsd.h, m/hp800.h, m/hp9000s300.h, m/i860.h, m/ibmps2-aix.h, m/ibmrs6000.h, m/ibmrt-aix.h, m/ibmrt.h, m/intel386.h, m/iris4d.h, m/iris5d.h, m/iris6d.h, m/irist.h, m/isi-ov.h, m/luna88k.h, m/m68k.h, m/masscomp.h, m/mg1.h, m/mips-nec.h, m/mips-siemens.h, m/mips.h, m/news.h, m/nh3000.h, m/nh4000.h, m/ns32000.h, m/orion105.h, m/pfa50.h, m/plexus.h, m/pmax.h, m/powerpc.h, m/pyrmips.h, m/sequent-ptx.h, m/sequent.h, m/sgi-challenge.h, m/symmetry.h, m/tad68k.h, m/tahoe.h, m/targon31.h, m/tekxd88.h, m/template.h, m/tower32.h, m/tower32v3.h, m/ustation.h, m/vax.h, m/wicat.h, m/xps100.h: Delete C_ALLOCA, HAVE_ALLOCA, STACK_DIRECTION, BROKEN_ALLOCA_IN_FUNCTION_CALLS. All of this is auto-detected. When in doubt, I followed recent FSF sources, which also have these things deleted.
author ben
date Thu, 04 Nov 2004 23:08:28 +0000
parents f561c3904bb3
children
line wrap: on
line source



@node Minibuffer, M-x, Undo, Top
@chapter The Minibuffer
@cindex minibuffer

  The @dfn{minibuffer} is the facility used by XEmacs commands to read
arguments more complicated than a single number.  Minibuffer arguments
can be file names, buffer names, Lisp function names, XEmacs command
names, Lisp expressions, and many other things, depending on the command
reading the argument.  You can use the usual XEmacs editing commands in
the minibuffer to edit the argument text.

@cindex prompt
  When the minibuffer is in use, it appears in the echo area, and the
cursor moves there.  The beginning of the minibuffer line displays a
@dfn{prompt} which says what kind of input you should supply and how it
will be used.  Often this prompt is derived from the name of the command
that the argument is for.  The prompt normally ends with a colon.

@cindex default argument
  Sometimes a @dfn{default argument} appears in parentheses after the
colon; it, too, is part of the prompt.  The default is used as the
argument value if you enter an empty argument (e.g., by just typing @key{RET}).
For example, commands that read buffer names always show a default, which
is the name of the buffer that will be used if you type just @key{RET}.

@kindex C-g
  The simplest way to enter a minibuffer argument is to type the text
you want, terminated by @key{RET} which exits the minibuffer.  You can
cancel the command that wants the argument, and get out of the
minibuffer, by typing @kbd{C-g}.

  Since the minibuffer uses the screen space of the echo area, it can
conflict with other ways XEmacs customarily uses the echo area.  One can
avoid such a conflict as described in @ref{Customizing Message
Display,,,lispref, The XEmacs Lisp Reference Manual}.  Here is how
XEmacs handles such conflicts by default:

@itemize @bullet
@item
If a command gets an error while you are in the minibuffer, this does
not cancel the minibuffer.  However, the echo area is needed for the
error message and therefore the minibuffer itself is hidden for a
while.  It comes back after a few seconds, or as soon as you type
anything.

@item
If in the minibuffer you use a command whose purpose is to print a
message in the echo area, such as @kbd{C-x =}, the message is printed
normally, and the minibuffer is hidden for a while.  It comes back
after a few seconds, or as soon as you type anything.

@item
Echoing of keystrokes does not take place while the minibuffer is in
use.
@end itemize

@menu
* File: Minibuffer File.  Entering file names with the minibuffer.
* Edit: Minibuffer Edit.  How to edit in the minibuffer.
* Completion::		  An abbreviation facility for minibuffer input.
* Minibuffer History::    Reusing recent minibuffer arguments.
* Repetition::		  Re-executing commands that used the minibuffer.
@end menu

@node Minibuffer File, Minibuffer Edit, Minibuffer, Minibuffer
@section Minibuffers for File Names

  Sometimes the minibuffer starts out with text in it.  For example, when
you are supposed to give a file name, the minibuffer starts out containing
the @dfn{default directory}, which ends with a slash.  This is to inform
you which directory the file will be found in if you do not specify a
directory.

  For example, the minibuffer might start out with these contents:

@example
Find File: /u2/emacs/src/
@end example

@noindent
where @samp{Find File:@: } is the prompt.  Typing @kbd{buffer.c}
specifies the file @file{/u2/emacs/src/buffer.c}.  To find files in
nearby directories, use @kbd{..}; thus, if you type
@kbd{../lisp/simple.el}, you will get the file named
@file{/u2/emacs/lisp/simple.el}.  Alternatively, you can kill with
@kbd{M-@key{DEL}} the directory names you don't want (@pxref{Words}).

  If you don't want any of the default, you can kill it with @kbd{C-a
C-k}.  But you don't need to kill the default; you can simply ignore it.
Insert an absolute file name, one starting with a slash or a tilde,
after the default directory.  For example, to specify the file
@file{/etc/termcap}, just insert that name, giving these minibuffer
contents:

@example
Find File: /u2/emacs/src//etc/termcap
@end example

@noindent
@cindex // in file name
@cindex double slash in file name
@cindex slashes repeated in file name
XEmacs gives a special meaning to a double slash (which is not normally
a useful thing to write): it means, ``ignore everything before the
second slash in the pair.''  Thus, @samp{/u2/emacs/src/} is ignored in
the example above, and you get the file @file{/etc/termcap}.

@vindex insert-default-directory
If you set @code{insert-default-directory} to @code{nil}, the default
directory is not inserted in the minibuffer.  This way, the minibuffer
starts out empty.  But the name you type, if relative, is still
interpreted with respect to the same default directory.

@node Minibuffer Edit, Completion, Minibuffer File, Minibuffer
@section Editing in the Minibuffer

  The minibuffer is an XEmacs buffer (albeit a peculiar one), and the
usual XEmacs commands are available for editing the text of an argument
you are entering.

  Since @key{RET} in the minibuffer is defined to exit the minibuffer,
you can't use it to insert a newline in the minibuffer.  To do that,
type @kbd{C-o} or @kbd{C-q C-j}.  (Recall that a newline is really the
character control-J.)

  The minibuffer has its own window which always has space on the screen
but acts as if it were not there when the minibuffer is not in use.
When the minibuffer is in use, its window is just like the others; you
can switch to another window with @kbd{C-x o}, edit text in other
windows and perhaps even visit more files, before returning to the
minibuffer to submit the argument.  You can kill text in another window,
return to the minibuffer window, and then yank the text to use it in the
argument.  @xref{Windows}.

  There are some restrictions on the use of the minibuffer window,
however.  You cannot switch buffers in it---the minibuffer and its
window are permanently attached.  Also, you cannot split or kill the
minibuffer window. But you can make it taller in the normal fashion with
@kbd{C-x ^}.  If you enable Resize-Minibuffer mode, then the
minibuffer window expands vertically as necessary to hold the text that
you put in the minibuffer.  Use @kbd{M-x resize-minibuffer-mode} to
enable or disable this minor mode (@pxref{Minor Modes}).

@kindex C-M-v
  If while in the minibuffer you issue a command that displays help text
of any sort in another window, you can use the @kbd{C-M-v} command while
in the minibuffer to scroll the help text.  This lasts until you exit
the minibuffer.  This feature is especially useful if a completing
minibuffer gives you a list of possible completions.  @xref{Other Window}.

@vindex minibuffer-confirm-incomplete
If the variable @code{minibuffer-confirm-incomplete} is @code{t}, you
are asked for confirmation if there is no known completion for the text
you typed. For example, if you attempted to visit a non-existent file,
the minibuffer might read:
@example
        Find File: chocolate_bar.c [no completions, confirm]
@end example
If you press @kbd{Return} again, that confirms the filename. Otherwise,
you can continue editing it. 

 XEmacs supports recursive use of the minibuffer.  However, it is easy
to do this by accident (because of autorepeating keyboards, for example)
and get confused.  Therefore, most XEmacs commands that use the
minibuffer refuse to operate if the minibuffer window is selected.  If
the minibuffer is active but you have switched to a different window,
recursive use of the minibuffer is allowed---if you know enough to try
to do this, you probably will not get confused.

@vindex enable-recursive-minibuffers
  If you set the variable @code{enable-recursive-minibuffers} to a
non-@code{nil}, recursive use of the minibuffer is always allowed.

@node Completion, Minibuffer History, Minibuffer Edit, Minibuffer
@section Completion
@cindex completion

  For certain kinds of arguments, you can use @dfn{completion} to enter
the argument value.  Completion means that you type part of the
argument, then XEmacs visibly fills in the rest, or as much as
can be determined from the part you have typed.

  When completion is available, certain keys---@key{TAB}, @key{RET}, and
@key{SPC}---are rebound to complete the text present in the
minibuffer into a longer string that it stands for, by matching it
against a set of @dfn{completion alternatives} provided by the command
reading the argument.  @kbd{?} is defined to display a list of possible
completions of what you have inserted.

  For example, when @kbd{M-x} uses the minibuffer to read the name of a
command, it provides a list of all available XEmacs command names to
complete against.  The completion keys match the text in the minibuffer
against all the command names, find any additional name characters
implied by the ones already present in the minibuffer, and add those
characters to the ones you have given.  This is what makes it possible
to type @kbd{M-x inse @key{SPC} b @key{RET}} instead of @kbd{M-x
insert-buffer @key{RET}} (for example).

  Case is normally significant in completion because it is significant
in most of the names that you can complete (buffer names, file names and
command names).  Thus, @samp{fo} does not complete to @samp{Foo}.  When
you are completing a name in which case does not matter, case may be
ignored for completion's sake if specified by program.

When a completion list is displayed, the completions will highlight as
you move the mouse over them.  Clicking the middle mouse button on any 
highlighted completion will ``select'' it just as if you had typed it in
and hit @key{RET}.

@menu
* Example: Completion Example.
* Commands: Completion Commands.
* Strict Completion::
* Options: Completion Options.
@end menu

@node Completion Example, Completion Commands, Completion, Completion
@subsection Completion Example

@kindex TAB
@findex minibuffer-complete
  A concrete example may help here.  If you type @kbd{M-x au @key{TAB}},
the @key{TAB} looks for alternatives (in this case, command names) that
start with @samp{au}.  There are several, including
@code{auto-fill-mode} and @code{auto-save-mode}---but they are all the
same as far as @code{auto}, so the @samp{au} in the minibuffer changes
to @samp{auto}.

  If you type @key{TAB} again immediately, there are multiple
possibilities for the very next character---it could be any of
@samp{c-}---so no more characters are added; instead, @key{TAB}
displays a list of all possible completions in another window.

  If you go on to type @kbd{-f @key{TAB}}, this @key{TAB} sees
@samp{auto-f}.  The only command name starting this way is
@code{auto-fill-mode}, so completion fills in the rest of that.  You now
have @samp{auto-fill-mode} in the minibuffer after typing just @kbd{au
@key{TAB} f @key{TAB}}.  Note that @key{TAB} has this effect because in
the minibuffer it is bound to the command @code{minibuffer-complete}
when completion is available.

@node Completion Commands, Strict Completion, Completion Example, Completion
@subsection Completion Commands

  Here is a list of the completion commands defined in the minibuffer
when completion is available.

@table @kbd
@item @key{TAB}
Complete the text in the minibuffer as much as possible
(@code{minibuffer-complete}).
@item @key{SPC}
Complete the minibuffer text, but don't go beyond one word
(@code{minibuffer-complete-word}).
@item @key{RET}
Submit the text in the minibuffer as the argument, possibly completing
first as described below (@code{minibuffer-complete-and-exit}).
@item ?
Print a list of all possible completions of the text in the minibuffer
(@code{minibuffer-list-completions}).
@item @key{button2}
Select the highlighted text under the mouse as a minibuffer response.
When the minibuffer is being used to prompt the user for a completion,
any valid completions which are visible on the screen will be highlighted
when the mouse moves over them.  Clicking @key{button2} will select the
highlighted completion and exit the minibuffer.  
(@code{minibuf-select-highlighted-completion}).
@end table

@kindex SPC
@findex minibuffer-complete-word
  @key{SPC} completes much like @key{TAB}, but never goes beyond the
next hyphen or space.  If you have @samp{auto-f} in the minibuffer and
type @key{SPC}, it finds that the completion is @samp{auto-fill-mode},
but it stops completing after @samp{fill-}.  This gives
@samp{auto-fill-}.  Another @key{SPC} at this point completes all the
way to @samp{auto-fill-mode}.  @key{SPC} in the minibuffer when
completion is available runs the command
@code{minibuffer-complete-word}.

  Here are some commands you can use to choose a completion from a
window that displays a list of completions:

@table @kbd
@findex mouse-choose-completion
@item button2up
Clicking mouse button 2 on a completion in the list of possible
completions chooses that completion (@code{mouse-choose-completion}).
You normally use this command while point is in the minibuffer; but you
must click in the list of completions, not in the minibuffer itself.

@findex switch-to-completions
@item @key{PRIOR}
@itemx M-v
Typing @key{PRIOR} or @kbd{M-v}, while in the minibuffer, selects the
window showing the completion list buffer
(@code{switch-to-completions}).  This paves the way for using the
commands below.  (Selecting that window in the usual ways has the same
effect, but this way is more convenient.)

@findex choose-completion
@item @key{RET}
Typing @key{RET} @emph{in the completion list buffer} chooses the
completion that point is in or next to (@code{choose-completion}).  To
use this command, you must first switch windows to the window that shows
the list of completions.

@findex next-list-mode-item
@item @key{RIGHT}
@itemx @key{TAB}
@itemx C-f
Typing the right-arrow key @key{RIGHT}, @key{TAB} or @kbd{C-f} @emph{in
the completion list buffer} moves point to the following completion
(@code{next-list-mode-item}).

@findex previous-list-mode-item
@item @key{LEFT}
@itemx C-b
Typing the left-arrow key @key{LEFT} or @kbd{C-b} @emph{in the
completion list buffer} moves point toward the beginning of the buffer,
to the previous completion (@code{previous-list-mode-item}).
@end table

@node Strict Completion, Completion Options, Completion Commands, Completion
@subsection Strict Completion

  There are three different ways that @key{RET} can work in completing
minibuffers, depending on how the argument will be used.

@itemize @bullet
@item
@dfn{Strict} completion is used when it is meaningless to give any
argument except one of the known alternatives.  For example, when
@kbd{C-x k} reads the name of a buffer to kill, it is meaningless to
give anything but the name of an existing buffer.  In strict
completion, @key{RET} refuses to exit if the text in the minibuffer
does not complete to an exact match.

@item
@dfn{Cautious} completion is similar to strict completion, except that
@key{RET} exits only if the text was an exact match already, not
needing completion.  If the text is not an exact match, @key{RET} does
not exit, but it does complete the text.  If it completes to an exact
match, a second @key{RET} will exit.

Cautious completion is used for reading file names for files that must
already exist.

@item
@dfn{Permissive} completion is used when any string whatever is
meaningful, and the list of completion alternatives is just a guide.
For example, when @kbd{C-x C-f} reads the name of a file to visit, any
file name is allowed, in case you want to create a file.  In
permissive completion, @key{RET} takes the text in the minibuffer
exactly as given, without completing it.
@end itemize

  The completion commands display a list of all possible completions in
a window whenever there is more than one possibility for the very next
character.  Also, typing @kbd{?} explicitly requests such a list.  If
the list of completions is long, you can scroll it with @kbd{C-M-v}
(@pxref{Other Window}).

@node Completion Options,  , Strict Completion, Completion
@subsection Completion Options

@vindex completion-ignored-extensions
  When completion is done on file names, certain file names are usually
ignored.  The variable @code{completion-ignored-extensions} contains a
list of strings; a file whose name ends in any of those strings is
ignored as a possible completion.  The standard value of this variable
has several elements including @code{".o"}, @code{".elc"}, @code{".dvi"}
and @code{"~"}.  The effect is that, for example, @samp{foo} can
complete to @samp{foo.c} even though @samp{foo.o} exists as well.
However, if @emph{all} the possible completions end in ``ignored''
strings, then they are not ignored.  Ignored extensions do not apply to
lists of completions---those always mention all possible completions.

@vindex completion-auto-help
  If a completion command finds the next character is undetermined, it
automatically displays a list of all possible completions.  If the variable
@code{completion-auto-help} is set to @code{nil}, this does not happen,
and you must type @kbd{?} to display the possible completions.

@vindex minibuffer-confirm-incomplete
If the variable @code{minibuffer-confirm-incomplete} is set to @code{t},
then in contexts where @code{completing-read} allows answers that are
not valid completions, an extra @key{RET} must be typed to confirm the
response.  This is helpful for catching typos.

@cindex Icomplete mode
  Icomplete mode presents a constantly-updated display that tells you
what completions are available for the text you've entered so far.  The
command to enable or disable this minor mode is @kbd{M-x
icomplete-mode}.

@node Minibuffer History, Repetition, Completion, Minibuffer
@section Minibuffer History
@cindex minibuffer history
@cindex history of minibuffer input

  Every argument that you enter with the minibuffer is saved on a
@dfn{minibuffer history list} so that you can use it again later in
another argument.  Special commands load the text of an earlier argument
in the minibuffer.  They discard the old minibuffer contents, so you can
think of them as moving through the history of previous arguments.

@table @kbd
@item @key{UP}
@itemx M-p
Move to the next earlier argument string saved in the minibuffer history
(@code{previous-history-element}).
@item @key{DOWN}
@itemx M-n
Move to the next later argument string saved in the minibuffer history
(@code{next-history-element}).
@item M-r @var{regexp} @key{RET}
Move to an earlier saved argument in the minibuffer history that has a
match for @var{regexp} (@code{previous-matching-history-element}).
@item M-s @var{regexp} @key{RET}
Move to a later saved argument in the minibuffer history that has a
match for @var{regexp} (@code{next-matching-history-element}).
@end table

@kindex M-p @r{(minibuffer history)}
@kindex M-n @r{(minibuffer history)}
@findex next-history-element
@findex previous-history-element
  The simplest way to reuse the saved arguments in the history list is
to move through the history list one element at a time.  While in the
minibuffer, use @kbd{M-p} or up-arrow (@code{previous-history-element})
to ``move to'' the next earlier minibuffer input, and use @kbd{M-n} or
down-arrow (@code{next-history-element}) to ``move to'' the next later
input.

  The previous input that you fetch from the history entirely replaces
the contents of the minibuffer.  To use it as the argument, exit the
minibuffer as usual with @key{RET}.  You can also edit the text before
you reuse it; this does not change the history element that you
``moved'' to, but your new argument does go at the end of the history
list in its own right.

  For many minibuffer arguments there is a ``default'' value.  In some
cases, the minibuffer history commands know the default value.  Then you
can insert the default value into the minibuffer as text by using
@kbd{M-n} to move ``into the future'' in the history.

@findex previous-matching-history-element
@findex next-matching-history-element
@kindex M-r @r{(minibuffer history)}
@kindex M-s @r{(minibuffer history)}
  There are also commands to search forward or backward through the
history; they search for history elements that match a regular
expression that you specify with the minibuffer.  @kbd{M-r}
(@code{previous-matching-history-element}) searches older elements in
the history, while @kbd{M-s} (@code{next-matching-history-element})
searches newer elements.  By special dispensation, these commands can
use the minibuffer to read their arguments even though you are already
in the minibuffer when you issue them.  As with incremental searching,
an uppercase letter in the regular expression makes the search
case-sensitive (@pxref{Search Case}).

  All uses of the minibuffer record your input on a history list, but
there are separate history lists for different kinds of arguments.  For
example, there is a list for file names, used by all the commands that
read file names.

  There are several other very specific history lists, including one for
command names read by @kbd{M-x}, one for buffer names, one for arguments
of commands like @code{query-replace}, and one for compilation commands
read by @code{compile}.  Finally, there is one ``miscellaneous'' history
list that most minibuffer arguments use.

@c Do wee need this?
@ignore
@vindex history-length
  The variable @code{history-length} specifies the maximum length of a
minibuffer history list; once a list gets that long, the oldest element
is deleted each time an element is added.  If the value of
@code{history-length} is @code{t}, though, there is no maximum length
and elements are never deleted.
@end ignore

@node Repetition,  , Minibuffer History, Minibuffer
@section Repeating Minibuffer Commands
@cindex command history
@cindex history of commands

  Every command that uses the minibuffer at least once is recorded on a
special history list, together with the values of its arguments, so that
you can repeat the entire command.  In particular, every use of
@kbd{M-x} is recorded there, since @kbd{M-x} uses the minibuffer to read
the command name.

@findex list-command-history
@c widecommands
@table @kbd
@item C-x @key{ESC} @key{ESC}
Re-execute a recent minibuffer command (@code{repeat-complex-command}).
@item M-p
Within @kbd{C-x @key{ESC} @key{ESC}}, move to previous recorded command
(@code{previous-history-element}).
@item M-n
Within @kbd{C-x @key{ESC} @key{ESC}}, move to the next (more recent)
recorded command (@code{next-history-element}).
@item M-x list-command-history
Display the entire command history, showing all the commands
@kbd{C-x @key{ESC} @key{ESC}} can repeat, most recent first.
@end table

@kindex C-x ESC ESC
@findex repeat-complex-command
  @kbd{C-x @key{ESC} @key{ESC}} is used to re-execute a recent
minibuffer-using command.  With no argument, it repeats the last such
command.  A numeric argument specifies which command to repeat; one
means the last one, and larger numbers specify earlier ones.

  @kbd{C-x @key{ESC} @key{ESC}} works by turning the previous command
into a Lisp expression and then entering a minibuffer initialized with
the text for that expression.  If you type just @key{RET}, the command
is repeated as before.  You can also change the command by editing the
Lisp expression.  Whatever expression you finally submit is what will be
executed.  The repeated command is added to the front of the command
history unless it is identical to the most recently executed command
already there.

  Even if you don't understand Lisp syntax, it will probably be obvious
which command is displayed for repetition.  If you do not change the text,
you can be sure the command will repeat exactly as before.

@kindex M-n
@kindex M-p
@findex next-complex-command
@findex previous-complex-command
  If you are in the minibuffer for @kbd{C-x @key{ESC} @key{ESC}} and the
command shown to you is not the one you want to repeat, you can move
around the list of previous commands using @kbd{M-n} and @kbd{M-p}.
@kbd{M-p} replaces the contents of the minibuffer with the next earlier
recorded command, and @kbd{M-n} replaces it with the next later command.
After finding the desired previous command, you can edit its expression
and then resubmit it by typing @key{RET}.  Any editing you have done on
the command to be repeated is lost if you use @kbd{M-n} or @kbd{M-p}.

@kbd{M-n} and @kbd{M-p} are specially defined within @kbd{C-x @key{ESC}
@key{ESC}} to run the commands @code{previous-history-element} and
@code{next-history-element}.

@vindex command-history
  The list of previous commands using the minibuffer is stored as a Lisp
list in the variable @code{command-history}.  Each element of the list
is a Lisp expression which describes one command and its arguments.
Lisp programs can reexecute a command by feeding the corresponding
@code{command-history} element to @code{eval}.