aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorKen Raeburn2001-10-16 09:09:51 +0000
committerKen Raeburn2001-10-16 09:09:51 +0000
commitf3fbd1553534bb85c75baf891c0ca9aaa4c3fa6f (patch)
tree43eb51ff0ca4af1705387403827ef210098f2da8 /src/keyboard.c
parent018ba359ab456f6a43f3acea0c15df616aa0ad02 (diff)
downloademacs-f3fbd1553534bb85c75baf891c0ca9aaa4c3fa6f.tar.gz
emacs-f3fbd1553534bb85c75baf891c0ca9aaa4c3fa6f.zip
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
with lisp system changes.
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c62
1 files changed, 37 insertions, 25 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 414f72b971f..23b1f0d5b57 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2358,15 +2358,21 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2358 KBOARD *kb = FRAME_KBOARD (XFRAME (selected_frame)); 2358 KBOARD *kb = FRAME_KBOARD (XFRAME (selected_frame));
2359 if (kb != current_kboard) 2359 if (kb != current_kboard)
2360 { 2360 {
2361 Lisp_Object *tailp = &kb->kbd_queue; 2361 Lisp_Object link = kb->kbd_queue;
2362 /* We shouldn't get here if we were in single-kboard mode! */ 2362 /* We shouldn't get here if we were in single-kboard mode! */
2363 if (single_kboard) 2363 if (single_kboard)
2364 abort (); 2364 abort ();
2365 while (CONSP (*tailp)) 2365 if (CONSP (link))
2366 tailp = &XCDR (*tailp); 2366 {
2367 if (!NILP (*tailp)) 2367 while (CONSP (XCDR (link)))
2368 abort (); 2368 link = XCDR (link);
2369 *tailp = Fcons (c, Qnil); 2369 if (!NILP (XCDR (link)))
2370 abort ();
2371 }
2372 if (!CONSP (link))
2373 kb->kbd_queue = Fcons (c, Qnil);
2374 else
2375 XSETCDR (link, Fcons (c, Qnil));
2370 kb->kbd_queue_has_data = 1; 2376 kb->kbd_queue_has_data = 1;
2371 current_kboard = kb; 2377 current_kboard = kb;
2372 /* This is going to exit from read_char 2378 /* This is going to exit from read_char
@@ -2581,12 +2587,18 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2581#ifdef MULTI_KBOARD 2587#ifdef MULTI_KBOARD
2582 if (! NILP (c) && (kb != current_kboard)) 2588 if (! NILP (c) && (kb != current_kboard))
2583 { 2589 {
2584 Lisp_Object *tailp = &kb->kbd_queue; 2590 Lisp_Object link = kb->kbd_queue;
2585 while (CONSP (*tailp)) 2591 if (CONSP (link))
2586 tailp = &XCDR (*tailp); 2592 {
2587 if (!NILP (*tailp)) 2593 while (CONSP (XCDR (link)))
2588 abort (); 2594 link = XCDR (link);
2589 *tailp = Fcons (c, Qnil); 2595 if (!NILP (XCDR (link)))
2596 abort ();
2597 }
2598 if (!CONSP (link))
2599 kb->kbd_queue = Fcons (c, Qnil);
2600 else
2601 XSETCDR (link, Fcons (c, Qnil));
2590 kb->kbd_queue_has_data = 1; 2602 kb->kbd_queue_has_data = 1;
2591 c = Qnil; 2603 c = Qnil;
2592 if (single_kboard) 2604 if (single_kboard)
@@ -2702,7 +2714,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2702 if (EQ (posn, Qmenu_bar) || EQ (posn, Qtool_bar)) 2714 if (EQ (posn, Qmenu_bar) || EQ (posn, Qtool_bar))
2703 { 2715 {
2704 /* Change menu-bar to (menu-bar) as the event "position". */ 2716 /* Change menu-bar to (menu-bar) as the event "position". */
2705 POSN_BUFFER_POSN (EVENT_START (c)) = Fcons (posn, Qnil); 2717 POSN_BUFFER_SET_POSN (EVENT_START (c), Fcons (posn, Qnil));
2706 2718
2707 also_record = c; 2719 also_record = c;
2708 Vunread_command_events = Fcons (c, Vunread_command_events); 2720 Vunread_command_events = Fcons (c, Vunread_command_events);
@@ -6854,19 +6866,19 @@ parse_menu_item (item, notreal, inmenubar)
6854 { 6866 {
6855 /* We have to create a cachelist. */ 6867 /* We have to create a cachelist. */
6856 CHECK_IMPURE (start); 6868 CHECK_IMPURE (start);
6857 XCDR (start) = Fcons (Fcons (Qnil, Qnil), XCDR (start)); 6869 XSETCDR (start, Fcons (Fcons (Qnil, Qnil), XCDR (start)));
6858 cachelist = XCAR (XCDR (start)); 6870 cachelist = XCAR (XCDR (start));
6859 newcache = 1; 6871 newcache = 1;
6860 tem = AREF (item_properties, ITEM_PROPERTY_KEYEQ); 6872 tem = AREF (item_properties, ITEM_PROPERTY_KEYEQ);
6861 if (!NILP (keyhint)) 6873 if (!NILP (keyhint))
6862 { 6874 {
6863 XCAR (cachelist) = XCAR (keyhint); 6875 XSETCAR (cachelist, XCAR (keyhint));
6864 newcache = 0; 6876 newcache = 0;
6865 } 6877 }
6866 else if (STRINGP (tem)) 6878 else if (STRINGP (tem))
6867 { 6879 {
6868 XCDR (cachelist) = Fsubstitute_command_keys (tem); 6880 XSETCDR (cachelist, Fsubstitute_command_keys (tem));
6869 XCAR (cachelist) = Qt; 6881 XSETCAR (cachelist, Qt);
6870 } 6882 }
6871 } 6883 }
6872 6884
@@ -6924,10 +6936,10 @@ parse_menu_item (item, notreal, inmenubar)
6924 && ! NILP (Fget (def, Qmenu_alias))) 6936 && ! NILP (Fget (def, Qmenu_alias)))
6925 def = XSYMBOL (def)->function; 6937 def = XSYMBOL (def)->function;
6926 tem = Fwhere_is_internal (def, Qnil, Qt, Qnil); 6938 tem = Fwhere_is_internal (def, Qnil, Qt, Qnil);
6927 XCAR (cachelist) = tem; 6939 XSETCAR (cachelist, tem);
6928 if (NILP (tem)) 6940 if (NILP (tem))
6929 { 6941 {
6930 XCDR (cachelist) = Qnil; 6942 XSETCDR (cachelist, Qnil);
6931 chkcache = 0; 6943 chkcache = 0;
6932 } 6944 }
6933 } 6945 }
@@ -6948,7 +6960,7 @@ parse_menu_item (item, notreal, inmenubar)
6948 if (STRINGP (XCDR (prefix))) 6960 if (STRINGP (XCDR (prefix)))
6949 tem = concat2 (tem, XCDR (prefix)); 6961 tem = concat2 (tem, XCDR (prefix));
6950 } 6962 }
6951 XCDR (cachelist) = tem; 6963 XSETCDR (cachelist, tem);
6952 } 6964 }
6953 } 6965 }
6954 6966
@@ -6956,7 +6968,7 @@ parse_menu_item (item, notreal, inmenubar)
6956 if (newcache && !NILP (tem)) 6968 if (newcache && !NILP (tem))
6957 { 6969 {
6958 tem = concat3 (build_string (" ("), tem, build_string (")")); 6970 tem = concat3 (build_string (" ("), tem, build_string (")"));
6959 XCDR (cachelist) = tem; 6971 XSETCDR (cachelist, tem);
6960 } 6972 }
6961 6973
6962 /* If we only want to precompute equivalent key bindings, stop here. */ 6974 /* If we only want to precompute equivalent key bindings, stop here. */
@@ -7474,7 +7486,7 @@ read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu)
7474 record_menu_key (XCAR (tem)); 7486 record_menu_key (XCAR (tem));
7475 if (SYMBOLP (XCAR (tem)) 7487 if (SYMBOLP (XCAR (tem))
7476 || INTEGERP (XCAR (tem))) 7488 || INTEGERP (XCAR (tem)))
7477 XCAR (tem) = Fcons (XCAR (tem), Qdisabled); 7489 XSETCAR (tem, Fcons (XCAR (tem), Qdisabled));
7478 } 7490 }
7479 7491
7480 /* If we got more than one event, put all but the first 7492 /* If we got more than one event, put all but the first
@@ -8466,8 +8478,8 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8466 8478
8467 /* Zap the position in key, so we know that we've 8479 /* Zap the position in key, so we know that we've
8468 expanded it, and don't try to do so again. */ 8480 expanded it, and don't try to do so again. */
8469 POSN_BUFFER_POSN (EVENT_START (key)) 8481 POSN_BUFFER_SET_POSN (EVENT_START (key),
8470 = Fcons (posn, Qnil); 8482 Fcons (posn, Qnil));
8471 8483
8472 mock_input = t + 2; 8484 mock_input = t + 2;
8473 goto replay_sequence; 8485 goto replay_sequence;
@@ -9203,7 +9215,7 @@ a special event, so ignore the prefix argument and don't clear it.")
9203 { 9215 {
9204 tem = Fnthcdr (Vhistory_length, Vcommand_history); 9216 tem = Fnthcdr (Vhistory_length, Vcommand_history);
9205 if (CONSP (tem)) 9217 if (CONSP (tem))
9206 XCDR (tem) = Qnil; 9218 XSETCDR (tem, Qnil);
9207 } 9219 }
9208 } 9220 }
9209 9221