comparison src/keymap.c @ 362:d1e5cf833d37

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Sun, 28 Jul 1991 14:50:08 +0000
parents 7e94ea5958e0
children d04df545062f
comparison
equal deleted inserted replaced
361:313b0555ba8f 362:d1e5cf833d37
140 } 140 }
141 #endif /* 0 */ 141 #endif /* 0 */
142 142
143 DEFUN ("keymapp", Fkeymapp, Skeymapp, 1, 1, 0, 143 DEFUN ("keymapp", Fkeymapp, Skeymapp, 1, 1, 0,
144 "Return t if ARG is a keymap.\n\ 144 "Return t if ARG is a keymap.\n\
145 A keymap is list (keymap . ALIST), where alist elements look like 145 \n\
146 (CHAR . DEFN) or (SYMBOL . DEFN), or a list (keymap VECTOR . ALIST) 146 A keymap is list (keymap . ALIST), a list (keymap VECTOR . ALIST),\n\
147 where VECTOR is a 128-element vector of bindings for ASCII characters, 147 or a symbol whose function definition is a keymap is itself a keymap.\n\
148 and ALIST is as above.") 148 ALIST elements look like (CHAR . DEFN) or (SYMBOL . DEFN);\n\
149 VECTOR is a 128-element vector of bindings for ASCII characters.")
149 (object) 150 (object)
150 Lisp_Object object; 151 Lisp_Object object;
151 { 152 {
152 return (NULL (get_keymap_1 (object, 0)) ? Qnil : Qt); 153 return (NULL (get_keymap_1 (object, 0)) ? Qnil : Qt);
153 } 154 }
333 334
334 DEFUN ("copy-keymap", Fcopy_keymap, Scopy_keymap, 1, 1, 0, 335 DEFUN ("copy-keymap", Fcopy_keymap, Scopy_keymap, 1, 1, 0,
335 "Return a copy of the keymap KEYMAP.\n\ 336 "Return a copy of the keymap KEYMAP.\n\
336 The copy starts out with the same definitions of KEYMAP,\n\ 337 The copy starts out with the same definitions of KEYMAP,\n\
337 but changing either the copy or KEYMAP does not affect the other.\n\ 338 but changing either the copy or KEYMAP does not affect the other.\n\
338 Any key definitions that are subkeymaps are recursively copied.") 339 Any key definitions that are subkeymaps are recursively copied.\n\
340 However, a key definition which is a symbol whose definition is a keymap\n\
341 is not copied.")
339 (keymap) 342 (keymap)
340 Lisp_Object keymap; 343 Lisp_Object keymap;
341 { 344 {
342 register Lisp_Object copy, tail; 345 register Lisp_Object copy, tail;
343 346
355 register int i; 358 register int i;
356 359
357 table = Fcopy_sequence (table); 360 table = Fcopy_sequence (table);
358 361
359 for (i = 0; i < DENSE_TABLE_SIZE; i++) 362 for (i = 0; i < DENSE_TABLE_SIZE; i++)
360 if (! NULL (Fkeymapp (XVECTOR (table)->contents[i]))) 363 if (XTYPE (XVECTOR (copy)->contents[i]) != Lisp_Symbol)
361 XVECTOR (table)->contents[i] 364 if (! NULL (Fkeymapp (XVECTOR (table)->contents[i])))
362 = Fcopy_keymap (XVECTOR (table)->contents[i]); 365 XVECTOR (table)->contents[i]
366 = Fcopy_keymap (XVECTOR (table)->contents[i]);
363 XCONS (tail)->car = table; 367 XCONS (tail)->car = table;
364 368
365 tail = XCONS (tail)->cdr; 369 tail = XCONS (tail)->cdr;
366 } 370 }
367 } 371 }
370 while (CONSP (tail)) 374 while (CONSP (tail))
371 { 375 {
372 register Lisp_Object elt; 376 register Lisp_Object elt;
373 377
374 elt = XCONS (tail)->car; 378 elt = XCONS (tail)->car;
375 if (CONSP (elt) && ! NULL (Fkeymapp (XCONS (elt)->cdr))) 379 if (CONSP (elt)
380 && XTYPE (XCONS (elt)->cdr) != Lisp_Symbol
381 && ! NULL (Fkeymapp (XCONS (elt)->cdr)))
376 XCONS (elt)->cdr = Fcopy_keymap (XCONS (elt)->cdr); 382 XCONS (elt)->cdr = Fcopy_keymap (XCONS (elt)->cdr);
377 383
378 tail = XCONS (tail)->cdr; 384 tail = XCONS (tail)->cdr;
379 } 385 }
380 386
665 } 671 }
666 672
667 DEFUN ("define-prefix-command", Fdefine_prefix_command, Sdefine_prefix_command, 1, 2, 0, 673 DEFUN ("define-prefix-command", Fdefine_prefix_command, Sdefine_prefix_command, 1, 2, 0,
668 "Define COMMAND as a prefix command.\n\ 674 "Define COMMAND as a prefix command.\n\
669 A new sparse keymap is stored as COMMAND's function definition and its value.\n\ 675 A new sparse keymap is stored as COMMAND's function definition and its value.\n\
670 If a second optional argument MAPVAR is given, the map is stored as its\n\ 676 If a second optional argument MAPVAR is given, the map is stored as\n\
671 value instead of as COMMAND's value; but COMMAND is still defined as a function.") 677 its value instead of as COMMAND's value; but COMMAND is still defined\n\
678 as a function.")
672 (name, mapvar) 679 (name, mapvar)
673 Lisp_Object name, mapvar; 680 Lisp_Object name, mapvar;
674 { 681 {
675 Lisp_Object map; 682 Lisp_Object map;
676 map = Fmake_sparse_keymap (); 683 map = Fmake_sparse_keymap ();
957 964
958 case Lisp_Symbol: /* Function key or event-symbol */ 965 case Lisp_Symbol: /* Function key or event-symbol */
959 return Fsymbol_name (key); 966 return Fsymbol_name (key);
960 967
961 case Lisp_Cons: /* Mouse event */ 968 case Lisp_Cons: /* Mouse event */
962 key = XCONS (key)->cdr; 969 key = XCONS (key)->car;
963 if (XTYPE (key) == Lisp_Symbol) 970 if (XTYPE (key) == Lisp_Symbol)
964 return Fsymbol_name (key); 971 return Fsymbol_name (key);
965 /* Mouse events should have an identifying symbol as their car; 972 /* Mouse events should have an identifying symbol as their car;
966 fall through when this isn't the case. */ 973 fall through when this isn't the case. */
967 974