comparison lispref/minibuf.texi @ 64843:6c4d2fa924e4

(Minibuffer Misc): Node split up. (Minibuffer Commands, Minibuffer Windows, Minibuffer Contents) (Recursive Mini): New nodes split out from Minibuffer Misc. (Minibuffer Misc): Document max-mini-window-height.
author Richard M. Stallman <rms@gnu.org>
date Tue, 09 Aug 2005 12:05:30 +0000
parents 6dfe79da09ed
children 4e8cce76fcf3
comparison
equal deleted inserted replaced
64842:0021965e29a2 64843:6c4d2fa924e4
9 @chapter Minibuffers 9 @chapter Minibuffers
10 @cindex arguments, reading 10 @cindex arguments, reading
11 @cindex complex arguments 11 @cindex complex arguments
12 @cindex minibuffer 12 @cindex minibuffer
13 13
14 A @dfn{minibuffer} is a special buffer that Emacs commands use to read 14 A @dfn{minibuffer} is a special buffer that Emacs commands use to
15 arguments more complicated than the single numeric prefix argument. 15 read arguments more complicated than the single numeric prefix
16 These arguments include file names, buffer names, and command names (as 16 argument. These arguments include file names, buffer names, and
17 in @kbd{M-x}). The minibuffer is displayed on the bottom line of the 17 command names (as in @kbd{M-x}). The minibuffer is displayed on the
18 frame, in the same place as the echo area, but only while it is in use 18 bottom line of the frame, in the same place as the echo area
19 for reading an argument. 19 (@pxref{The Echo Area}), but only while it is in use for reading an
20 argument.
20 21
21 @menu 22 @menu
22 * Intro to Minibuffers:: Basic information about minibuffers. 23 * Intro to Minibuffers:: Basic information about minibuffers.
23 * Text from Minibuffer:: How to read a straight text string. 24 * Text from Minibuffer:: How to read a straight text string.
24 * Object from Minibuffer:: How to read a Lisp object or expression. 25 * Object from Minibuffer:: How to read a Lisp object or expression.
27 * Initial Input:: Specifying initial contents for the minibuffer. 28 * Initial Input:: Specifying initial contents for the minibuffer.
28 * Completion:: How to invoke and customize completion. 29 * Completion:: How to invoke and customize completion.
29 * Yes-or-No Queries:: Asking a question with a simple answer. 30 * Yes-or-No Queries:: Asking a question with a simple answer.
30 * Multiple Queries:: Asking a series of similar questions. 31 * Multiple Queries:: Asking a series of similar questions.
31 * Reading a Password:: Reading a password from the terminal. 32 * Reading a Password:: Reading a password from the terminal.
33 * Minibuffer Commands:: Commands used as key bindings in minibuffers.
34 * Minibuffer Contents:: How such commands access the minibuffer text.
35 * Minibuffer Windows:: Operating on the special minibuffer windows.
36 * Recursive Mini:: Whether recursive entry to minibuffer is allowed.
32 * Minibuffer Misc:: Various customization hooks and variables. 37 * Minibuffer Misc:: Various customization hooks and variables.
33 @end menu 38 @end menu
34 39
35 @node Intro to Minibuffers 40 @node Intro to Minibuffers
36 @section Introduction to Minibuffers 41 @section Introduction to Minibuffers
1692 The optional argument @var{default} specifies the default password to 1697 The optional argument @var{default} specifies the default password to
1693 return if the user enters empty input. If @var{default} is @code{nil}, 1698 return if the user enters empty input. If @var{default} is @code{nil},
1694 then @code{read-passwd} returns the null string in that case. 1699 then @code{read-passwd} returns the null string in that case.
1695 @end defun 1700 @end defun
1696 1701
1697 @node Minibuffer Misc 1702 @node Minibuffer Commands
1698 @section Minibuffer Miscellany 1703 @section Minibuffer Commands
1699 1704
1700 This section describes some basic functions and variables related to 1705 This section describes some commands meant for use in the
1701 minibuffers. 1706 minibuffer.
1702 1707
1703 @deffn Command exit-minibuffer 1708 @deffn Command exit-minibuffer
1704 This command exits the active minibuffer. It is normally bound to 1709 This command exits the active minibuffer. It is normally bound to
1705 keys in minibuffer local keymaps. 1710 keys in minibuffer local keymaps.
1706 @end deffn 1711 @end deffn
1731 This command replaces the minibuffer contents with the value of the 1736 This command replaces the minibuffer contents with the value of the
1732 @var{n}th next (newer) history element that matches @var{pattern} (a 1737 @var{n}th next (newer) history element that matches @var{pattern} (a
1733 regular expression). 1738 regular expression).
1734 @end deffn 1739 @end deffn
1735 1740
1736 @defun minibuffer-prompt 1741 @node Minibuffer Windows
1737 This function returns the prompt string of the currently active 1742 @section Minibuffer Windows
1738 minibuffer. If no minibuffer is active, it returns @code{nil}. 1743
1739 @end defun 1744 These functions access and select minibuffer windows
1740 1745 and test whether they are active.
1741 @defun minibuffer-prompt-end
1742 @tindex minibuffer-prompt-end
1743 This function returns the current
1744 position of the end of the minibuffer prompt, if a minibuffer is
1745 current. Otherwise, it returns the minimum valid buffer position.
1746 @end defun
1747
1748 @defun minibuffer-contents
1749 @tindex minibuffer-contents
1750 This function returns the editable
1751 contents of the minibuffer (that is, everything except the prompt) as
1752 a string, if a minibuffer is current. Otherwise, it returns the
1753 entire contents of the current buffer.
1754 @end defun
1755
1756 @defun minibuffer-contents-no-properties
1757 @tindex minibuffer-contents-no-properties
1758 This is like @code{minibuffer-contents}, except that it does not copy text
1759 properties, just the characters themselves. @xref{Text Properties}.
1760 @end defun
1761
1762 @defun delete-minibuffer-contents
1763 @tindex delete-minibuffer-contents
1764 This function erases the editable
1765 contents of the minibuffer (that is, everything except the prompt), if
1766 a minibuffer is current. Otherwise, it erases the entire buffer.
1767 @end defun
1768
1769 @defun minibuffer-prompt-width
1770 This function returns the current display-width of the minibuffer
1771 prompt, if a minibuffer is current. Otherwise, it returns zero.
1772 @end defun
1773
1774 @defvar minibuffer-setup-hook
1775 This is a normal hook that is run whenever the minibuffer is entered.
1776 @xref{Hooks}.
1777 @end defvar
1778
1779 @defvar minibuffer-exit-hook
1780 This is a normal hook that is run whenever the minibuffer is exited.
1781 @xref{Hooks}.
1782 @end defvar
1783
1784 @defvar minibuffer-help-form
1785 @anchor{Definition of minibuffer-help-form}
1786 The current value of this variable is used to rebind @code{help-form}
1787 locally inside the minibuffer (@pxref{Help Functions}).
1788 @end defvar
1789
1790 @defun minibufferp &optional buffer-or-name
1791 This function returns non-@code{nil} if @var{buffer-or-name} is a
1792 minibuffer. If @var{buffer-or-name} is omitted, it tests the current
1793 buffer.
1794 @end defun
1795 1746
1796 @defun active-minibuffer-window 1747 @defun active-minibuffer-window
1797 This function returns the currently active minibuffer window, or 1748 This function returns the currently active minibuffer window, or
1798 @code{nil} if none is currently active. 1749 @code{nil} if none is currently active.
1799 @end defun 1750 @end defun
1830 @defun minibuffer-window-active-p window 1781 @defun minibuffer-window-active-p window
1831 This function returns non-@code{nil} if @var{window}, assumed to be 1782 This function returns non-@code{nil} if @var{window}, assumed to be
1832 a minibuffer window, is currently active. 1783 a minibuffer window, is currently active.
1833 @end defun 1784 @end defun
1834 1785
1835 @defvar minibuffer-scroll-window 1786 @node Minibuffer Contents
1836 @anchor{Definition of minibuffer-scroll-window} 1787 @section Minibuffer Contents
1837 If the value of this variable is non-@code{nil}, it should be a window 1788
1838 object. When the function @code{scroll-other-window} is called in the 1789 These functions access the minibuffer prompt and contents.
1839 minibuffer, it scrolls this window. 1790
1840 @end defvar 1791 @defun minibuffer-prompt
1841 1792 This function returns the prompt string of the currently active
1842 @defun minibuffer-selected-window 1793 minibuffer. If no minibuffer is active, it returns @code{nil}.
1843 This function returns the window which was selected when the 1794 @end defun
1844 minibuffer was entered. If selected window is not a minibuffer 1795
1845 window, it returns @code{nil}. 1796 @defun minibuffer-prompt-end
1846 @end defun 1797 @tindex minibuffer-prompt-end
1847 1798 This function returns the current
1848 Finally, some functions and variables deal with recursive minibuffers 1799 position of the end of the minibuffer prompt, if a minibuffer is
1800 current. Otherwise, it returns the minimum valid buffer position.
1801 @end defun
1802
1803 @defun minibuffer-prompt-width
1804 This function returns the current display-width of the minibuffer
1805 prompt, if a minibuffer is current. Otherwise, it returns zero.
1806 @end defun
1807
1808 @defun minibuffer-contents
1809 @tindex minibuffer-contents
1810 This function returns the editable
1811 contents of the minibuffer (that is, everything except the prompt) as
1812 a string, if a minibuffer is current. Otherwise, it returns the
1813 entire contents of the current buffer.
1814 @end defun
1815
1816 @defun minibuffer-contents-no-properties
1817 @tindex minibuffer-contents-no-properties
1818 This is like @code{minibuffer-contents}, except that it does not copy text
1819 properties, just the characters themselves. @xref{Text Properties}.
1820 @end defun
1821
1822 @defun delete-minibuffer-contents
1823 @tindex delete-minibuffer-contents
1824 This function erases the editable contents of the minibuffer (that is,
1825 everything except the prompt), if a minibuffer is current. Otherwise,
1826 it erases the entire current buffer.
1827 @end defun
1828
1829 @node Recursive Mini
1830 @section Recursive Minibuffers
1831
1832 These functions and variables deal with recursive minibuffers
1849 (@pxref{Recursive Editing}): 1833 (@pxref{Recursive Editing}):
1850 1834
1851 @defun minibuffer-depth 1835 @defun minibuffer-depth
1852 This function returns the current depth of activations of the 1836 This function returns the current depth of activations of the
1853 minibuffer, a nonnegative integer. If no minibuffers are active, it 1837 minibuffer, a nonnegative integer. If no minibuffers are active, it
1873 also achieve this by binding @code{enable-recursive-minibuffers} 1857 also achieve this by binding @code{enable-recursive-minibuffers}
1874 to @code{t} in the interactive declaration (@pxref{Using Interactive}). 1858 to @code{t} in the interactive declaration (@pxref{Using Interactive}).
1875 The minibuffer command @code{next-matching-history-element} (normally 1859 The minibuffer command @code{next-matching-history-element} (normally
1876 @kbd{M-s} in the minibuffer) does the latter. 1860 @kbd{M-s} in the minibuffer) does the latter.
1877 1861
1862 @node Minibuffer Misc
1863 @section Minibuffer Miscellany
1864
1865 @defun minibufferp &optional buffer-or-name
1866 This function returns non-@code{nil} if @var{buffer-or-name} is a
1867 minibuffer. If @var{buffer-or-name} is omitted, it tests the current
1868 buffer.
1869 @end defun
1870
1871 @defvar minibuffer-setup-hook
1872 This is a normal hook that is run whenever the minibuffer is entered.
1873 @xref{Hooks}.
1874 @end defvar
1875
1876 @defvar minibuffer-exit-hook
1877 This is a normal hook that is run whenever the minibuffer is exited.
1878 @xref{Hooks}.
1879 @end defvar
1880
1881 @defvar minibuffer-help-form
1882 @anchor{Definition of minibuffer-help-form}
1883 The current value of this variable is used to rebind @code{help-form}
1884 locally inside the minibuffer (@pxref{Help Functions}).
1885 @end defvar
1886
1887 @defvar minibuffer-scroll-window
1888 @anchor{Definition of minibuffer-scroll-window}
1889 If the value of this variable is non-@code{nil}, it should be a window
1890 object. When the function @code{scroll-other-window} is called in the
1891 minibuffer, it scrolls this window.
1892 @end defvar
1893
1894 @defun minibuffer-selected-window
1895 This function returns the window which was selected when the
1896 minibuffer was entered. If selected window is not a minibuffer
1897 window, it returns @code{nil}.
1898 @end defun
1899
1900 @defopt max-mini-window-height
1901 This variable specifies the maximum height for resizing minibuffer
1902 windows. If a float, it specifies a fraction of the height of the
1903 frame. If an integer, it specifies a number of lines.
1904 @end defopt
1905
1878 @defun minibuffer-message string 1906 @defun minibuffer-message string
1879 This function displays @var{string} temporarily at the end of the 1907 This function displays @var{string} temporarily at the end of the
1880 minibuffer text, for two seconds, or until the next input event 1908 minibuffer text, for two seconds, or until the next input event
1881 arrives, whichever comes first. 1909 arrives, whichever comes first.
1882 @end defun 1910 @end defun