comparison lispref/keymaps.texi @ 28873:8ac5eec13f0d

*** empty log message ***
author Gerd Moellmann <gerd@gnu.org>
date Thu, 11 May 2000 13:29:12 +0000
parents 5d50c2e42c58
children dbf3b04f858a
comparison
equal deleted inserted replaced
28872:2284937b58f4 28873:8ac5eec13f0d
144 @cindex keymap prompt string 144 @cindex keymap prompt string
145 @cindex overall prompt string 145 @cindex overall prompt string
146 @cindex prompt string of keymap 146 @cindex prompt string of keymap
147 Aside from bindings, a keymap can also have a string as an element. 147 Aside from bindings, a keymap can also have a string as an element.
148 This is called the @dfn{overall prompt string} and makes it possible to 148 This is called the @dfn{overall prompt string} and makes it possible to
149 use the keymap as a menu. @xref{Menu Keymaps}. 149 use the keymap as a menu. @xref{Defining Menus}.
150 @end table 150 @end table
151 151
152 @cindex meta characters lookup 152 @cindex meta characters lookup
153 Keymaps do not directly record bindings for the meta characters. 153 Keymaps do not directly record bindings for the meta characters.
154 Instead, meta characters are regarded for 154 Instead, meta characters are regarded for
226 @result{} (keymap [nil nil nil @dots{} nil nil]) 226 @result{} (keymap [nil nil nil @dots{} nil nil])
227 @end group 227 @end group
228 @end example 228 @end example
229 229
230 If you specify @var{prompt}, that becomes the overall prompt string for 230 If you specify @var{prompt}, that becomes the overall prompt string for
231 the keymap. The prompt string is useful for menu keymaps (@pxref{Menu 231 the keymap. The prompt string is useful for menu keymaps
232 Keymaps}). 232 (@pxref{Defining Menus}).
233 @end defun 233 @end defun
234 234
235 @defun make-sparse-keymap &optional prompt 235 @defun make-sparse-keymap &optional prompt
236 This function creates and returns a new sparse keymap with no entries. 236 This function creates and returns a new sparse keymap with no entries.
237 The new keymap does not bind any events. The argument @var{prompt} 237 The new keymap does not bind any events. The argument @var{prompt}
473 its value. But if @var{mapvar} is non-@code{nil}, it sets @var{mapvar} 473 its value. But if @var{mapvar} is non-@code{nil}, it sets @var{mapvar}
474 as a variable instead. 474 as a variable instead.
475 475
476 If @var{prompt} is non-@code{nil}, that becomes the overall prompt 476 If @var{prompt} is non-@code{nil}, that becomes the overall prompt
477 string for the keymap. The prompt string is useful for menu keymaps 477 string for the keymap. The prompt string is useful for menu keymaps
478 (@pxref{Menu Keymaps}). 478 (@pxref{Defining Menus}).
479 @end defun 479 @end defun
480 480
481 @node Active Keymaps 481 @node Active Keymaps
482 @section Active Keymaps 482 @section Active Keymaps
483 @cindex active keymap 483 @cindex active keymap
1524 @cindex prompt string (of menu) 1524 @cindex prompt string (of menu)
1525 1525
1526 A keymap is suitable for menu use if it has an @dfn{overall prompt 1526 A keymap is suitable for menu use if it has an @dfn{overall prompt
1527 string}, which is a string that appears as an element of the keymap. 1527 string}, which is a string that appears as an element of the keymap.
1528 (@xref{Format of Keymaps}.) The string should describe the purpose of 1528 (@xref{Format of Keymaps}.) The string should describe the purpose of
1529 the menu. The easiest way to construct a keymap with a prompt string is 1529 the menu's commands. Emacs displays the overall prompt string as the
1530 to specify the string as an argument when you call @code{make-keymap} or 1530 menu title in some cases, depending on which toolkit is used for
1531 displaying menus. Keyboard menus also display the overall prompt
1532 string.
1533
1534 The easiest way to construct a keymap with a prompt string is to specify
1535 the string as an argument when you call @code{make-keymap} or
1531 @code{make-sparse-keymap} (@pxref{Creating Keymaps}). 1536 @code{make-sparse-keymap} (@pxref{Creating Keymaps}).
1532 1537
1533 The order of items in the menu is the same as the order of bindings in 1538 The order of items in the menu is the same as the order of bindings in
1534 the keymap. Since @code{define-key} puts new bindings at the front, you 1539 the keymap. Since @code{define-key} puts new bindings at the front, you
1535 should define the menu items starting at the bottom of the menu and 1540 should define the menu items starting at the bottom of the menu and
1870 1875
1871 When a prefix key ending with a keyboard event (a character or function 1876 When a prefix key ending with a keyboard event (a character or function
1872 key) has a definition that is a menu keymap, the user can use the 1877 key) has a definition that is a menu keymap, the user can use the
1873 keyboard to choose a menu item. 1878 keyboard to choose a menu item.
1874 1879
1875 Emacs displays the menu alternatives (the item strings of the bindings) 1880 Emacs displays the menu's overall prompt string followed by the
1876 in the echo area. If they don't all fit at once, the user can type 1881 alternatives (the item strings of the bindings) in the echo area. If
1877 @key{SPC} to see the next line of alternatives. Successive uses of 1882 the bindings don't all fit at once, the user can type @key{SPC} to see
1878 @key{SPC} eventually get to the end of the menu and then cycle around to 1883 the next line of alternatives. Successive uses of @key{SPC} eventually
1879 the beginning. (The variable @code{menu-prompt-more-char} specifies 1884 get to the end of the menu and then cycle around to the beginning. (The
1880 which character is used for this; @key{SPC} is the default.) 1885 variable @code{menu-prompt-more-char} specifies which character is used
1886 for this; @key{SPC} is the default.)
1881 1887
1882 When the user has found the desired alternative from the menu, he or she 1888 When the user has found the desired alternative from the menu, he or she
1883 should type the corresponding character---the one whose binding is that 1889 should type the corresponding character---the one whose binding is that
1884 alternative. 1890 alternative.
1885 1891