/[emacs]/emacs/src/keymap.c
ViewVC logotype

Diff of /emacs/src/keymap.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.245 by pj, Wed Nov 7 08:46:49 2001 UTC revision 1.246 by pj, Tue Nov 13 07:48:37 2001 UTC
# Line 116  static void describe_map P_ ((Lisp_Objec Line 116  static void describe_map P_ ((Lisp_Objec
116  /* Keymap object support - constructors and predicates.                 */  /* Keymap object support - constructors and predicates.                 */
117    
118  DEFUN ("make-keymap", Fmake_keymap, Smake_keymap, 0, 1, 0,  DEFUN ("make-keymap", Fmake_keymap, Smake_keymap, 0, 1, 0,
119    "Construct and return a new keymap, of the form (keymap CHARTABLE . ALIST).\n\         doc: /* Construct and return a new keymap, of the form (keymap CHARTABLE . ALIST).
120  CHARTABLE is a char-table that holds the bindings for the ASCII\n\  CHARTABLE is a char-table that holds the bindings for the ASCII
121  characters.  ALIST is an assoc-list which holds bindings for function keys,\n\  characters.  ALIST is an assoc-list which holds bindings for function keys,
122  mouse events, and any other things that appear in the input stream.\n\  mouse events, and any other things that appear in the input stream.
123  All entries in it are initially nil, meaning \"command undefined\".\n\n\  All entries in it are initially nil, meaning "command undefined".
124  The optional arg STRING supplies a menu name for the keymap\n\  
125  in case you use it as a menu with `x-popup-menu'.")  The optional arg STRING supplies a menu name for the keymap
126    (string)  in case you use it as a menu with `x-popup-menu'.  */)
127         (string)
128       Lisp_Object string;       Lisp_Object string;
129  {  {
130    Lisp_Object tail;    Lisp_Object tail;
# Line 136  in case you use it as a menu with `x-pop Line 137  in case you use it as a menu with `x-pop
137  }  }
138    
139  DEFUN ("make-sparse-keymap", Fmake_sparse_keymap, Smake_sparse_keymap, 0, 1, 0,  DEFUN ("make-sparse-keymap", Fmake_sparse_keymap, Smake_sparse_keymap, 0, 1, 0,
140    "Construct and return a new sparse keymap.\n\         doc: /* Construct and return a new sparse keymap.
141  Its car is `keymap' and its cdr is an alist of (CHAR . DEFINITION),\n\  Its car is `keymap' and its cdr is an alist of (CHAR . DEFINITION),
142  which binds the character CHAR to DEFINITION, or (SYMBOL . DEFINITION),\n\  which binds the character CHAR to DEFINITION, or (SYMBOL . DEFINITION),
143  which binds the function key or mouse event SYMBOL to DEFINITION.\n\  which binds the function key or mouse event SYMBOL to DEFINITION.
144  Initially the alist is nil.\n\n\  Initially the alist is nil.
145  The optional arg STRING supplies a menu name for the keymap\n\  
146  in case you use it as a menu with `x-popup-menu'.")  The optional arg STRING supplies a menu name for the keymap
147    (string)  in case you use it as a menu with `x-popup-menu'.  */)
148         (string)
149       Lisp_Object string;       Lisp_Object string;
150  {  {
151    if (!NILP (string))    if (!NILP (string))
# Line 177  initial_define_lispy_key (keymap, keynam Line 179  initial_define_lispy_key (keymap, keynam
179  }  }
180    
181  DEFUN ("keymapp", Fkeymapp, Skeymapp, 1, 1, 0,  DEFUN ("keymapp", Fkeymapp, Skeymapp, 1, 1, 0,
182    "Return t if OBJECT is a keymap.\n\         doc: /* Return t if OBJECT is a keymap.
183  \n\  
184  A keymap is a list (keymap . ALIST),\n\  A keymap is a list (keymap . ALIST),
185  or a symbol whose function definition is itself a keymap.\n\  or a symbol whose function definition is itself a keymap.
186  ALIST elements look like (CHAR . DEFN) or (SYMBOL . DEFN);\n\  ALIST elements look like (CHAR . DEFN) or (SYMBOL . DEFN);
187  a vector of densely packed bindings for small character codes\n\  a vector of densely packed bindings for small character codes
188  is also allowed as an element.")  is also allowed as an element.  */)
189    (object)       (object)
190       Lisp_Object object;       Lisp_Object object;
191  {  {
192    return (KEYMAPP (object) ? Qt : Qnil);    return (KEYMAPP (object) ? Qt : Qnil);
193  }  }
194    
195  DEFUN ("keymap-prompt", Fkeymap_prompt, Skeymap_prompt, 1, 1, 0,  DEFUN ("keymap-prompt", Fkeymap_prompt, Skeymap_prompt, 1, 1, 0,
196    "Return the prompt-string of a keymap MAP.\n\         doc: /* Return the prompt-string of a keymap MAP.
197  If non-nil, the prompt is shown in the echo-area\n\  If non-nil, the prompt is shown in the echo-area
198  when reading a key-sequence to be looked-up in this keymap.")  when reading a key-sequence to be looked-up in this keymap.  */)
199    (map)       (map)
200       Lisp_Object map;       Lisp_Object map;
201  {  {
202    while (CONSP (map))    while (CONSP (map))
# Line 284  get_keymap (object, error, autoload) Line 286  get_keymap (object, error, autoload)
286     We assume that MAP is a valid keymap.  */     We assume that MAP is a valid keymap.  */
287    
288  DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0,  DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0,
289    "Return the parent keymap of KEYMAP.")         doc: /* Return the parent keymap of KEYMAP.  */)
290    (keymap)       (keymap)
291       Lisp_Object keymap;       Lisp_Object keymap;
292  {  {
293    Lisp_Object list;    Lisp_Object list;
# Line 319  keymap_memberp (map, maps) Line 321  keymap_memberp (map, maps)
321  /* Set the parent keymap of MAP to PARENT.  */  /* Set the parent keymap of MAP to PARENT.  */
322    
323  DEFUN ("set-keymap-parent", Fset_keymap_parent, Sset_keymap_parent, 2, 2, 0,  DEFUN ("set-keymap-parent", Fset_keymap_parent, Sset_keymap_parent, 2, 2, 0,
324    "Modify KEYMAP to set its parent map to PARENT.\n\         doc: /* Modify KEYMAP to set its parent map to PARENT.
325  PARENT should be nil or another keymap.")  PARENT should be nil or another keymap.  */)
326    (keymap, parent)       (keymap, parent)
327       Lisp_Object keymap, parent;       Lisp_Object keymap, parent;
328  {  {
329    Lisp_Object list, prev;    Lisp_Object list, prev;
# Line 813  copy_keymap_1 (chartable, idx, elt) Line 815  copy_keymap_1 (chartable, idx, elt)
815  }  }
816    
817  DEFUN ("copy-keymap", Fcopy_keymap, Scopy_keymap, 1, 1, 0,  DEFUN ("copy-keymap", Fcopy_keymap, Scopy_keymap, 1, 1, 0,
818    "Return a copy of the keymap KEYMAP.\n\         doc: /* Return a copy of the keymap KEYMAP.
819  The copy starts out with the same definitions of KEYMAP,\n\  The copy starts out with the same definitions of KEYMAP,
820  but changing either the copy or KEYMAP does not affect the other.\n\  but changing either the copy or KEYMAP does not affect the other.
821  Any key definitions that are subkeymaps are recursively copied.\n\  Any key definitions that are subkeymaps are recursively copied.
822  However, a key definition which is a symbol whose definition is a keymap\n\  However, a key definition which is a symbol whose definition is a keymap
823  is not copied.")  is not copied.  */)
824    (keymap)       (keymap)
825       Lisp_Object keymap;       Lisp_Object keymap;
826  {  {
827    /* FIXME: This doesn't properly copy menu-items in vectors.  */    /* FIXME: This doesn't properly copy menu-items in vectors.  */
# Line 936  is not copied.") Line 938  is not copied.")
938  /* GC is possible in this function if it autoloads a keymap.  */  /* GC is possible in this function if it autoloads a keymap.  */
939    
940  DEFUN ("define-key", Fdefine_key, Sdefine_key, 3, 3, 0,  DEFUN ("define-key", Fdefine_key, Sdefine_key, 3, 3, 0,
941    "Args KEYMAP, KEY, DEF.  Define key sequence KEY, in KEYMAP, as DEF.\n\         doc: /* Args KEYMAP, KEY, DEF.  Define key sequence KEY, in KEYMAP, as DEF.
942  KEYMAP is a keymap.  KEY is a string or a vector of symbols and characters\n\  KEYMAP is a keymap.  KEY is a string or a vector of symbols and characters
943  meaning a sequence of keystrokes and events.\n\  meaning a sequence of keystrokes and events.
944  Non-ASCII characters with codes above 127 (such as ISO Latin-1)\n\  Non-ASCII characters with codes above 127 (such as ISO Latin-1)
945  can be included if you use a vector.\n\  can be included if you use a vector.
946  DEF is anything that can be a key's definition:\n\  DEF is anything that can be a key's definition:
947   nil (means key is undefined in this keymap),\n\   nil (means key is undefined in this keymap),
948   a command (a Lisp function suitable for interactive calling)\n\   a command (a Lisp function suitable for interactive calling)
949   a string (treated as a keyboard macro),\n\   a string (treated as a keyboard macro),
950   a keymap (to define a prefix key),\n\   a keymap (to define a prefix key),
951   a symbol.  When the key is looked up, the symbol will stand for its\n\   a symbol.  When the key is looked up, the symbol will stand for its
952      function definition, which should at that time be one of the above,\n\      function definition, which should at that time be one of the above,
953      or another symbol whose function definition is used, etc.\n\      or another symbol whose function definition is used, etc.
954   a cons (STRING . DEFN), meaning that DEFN is the definition\n\   a cons (STRING . DEFN), meaning that DEFN is the definition
955      (DEFN should be a valid definition in its own right),\n\      (DEFN should be a valid definition in its own right),
956   or a cons (KEYMAP . CHAR), meaning use definition of CHAR in map KEYMAP.\n\   or a cons (KEYMAP . CHAR), meaning use definition of CHAR in map KEYMAP.
957  \n\  
958  If KEYMAP is a sparse keymap, the pair binding KEY to DEF is added at\n\  If KEYMAP is a sparse keymap, the pair binding KEY to DEF is added at
959  the front of KEYMAP.")  the front of KEYMAP.  */)
960    (keymap, key, def)       (keymap, key, def)
961       Lisp_Object keymap;       Lisp_Object keymap;
962       Lisp_Object key;       Lisp_Object key;
963       Lisp_Object def;       Lisp_Object def;
# Line 1036  the front of KEYMAP.") Line 1038  the front of KEYMAP.")
1038  /* GC is possible in this function if it autoloads a keymap.  */  /* GC is possible in this function if it autoloads a keymap.  */
1039    
1040  DEFUN ("lookup-key", Flookup_key, Slookup_key, 2, 3, 0,  DEFUN ("lookup-key", Flookup_key, Slookup_key, 2, 3, 0,
1041    "In keymap KEYMAP, look up key sequence KEY.  Return the definition.\n\         doc: /* In keymap KEYMAP, look up key sequence KEY.  Return the definition.
1042  nil means undefined.  See doc of `define-key' for kinds of definitions.\n\  nil means undefined.  See doc of `define-key' for kinds of definitions.
1043  \n\  
1044  A number as value means KEY is \"too long\";\n\  A number as value means KEY is "too long";
1045  that is, characters or symbols in it except for the last one\n\  that is, characters or symbols in it except for the last one
1046  fail to be a valid sequence of prefix characters in KEYMAP.\n\  fail to be a valid sequence of prefix characters in KEYMAP.
1047  The number is how many characters at the front of KEY\n\  The number is how many characters at the front of KEY
1048  it takes to reach a non-prefix command.\n\  it takes to reach a non-prefix command.
1049  \n\  
1050  Normally, `lookup-key' ignores bindings for t, which act as default\n\  Normally, `lookup-key' ignores bindings for t, which act as default
1051  bindings, used when nothing else in the keymap applies; this makes it\n\  bindings, used when nothing else in the keymap applies; this makes it
1052  usable as a general function for probing keymaps.  However, if the\n\  usable as a general function for probing keymaps.  However, if the
1053  third optional argument ACCEPT-DEFAULT is non-nil, `lookup-key' will\n\  third optional argument ACCEPT-DEFAULT is non-nil, `lookup-key' will
1054  recognize the default bindings, just as `read-key-sequence' does.")  recognize the default bindings, just as `read-key-sequence' does.  */)
1055    (keymap, key, accept_default)       (keymap, key, accept_default)
1056       register Lisp_Object keymap;       register Lisp_Object keymap;
1057       Lisp_Object key;       Lisp_Object key;
1058       Lisp_Object accept_default;       Lisp_Object accept_default;
# Line 1252  current_minor_maps (modeptr, mapptr) Line 1254  current_minor_maps (modeptr, mapptr)
1254  }  }
1255    
1256  DEFUN ("current-active-maps", Fcurrent_active_maps, Scurrent_active_maps,  DEFUN ("current-active-maps", Fcurrent_active_maps, Scurrent_active_maps,
1257    0, 1, 0,         0, 1, 0,
1258    "Return a list of the currently active keymaps.\n\         doc: /* Return a list of the currently active keymaps.
1259  OLP if non-nil indicates that we should obey `overriding-local-map' and\n\  OLP if non-nil indicates that we should obey `overriding-local-map' and
1260  `overriding-terminal-local-map'.")  `overriding-terminal-local-map'.  */)
1261       (olp)       (olp)
1262       Lisp_Object olp;       Lisp_Object olp;
1263  {  {
# Line 1295  OLP if non-nil indicates that we should Line 1297  OLP if non-nil indicates that we should
1297  /* GC is possible in this function if it autoloads a keymap.  */  /* GC is possible in this function if it autoloads a keymap.  */
1298    
1299  DEFUN ("key-binding", Fkey_binding, Skey_binding, 1, 2, 0,  DEFUN ("key-binding", Fkey_binding, Skey_binding, 1, 2, 0,
1300    "Return the binding for command KEY in current keymaps.\n\         doc: /* Return the binding for command KEY in current keymaps.
1301  KEY is a string or vector, a sequence of keystrokes.\n\  KEY is a string or vector, a sequence of keystrokes.
1302  The binding is probably a symbol with a function definition.\n\  The binding is probably a symbol with a function definition.
1303  \n\  
1304  Normally, `key-binding' ignores bindings for t, which act as default\n\  Normally, `key-binding' ignores bindings for t, which act as default
1305  bindings, used when nothing else in the keymap applies; this makes it\n\  bindings, used when nothing else in the keymap applies; this makes it
1306  usable as a general function for probing keymaps.  However, if the\n\  usable as a general function for probing keymaps.  However, if the
1307  optional second argument ACCEPT-DEFAULT is non-nil, `key-binding' does\n\  optional second argument ACCEPT-DEFAULT is non-nil, `key-binding' does
1308  recognize the default bindings, just as `read-key-sequence' does.")  recognize the default bindings, just as `read-key-sequence' does.  */)
1309    (key, accept_default)       (key, accept_default)
1310       Lisp_Object key, accept_default;       Lisp_Object key, accept_default;
1311  {  {
1312    Lisp_Object *maps, value;    Lisp_Object *maps, value;
# Line 1371  recognize the default bindings, just as Line 1373  recognize the default bindings, just as
1373  /* GC is possible in this function if it autoloads a keymap.  */  /* GC is possible in this function if it autoloads a keymap.  */
1374    
1375  DEFUN ("local-key-binding", Flocal_key_binding, Slocal_key_binding, 1, 2, 0,  DEFUN ("local-key-binding", Flocal_key_binding, Slocal_key_binding, 1, 2, 0,
1376    "Return the binding for command KEYS in current local keymap only.\n\         doc: /* Return the binding for command KEYS in current local keymap only.
1377  KEYS is a string, a sequence of keystrokes.\n\  KEYS is a string, a sequence of keystrokes.
1378  The binding is probably a symbol with a function definition.\n\  The binding is probably a symbol with a function definition.
1379  \n\  
1380  If optional argument ACCEPT-DEFAULT is non-nil, recognize default\n\  If optional argument ACCEPT-DEFAULT is non-nil, recognize default
1381  bindings; see the description of `lookup-key' for more details about this.")  bindings; see the description of `lookup-key' for more details about this.  */)
1382    (keys, accept_default)       (keys, accept_default)
1383       Lisp_Object keys, accept_default;       Lisp_Object keys, accept_default;
1384  {  {
1385    register Lisp_Object map;    register Lisp_Object map;
# Line 1390  bindings; see the description of `lookup Line 1392  bindings; see the description of `lookup
1392  /* GC is possible in this function if it autoloads a keymap.  */  /* GC is possible in this function if it autoloads a keymap.  */
1393    
1394  DEFUN ("global-key-binding", Fglobal_key_binding, Sglobal_key_binding, 1, 2, 0,  DEFUN ("global-key-binding", Fglobal_key_binding, Sglobal_key_binding, 1, 2, 0,
1395    "Return the binding for command KEYS in current global keymap only.\n\         doc: /* Return the binding for command KEYS in current global keymap only.
1396  KEYS is a string, a sequence of keystrokes.\n\  KEYS is a string, a sequence of keystrokes.
1397  The binding is probably a symbol with a function definition.\n\  The binding is probably a symbol with a function definition.
1398  This function's return values are the same as those of lookup-key\n\  This function's return values are the same as those of lookup-key
1399  \(which see).\n\  \(which see).
1400  \n\  
1401  If optional argument ACCEPT-DEFAULT is non-nil, recognize default\n\  If optional argument ACCEPT-DEFAULT is non-nil, recognize default
1402  bindings; see the description of `lookup-key' for more details about this.")  bindings; see the description of `lookup-key' for more details about this.  */)
1403    (keys, accept_default)       (keys, accept_default)
1404       Lisp_Object keys, accept_default;       Lisp_Object keys, accept_default;
1405  {  {
1406    return Flookup_key (current_global_map, keys, accept_default);    return Flookup_key (current_global_map, keys, accept_default);
# Line 1407  bindings; see the description of `lookup Line 1409  bindings; see the description of `lookup
1409  /* GC is possible in this function if it autoloads a keymap.  */  /* GC is possible in this function if it autoloads a keymap.  */
1410    
1411  DEFUN ("minor-mode-key-binding", Fminor_mode_key_binding, Sminor_mode_key_binding, 1, 2, 0,  DEFUN ("minor-mode-key-binding", Fminor_mode_key_binding, Sminor_mode_key_binding, 1, 2, 0,
1412    "Find the visible minor mode bindings of KEY.\n\         doc: /* Find the visible minor mode bindings of KEY.
1413  Return an alist of pairs (MODENAME . BINDING), where MODENAME is the\n\  Return an alist of pairs (MODENAME . BINDING), where MODENAME is the
1414  the symbol which names the minor mode binding KEY, and BINDING is\n\  the symbol which names the minor mode binding KEY, and BINDING is
1415  KEY's definition in that mode.  In particular, if KEY has no\n\  KEY's definition in that mode.  In particular, if KEY has no
1416  minor-mode bindings, return nil.  If the first binding is a\n\  minor-mode bindings, return nil.  If the first binding is a
1417  non-prefix, all subsequent bindings will be omitted, since they would\n\  non-prefix, all subsequent bindings will be omitted, since they would
1418  be ignored.  Similarly, the list doesn't include non-prefix bindings\n\  be ignored.  Similarly, the list doesn't include non-prefix bindings
1419  that come after prefix bindings.\n\  that come after prefix bindings.
1420  \n\  
1421  If optional argument ACCEPT-DEFAULT is non-nil, recognize default\n\  If optional argument ACCEPT-DEFAULT is non-nil, recognize default
1422  bindings; see the description of `lookup-key' for more details about this.")  bindings; see the description of `lookup-key' for more details about this.  */)
1423    (key, accept_default)       (key, accept_default)
1424       Lisp_Object key, accept_default;       Lisp_Object key, accept_default;
1425  {  {
1426    Lisp_Object *modes, *maps;    Lisp_Object *modes, *maps;
# Line 1450  bindings; see the description of `lookup Line 1452  bindings; see the description of `lookup
1452  }  }
1453    
1454  DEFUN ("define-prefix-command", Fdefine_prefix_command, Sdefine_prefix_command, 1, 3, 0,  DEFUN ("define-prefix-command", Fdefine_prefix_command, Sdefine_prefix_command, 1, 3, 0,
1455    "Define COMMAND as a prefix command.  COMMAND should be a symbol.\n\         doc: /* Define COMMAND as a prefix command.  COMMAND should be a symbol.
1456  A new sparse keymap is stored as COMMAND's function definition and its value.\n\  A new sparse keymap is stored as COMMAND's function definition and its value.
1457  If a second optional argument MAPVAR is given, the map is stored as\n\  If a second optional argument MAPVAR is given, the map is stored as
1458  its value instead of as COMMAND's value; but COMMAND is still defined\n\  its value instead of as COMMAND's value; but COMMAND is still defined
1459  as a function.\n\  as a function.
1460  The third optional argument NAME, if given, supplies a menu name\n\  The third optional argument NAME, if given, supplies a menu name
1461  string for the map.  This is required to use the keymap as a menu.")  string for the map.  This is required to use the keymap as a menu.  */)
1462    (command, mapvar, name)       (command, mapvar, name)
1463       Lisp_Object command, mapvar, name;       Lisp_Object command, mapvar, name;
1464  {  {
1465    Lisp_Object map;    Lisp_Object map;
# Line 1471  string for the map.  This is required to Line 1473  string for the map.  This is required to
1473  }  }
1474    
1475  DEFUN ("use-global-map", Fuse_global_map, Suse_global_map, 1, 1, 0,  DEFUN ("use-global-map", Fuse_global_map, Suse_global_map, 1, 1, 0,
1476    "Select KEYMAP as the global keymap.")         doc: /* Select KEYMAP as the global keymap.  */)
1477    (keymap)       (keymap)
1478       Lisp_Object keymap;       Lisp_Object keymap;
1479  {  {
1480    keymap = get_keymap (keymap, 1, 1);    keymap = get_keymap (keymap, 1, 1);
# Line 1482  DEFUN ("use-global-map", Fuse_global_map Line 1484  DEFUN ("use-global-map", Fuse_global_map
1484  }  }
1485    
1486  DEFUN ("use-local-map", Fuse_local_map, Suse_local_map, 1, 1, 0,  DEFUN ("use-local-map", Fuse_local_map, Suse_local_map, 1, 1, 0,
1487    "Select KEYMAP as the local keymap.\n\         doc: /* Select KEYMAP as the local keymap.
1488  If KEYMAP is nil, that means no local keymap.")  If KEYMAP is nil, that means no local keymap.  */)
1489    (keymap)       (keymap)
1490       Lisp_Object keymap;       Lisp_Object keymap;
1491  {  {
1492    if (!NILP (keymap))    if (!NILP (keymap))
# Line 1496  If KEYMAP is nil, that means no local ke Line 1498  If KEYMAP is nil, that means no local ke
1498  }  }
1499    
1500  DEFUN ("current-local-map", Fcurrent_local_map, Scurrent_local_map, 0, 0, 0,  DEFUN ("current-local-map", Fcurrent_local_map, Scurrent_local_map, 0, 0, 0,
1501    "Return current buffer's local keymap, or nil if it has none.")         doc: /* Return current buffer's local keymap, or nil if it has none.  */)
1502    ()       ()
1503  {  {
1504    return current_buffer->keymap;    return current_buffer->keymap;
1505  }  }
1506    
1507  DEFUN ("current-global-map", Fcurrent_global_map, Scurrent_global_map, 0, 0, 0,  DEFUN ("current-global-map", Fcurrent_global_map, Scurrent_global_map, 0, 0, 0,
1508    "Return the current global keymap.")         doc: /* Return the current global keymap.  */)
1509    ()       ()
1510  {  {
1511    return current_global_map;    return current_global_map;
1512  }  }
1513    
1514  DEFUN ("current-minor-mode-maps", Fcurrent_minor_mode_maps, Scurrent_minor_mode_maps, 0, 0, 0,  DEFUN ("current-minor-mode-maps", Fcurrent_minor_mode_maps, Scurrent_minor_mode_maps, 0, 0, 0,
1515    "Return a list of keymaps for the minor modes of the current buffer.")         doc: /* Return a list of keymaps for the minor modes of the current buffer.  */)
1516    ()       ()
1517  {  {
1518    Lisp_Object *maps;    Lisp_Object *maps;
1519    int nmaps = current_minor_maps (0, &maps);    int nmaps = current_minor_maps (0, &maps);
# Line 1583  accessible_keymaps_char_table (args, ind Line 1585  accessible_keymaps_char_table (args, ind
1585  /* This function cannot GC.  */  /* This function cannot GC.  */
1586    
1587  DEFUN ("accessible-keymaps", Faccessible_keymaps, Saccessible_keymaps,  DEFUN ("accessible-keymaps", Faccessible_keymaps, Saccessible_keymaps,
1588    1, 2, 0,         1, 2, 0,
1589    "Find all keymaps accessible via prefix characters from KEYMAP.\n\         doc: /* Find all keymaps accessible via prefix characters from KEYMAP.
1590  Returns a list of elements of the form (KEYS . MAP), where the sequence\n\  Returns a list of elements of the form (KEYS . MAP), where the sequence
1591  KEYS starting from KEYMAP gets you to MAP.  These elements are ordered\n\  KEYS starting from KEYMAP gets you to MAP.  These elements are ordered
1592  so that the KEYS increase in length.  The first element is ([] . KEYMAP).\n\  so that the KEYS increase in length.  The first element is ([] . KEYMAP).
1593  An optional argument PREFIX, if non-nil, should be a key sequence;\n\  An optional argument PREFIX, if non-nil, should be a key sequence;
1594  then the value includes only maps for prefixes that start with PREFIX.")  then the value includes only maps for prefixes that start with PREFIX.  */)
1595    (keymap, prefix)       (keymap, prefix)
1596       Lisp_Object keymap, prefix;       Lisp_Object keymap, prefix;
1597  {  {
1598    Lisp_Object maps, good_maps, tail;    Lisp_Object maps, good_maps, tail;
# Line 1735  Lisp_Object Qsingle_key_description, Qke Line 1737  Lisp_Object Qsingle_key_description, Qke
1737  /* This function cannot GC.  */  /* This function cannot GC.  */
1738    
1739  DEFUN ("key-description", Fkey_description, Skey_description, 1, 1, 0,  DEFUN ("key-description", Fkey_description, Skey_description, 1, 1, 0,
1740    "Return a pretty description of key-sequence KEYS.\n\         doc: /* Return a pretty description of key-sequence KEYS.
1741  Control characters turn into \"C-foo\" sequences, meta into \"M-foo\"\n\  Control characters turn into "C-foo" sequences, meta into "M-foo"
1742  spaces are put between sequence elements, etc.")  spaces are put between sequence elements, etc.  */)
1743    (keys)       (keys)
1744       Lisp_Object keys;       Lisp_Object keys;
1745  {  {
1746    int len = 0;    int len = 0;
# Line 1937  push_key_description (c, p, force_multib Line 1939  push_key_description (c, p, force_multib
1939    
1940  DEFUN ("single-key-description", Fsingle_key_description,  DEFUN ("single-key-description", Fsingle_key_description,
1941         Ssingle_key_description, 1, 2, 0,         Ssingle_key_description, 1, 2, 0,
1942    "Return a pretty description of command character KEY.\n\         doc: /* Return a pretty description of command character KEY.
1943  Control characters turn into C-whatever, etc.\n\  Control characters turn into C-whatever, etc.
1944  Optional argument NO-ANGLES non-nil means don't put angle brackets\n\  Optional argument NO-ANGLES non-nil means don't put angle brackets
1945  around function keys and event symbols.")  around function keys and event symbols.  */)
1946    (key, no_angles)       (key, no_angles)
1947       Lisp_Object key, no_angles;       Lisp_Object key, no_angles;
1948  {  {
1949    if (CONSP (key) && lucid_event_type_list_p (key))    if (CONSP (key) && lucid_event_type_list_p (key))
# Line 2037  push_text_char_description (c, p) Line 2039  push_text_char_description (c, p)
2039  /* This function cannot GC.  */  /* This function cannot GC.  */
2040    
2041  DEFUN ("text-char-description", Ftext_char_description, Stext_char_description, 1, 1, 0,  DEFUN ("text-char-description", Ftext_char_description, Stext_char_description, 1, 1, 0,
2042    "Return a pretty description of file-character CHARACTER.\n\         doc: /* Return a pretty description of file-character CHARACTER.
2043  Control characters turn into \"^char\", etc.")  Control characters turn into "^char", etc.  */)
2044    (character)       (character)
2045       Lisp_Object character;       Lisp_Object character;
2046  {  {
2047    /* Currently MAX_MULTIBYTE_LENGTH is 4 (< 6).  */    /* Currently MAX_MULTIBYTE_LENGTH is 4 (< 6).  */
# Line 2276  where_is_internal (definition, keymaps, Line 2278  where_is_internal (definition, keymaps,
2278  }  }
2279    
2280  DEFUN ("where-is-internal", Fwhere_is_internal, Swhere_is_internal, 1, 4, 0,  DEFUN ("where-is-internal", Fwhere_is_internal, Swhere_is_internal, 1, 4, 0,
2281    "Return list of keys that invoke DEFINITION.\n\         doc: /* Return list of keys that invoke DEFINITION.
2282  If KEYMAP is non-nil, search only KEYMAP and the global keymap.\n\  If KEYMAP is non-nil, search only KEYMAP and the global keymap.
2283  If KEYMAP is nil, search all the currently active keymaps.\n\  If KEYMAP is nil, search all the currently active keymaps.
2284  If KEYMAP is a list of keymaps, search only those keymaps.\n\  If KEYMAP is a list of keymaps, search only those keymaps.
2285  \n\  
2286  If optional 3rd arg FIRSTONLY is non-nil, return the first key sequence found,\n\  If optional 3rd arg FIRSTONLY is non-nil, return the first key sequence found,
2287  rather than a list of all possible key sequences.\n\  rather than a list of all possible key sequences.
2288  If FIRSTONLY is the symbol `non-ascii', return the first binding found,\n\  If FIRSTONLY is the symbol `non-ascii', return the first binding found,
2289  no matter what it is.\n\  no matter what it is.
2290  If FIRSTONLY has another non-nil value, prefer sequences of ASCII characters,\n\  If FIRSTONLY has another non-nil value, prefer sequences of ASCII characters,
2291  and entirely reject menu bindings.\n\  and entirely reject menu bindings.
2292  \n\  
2293  If optional 4th arg NOINDIRECT is non-nil, don't follow indirections\n\  If optional 4th arg NOINDIRECT is non-nil, don't follow indirections
2294  to other keymaps or slots.  This makes it possible to search for an\n\  to other keymaps or slots.  This makes it possible to search for an
2295  indirect definition itself.")  indirect definition itself.  */)
2296    (definition, keymap, firstonly, noindirect)       (definition, keymap, firstonly, noindirect)
2297       Lisp_Object definition, keymap;       Lisp_Object definition, keymap;
2298       Lisp_Object firstonly, noindirect;       Lisp_Object firstonly, noindirect;
2299  {  {
# Line 2456  where_is_internal_1 (binding, key, defin Line 2458  where_is_internal_1 (binding, key, defin
2458  /* describe-bindings - summarizing all the bindings in a set of keymaps.  */  /* describe-bindings - summarizing all the bindings in a set of keymaps.  */
2459    
2460  DEFUN ("describe-buffer-bindings", Fdescribe_buffer_bindings, Sdescribe_buffer_bindings, 1, 3, 0,  DEFUN ("describe-buffer-bindings", Fdescribe_buffer_bindings, Sdescribe_buffer_bindings, 1, 3, 0,
2461    "Insert the list of all defined keys and their definitions.\n\         doc: /* Insert the list of all defined keys and their definitions.
2462  The list is inserted in the current buffer, while the bindings are\n\  The list is inserted in the current buffer, while the bindings are
2463  looked up in BUFFER.\n\  looked up in BUFFER.
2464  The optional argument PREFIX, if non-nil, should be a key sequence;\n\  The optional argument PREFIX, if non-nil, should be a key sequence;
2465  then we display only bindings that start with that prefix.\n\  then we display only bindings that start with that prefix.
2466  The optional argument MENUS, if non-nil, says to mention menu bindings.\n\  The optional argument MENUS, if non-nil, says to mention menu bindings.
2467  \(Ordinarily these are omitted from the output.)")  \(Ordinarily these are omitted from the output.)  */)
2468   (buffer, prefix, menus)       (buffer, prefix, menus)
2469       Lisp_Object buffer, prefix, menus;       Lisp_Object buffer, prefix, menus;
2470  {  {
2471    Lisp_Object outbuf, shadow;    Lisp_Object outbuf, shadow;
# Line 2942  describe_vector_princ (elt) Line 2944  describe_vector_princ (elt)
2944  }  }
2945    
2946  DEFUN ("describe-vector", Fdescribe_vector, Sdescribe_vector, 1, 1, 0,  DEFUN ("describe-vector", Fdescribe_vector, Sdescribe_vector, 1, 1, 0,
2947    "Insert a description of contents of VECTOR.\n\         doc: /* Insert a description of contents of VECTOR.
2948  This is text showing the elements of vector matched against indices.")  This is text showing the elements of vector matched against indices.  */)
2949    (vector)       (vector)
2950       Lisp_Object vector;       Lisp_Object vector;
2951  {  {
2952    int count = specpdl_ptr - specpdl;    int count = specpdl_ptr - specpdl;
# Line 3307  apropos_accum (symbol, string) Line 3309  apropos_accum (symbol, string)
3309  }  }
3310    
3311  DEFUN ("apropos-internal", Fapropos_internal, Sapropos_internal, 1, 2, 0,  DEFUN ("apropos-internal", Fapropos_internal, Sapropos_internal, 1, 2, 0,
3312    "Show all symbols whose names contain match for REGEXP.\n\         doc: /* Show all symbols whose names contain match for REGEXP.
3313  If optional 2nd arg PREDICATE is non-nil, (funcall PREDICATE SYMBOL) is done\n\  If optional 2nd arg PREDICATE is non-nil, (funcall PREDICATE SYMBOL) is done
3314  for each symbol and a symbol is mentioned only if that returns non-nil.\n\  for each symbol and a symbol is mentioned only if that returns non-nil.
3315  Return list of symbols found.")  Return list of symbols found.  */)
3316    (regexp, predicate)       (regexp, predicate)
3317       Lisp_Object regexp, predicate;       Lisp_Object regexp, predicate;
3318  {  {
3319    struct gcpro gcpro1, gcpro2;    struct gcpro gcpro1, gcpro2;
# Line 3355  syms_of_keymap () Line 3357  syms_of_keymap ()
3357    Ffset (intern ("Control-X-prefix"), control_x_map);    Ffset (intern ("Control-X-prefix"), control_x_map);
3358    
3359    DEFVAR_LISP ("define-key-rebound-commands", &Vdefine_key_rebound_commands,    DEFVAR_LISP ("define-key-rebound-commands", &Vdefine_key_rebound_commands,
3360      "List of commands given new key bindings recently.\n\                 doc: /* List of commands given new key bindings recently.
3361  This is used for internal purposes during Emacs startup;\n\  This is used for internal purposes during Emacs startup;
3362  don't alter it yourself.");  don't alter it yourself.  */);
3363    Vdefine_key_rebound_commands = Qt;    Vdefine_key_rebound_commands = Qt;
3364    
3365    DEFVAR_LISP ("minibuffer-local-map", &Vminibuffer_local_map,    DEFVAR_LISP ("minibuffer-local-map", &Vminibuffer_local_map,
3366      "Default keymap to use when reading from the minibuffer.");                 doc: /* Default keymap to use when reading from the minibuffer.  */);
3367    Vminibuffer_local_map = Fmake_sparse_keymap (Qnil);    Vminibuffer_local_map = Fmake_sparse_keymap (Qnil);
3368    
3369    DEFVAR_LISP ("minibuffer-local-ns-map", &Vminibuffer_local_ns_map,    DEFVAR_LISP ("minibuffer-local-ns-map", &Vminibuffer_local_ns_map,
3370      "Local keymap for the minibuffer when spaces are not allowed.");                 doc: /* Local keymap for the minibuffer when spaces are not allowed.  */);
3371    Vminibuffer_local_ns_map = Fmake_sparse_keymap (Qnil);    Vminibuffer_local_ns_map = Fmake_sparse_keymap (Qnil);
3372    Fset_keymap_parent (Vminibuffer_local_ns_map, Vminibuffer_local_map);    Fset_keymap_parent (Vminibuffer_local_ns_map, Vminibuffer_local_map);
3373    
3374    DEFVAR_LISP ("minibuffer-local-completion-map", &Vminibuffer_local_completion_map,    DEFVAR_LISP ("minibuffer-local-completion-map", &Vminibuffer_local_completion_map,
3375      "Local keymap for minibuffer input with completion.");                 doc: /* Local keymap for minibuffer input with completion.  */);
3376    Vminibuffer_local_completion_map = Fmake_sparse_keymap (Qnil);    Vminibuffer_local_completion_map = Fmake_sparse_keymap (Qnil);
3377    Fset_keymap_parent (Vminibuffer_local_completion_map, Vminibuffer_local_map);    Fset_keymap_parent (Vminibuffer_local_completion_map, Vminibuffer_local_map);
3378    
3379    DEFVAR_LISP ("minibuffer-local-must-match-map", &Vminibuffer_local_must_match_map,    DEFVAR_LISP ("minibuffer-local-must-match-map", &Vminibuffer_local_must_match_map,
3380      "Local keymap for minibuffer input with completion, for exact match.");                 doc: /* Local keymap for minibuffer input with completion, for exact match.  */);
3381    Vminibuffer_local_must_match_map = Fmake_sparse_keymap (Qnil);    Vminibuffer_local_must_match_map = Fmake_sparse_keymap (Qnil);
3382    Fset_keymap_parent (Vminibuffer_local_must_match_map,    Fset_keymap_parent (Vminibuffer_local_must_match_map,
3383                        Vminibuffer_local_completion_map);                        Vminibuffer_local_completion_map);
3384    
3385    DEFVAR_LISP ("minor-mode-map-alist", &Vminor_mode_map_alist,    DEFVAR_LISP ("minor-mode-map-alist", &Vminor_mode_map_alist,
3386      "Alist of keymaps to use for minor modes.\n\                 doc: /* Alist of keymaps to use for minor modes.
3387  Each element looks like (VARIABLE . KEYMAP); KEYMAP is used to read\n\  Each element looks like (VARIABLE . KEYMAP); KEYMAP is used to read
3388  key sequences and look up bindings iff VARIABLE's value is non-nil.\n\  key sequences and look up bindings iff VARIABLE's value is non-nil.
3389  If two active keymaps bind the same key, the keymap appearing earlier\n\  If two active keymaps bind the same key, the keymap appearing earlier
3390  in the list takes precedence.");  in the list takes precedence.  */);
3391    Vminor_mode_map_alist = Qnil;    Vminor_mode_map_alist = Qnil;
3392    
3393    DEFVAR_LISP ("minor-mode-overriding-map-alist", &Vminor_mode_overriding_map_alist,    DEFVAR_LISP ("minor-mode-overriding-map-alist", &Vminor_mode_overriding_map_alist,
3394      "Alist of keymaps to use for minor modes, in current major mode.\n\                 doc: /* Alist of keymaps to use for minor modes, in current major mode.
3395  This variable is a alist just like `minor-mode-map-alist', and it is\n\  This variable is a alist just like `minor-mode-map-alist', and it is
3396  used the same way (and before `minor-mode-map-alist'); however,\n\  used the same way (and before `minor-mode-map-alist'); however,
3397  it is provided for major modes to bind locally.");  it is provided for major modes to bind locally.  */);
3398    Vminor_mode_overriding_map_alist = Qnil;    Vminor_mode_overriding_map_alist = Qnil;
3399    
3400    DEFVAR_LISP ("function-key-map", &Vfunction_key_map,    DEFVAR_LISP ("function-key-map", &Vfunction_key_map,
3401    "Keymap mapping ASCII function key sequences onto their preferred forms.\n\                 doc: /* Keymap mapping ASCII function key sequences onto their preferred forms.
3402  This allows Emacs to recognize function keys sent from ASCII\n\  This allows Emacs to recognize function keys sent from ASCII
3403  terminals at any point in a key sequence.\n\  terminals at any point in a key sequence.
3404  \n\  
3405  The `read-key-sequence' function replaces any subsequence bound by\n\  The `read-key-sequence' function replaces any subsequence bound by
3406  `function-key-map' with its binding.  More precisely, when the active\n\  `function-key-map' with its binding.  More precisely, when the active
3407  keymaps have no binding for the current key sequence but\n\  keymaps have no binding for the current key sequence but
3408  `function-key-map' binds a suffix of the sequence to a vector or string,\n\  `function-key-map' binds a suffix of the sequence to a vector or string,
3409  `read-key-sequence' replaces the matching suffix with its binding, and\n\  `read-key-sequence' replaces the matching suffix with its binding, and
3410  continues with the new sequence.\n\  continues with the new sequence.
3411  \n\  
3412  The events that come from bindings in `function-key-map' are not\n\  The events that come from bindings in `function-key-map' are not
3413  themselves looked up in `function-key-map'.\n\  themselves looked up in `function-key-map'.
3414  \n\  
3415  For example, suppose `function-key-map' binds `ESC O P' to [f1].\n\  For example, suppose `function-key-map' binds `ESC O P' to [f1].
3416  Typing `ESC O P' to `read-key-sequence' would return [f1].  Typing\n\  Typing `ESC O P' to `read-key-sequence' would return [f1].  Typing
3417  `C-x ESC O P' would return [?\\C-x f1].  If [f1] were a prefix\n\  `C-x ESC O P' would return [?\\C-x f1].  If [f1] were a prefix
3418  key, typing `ESC O P x' would return [f1 x].");  key, typing `ESC O P x' would return [f1 x].  */);
3419    Vfunction_key_map = Fmake_sparse_keymap (Qnil);    Vfunction_key_map = Fmake_sparse_keymap (Qnil);
3420    
3421    DEFVAR_LISP ("key-translation-map", &Vkey_translation_map,    DEFVAR_LISP ("key-translation-map", &Vkey_translation_map,
3422      "Keymap of key translations that can override keymaps.\n\                 doc: /* Keymap of key translations that can override keymaps.
3423  This keymap works like `function-key-map', but comes after that,\n\  This keymap works like `function-key-map', but comes after that,
3424  and applies even for keys that have ordinary bindings.");  and applies even for keys that have ordinary bindings.  */);
3425    Vkey_translation_map = Qnil;    Vkey_translation_map = Qnil;
3426    
3427    Qsingle_key_description = intern ("single-key-description");    Qsingle_key_description = intern ("single-key-description");

Legend:
Removed from v.1.245  
changed lines
  Added in v.1.246

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26