comparison src/keymap.c @ 10305:ebb2a456a3e8

(store_in_keymap): While dumping, copy DEF if a cons.
author Richard M. Stallman <rms@gnu.org>
date Mon, 02 Jan 1995 06:42:56 +0000
parents b83150a8020d
children e1c7a3f0c15f
comparison
equal deleted inserted replaced
10304:ce5ab980a14f 10305:ebb2a456a3e8
393 store_in_keymap (keymap, idx, def) 393 store_in_keymap (keymap, idx, def)
394 Lisp_Object keymap; 394 Lisp_Object keymap;
395 register Lisp_Object idx; 395 register Lisp_Object idx;
396 register Lisp_Object def; 396 register Lisp_Object def;
397 { 397 {
398 /* If we are preparing to dump, and DEF might be pure,
399 copy it to ensure it is not pure. */
400 if (!NILP (Vpurify_flag) && CONSP (def))
401 def = Fcons (XCONS (def)->car, XCONS (def)->cdr);
402
398 if (!CONSP (keymap) || ! EQ (XCONS (keymap)->car, Qkeymap)) 403 if (!CONSP (keymap) || ! EQ (XCONS (keymap)->car, Qkeymap))
399 error ("attempt to define a key in a non-keymap"); 404 error ("attempt to define a key in a non-keymap");
400 405
401 /* If idx is a list (some sort of mouse click, perhaps?), 406 /* If idx is a list (some sort of mouse click, perhaps?),
402 the index we want to use is the car of the list, which 407 the index we want to use is the car of the list, which
461 } 466 }
462 467
463 keymap_end: 468 keymap_end:
464 /* We have scanned the entire keymap, and not found a binding for 469 /* We have scanned the entire keymap, and not found a binding for
465 IDX. Let's add one. */ 470 IDX. Let's add one. */
466 XCONS (insertion_point)->cdr = 471 XCONS (insertion_point)->cdr
467 Fcons (Fcons (idx, def), XCONS (insertion_point)->cdr); 472 = Fcons (Fcons (idx, def), XCONS (insertion_point)->cdr);
468 } 473 }
469 474
470 return def; 475 return def;
471 } 476 }
472 477