aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2012-08-17 16:38:43 -0700
committerPaul Eggert2012-08-17 16:38:43 -0700
commit15dbb4d6ba5dea7d3e0f45ab3fd038c2b305a145 (patch)
tree2b8f35fcfd05d43551b873d4390264768f099dfb /src
parentf00af5b1c24515f20f96cfd8d59983ab62fb3f25 (diff)
downloademacs-15dbb4d6ba5dea7d3e0f45ab3fd038c2b305a145.tar.gz
emacs-15dbb4d6ba5dea7d3e0f45ab3fd038c2b305a145.zip
* keyboard.h (KSET): Remove.
Replace all uses with calls to new setter functions. Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. (KEYBOARD_INLINE): New macro. (kset_default_minibuffer_frame, kset_defining_kbd_macro) (kset_input_decode_map, kset_last_command, kset_last_kbd_macro) (kset_prefix_arg, kset_system_key_alist, kset_window_system): New setter functions. * keyboard.c (KEYBOARD_INLINE): Define to EXTERN_INLINE, so that the corresponding functions are compiled into code. (kset_echo_string, kset_kbd_queue) (kset_keyboard_translate_table, kset_last_prefix_arg) (kset_last_repeatable_command, kset_local_function_key_map) (kset_overriding_terminal_local_map, kset_real_last_command) (kset_system_key_syms): New setter functions. Fixes: debbugs:12215
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog17
-rw-r--r--src/callint.c4
-rw-r--r--src/frame.c10
-rw-r--r--src/keyboard.c177
-rw-r--r--src/keyboard.h49
-rw-r--r--src/macros.c15
-rw-r--r--src/msdos.c6
-rw-r--r--src/nsfns.m2
-rw-r--r--src/nsterm.m2
-rw-r--r--src/term.c4
-rw-r--r--src/w32fns.c2
-rw-r--r--src/w32term.c2
-rw-r--r--src/xfns.c2
-rw-r--r--src/xterm.c11
14 files changed, 212 insertions, 91 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6cb475ef3d7..403f76243a0 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,22 @@
12012-08-17 Paul Eggert <eggert@cs.ucla.edu> 12012-08-17 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * keyboard.h (KSET): Remove (Bug#12215).
4 Replace all uses with calls to new setter functions.
5 Use INLINE_HEADER_BEGIN, INLINE_HEADER_END.
6 (KEYBOARD_INLINE): New macro.
7 (kset_default_minibuffer_frame, kset_defining_kbd_macro)
8 (kset_input_decode_map, kset_last_command, kset_last_kbd_macro)
9 (kset_prefix_arg, kset_system_key_alist, kset_window_system):
10 New setter functions.
11 * keyboard.c (KEYBOARD_INLINE):
12 Define to EXTERN_INLINE, so that the corresponding functions
13 are compiled into code.
14 (kset_echo_string, kset_kbd_queue)
15 (kset_keyboard_translate_table, kset_last_prefix_arg)
16 (kset_last_repeatable_command, kset_local_function_key_map)
17 (kset_overriding_terminal_local_map, kset_real_last_command)
18 (kset_system_key_syms): New setter functions.
19
3 * frame.h (FSET): Remove (Bug#12215). 20 * frame.h (FSET): Remove (Bug#12215).
4 Replace all uses with calls to new setter functions. 21 Replace all uses with calls to new setter functions.
5 Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. 22 Use INLINE_HEADER_BEGIN, INLINE_HEADER_END.
diff --git a/src/callint.c b/src/callint.c
index e0133864674..36a59e812f2 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -372,7 +372,7 @@ invoke it. If KEYS is omitted or nil, the return value of
372 Vthis_command = save_this_command; 372 Vthis_command = save_this_command;
373 Vthis_original_command = save_this_original_command; 373 Vthis_original_command = save_this_original_command;
374 Vreal_this_command = save_real_this_command; 374 Vreal_this_command = save_real_this_command;
375 KSET (current_kboard, Vlast_command, save_last_command); 375 kset_last_command (current_kboard, save_last_command);
376 376
377 temporarily_switch_to_single_kboard (NULL); 377 temporarily_switch_to_single_kboard (NULL);
378 return unbind_to (speccount, apply1 (function, specs)); 378 return unbind_to (speccount, apply1 (function, specs));
@@ -843,7 +843,7 @@ invoke it. If KEYS is omitted or nil, the return value of
843 Vthis_command = save_this_command; 843 Vthis_command = save_this_command;
844 Vthis_original_command = save_this_original_command; 844 Vthis_original_command = save_this_original_command;
845 Vreal_this_command = save_real_this_command; 845 Vreal_this_command = save_real_this_command;
846 KSET (current_kboard, Vlast_command, save_last_command); 846 kset_last_command (current_kboard, save_last_command);
847 847
848 { 848 {
849 Lisp_Object val; 849 Lisp_Object val;
diff --git a/src/frame.c b/src/frame.c
index 0871100da2b..77326df156e 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -409,8 +409,8 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis
409 XSETFRAME (frame_dummy, f); 409 XSETFRAME (frame_dummy, f);
410 GCPRO1 (frame_dummy); 410 GCPRO1 (frame_dummy);
411 /* If there's no minibuffer frame to use, create one. */ 411 /* If there's no minibuffer frame to use, create one. */
412 KSET (kb, Vdefault_minibuffer_frame, 412 kset_default_minibuffer_frame
413 call1 (intern ("make-initial-minibuffer-frame"), display)); 413 (kb, call1 (intern ("make-initial-minibuffer-frame"), display));
414 UNGCPRO; 414 UNGCPRO;
415 } 415 }
416 416
@@ -864,7 +864,7 @@ to that frame. */)
864 (Lisp_Object event) 864 (Lisp_Object event)
865{ 865{
866 /* Preserve prefix arg that the command loop just cleared. */ 866 /* Preserve prefix arg that the command loop just cleared. */
867 KSET (current_kboard, Vprefix_arg, Vcurrent_prefix_arg); 867 kset_prefix_arg (current_kboard, Vcurrent_prefix_arg);
868 Frun_hooks (1, &Qmouse_leave_buffer_hook); 868 Frun_hooks (1, &Qmouse_leave_buffer_hook);
869 return do_switch_frame (event, 0, 0, Qnil); 869 return do_switch_frame (event, 0, 0, Qnil);
870} 870}
@@ -1458,11 +1458,11 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1458 if (NILP (frame_with_minibuf)) 1458 if (NILP (frame_with_minibuf))
1459 abort (); 1459 abort ();
1460 1460
1461 KSET (kb, Vdefault_minibuffer_frame, frame_with_minibuf); 1461 kset_default_minibuffer_frame (kb, frame_with_minibuf);
1462 } 1462 }
1463 else 1463 else
1464 /* No frames left on this kboard--say no minibuffer either. */ 1464 /* No frames left on this kboard--say no minibuffer either. */
1465 KSET (kb, Vdefault_minibuffer_frame, Qnil); 1465 kset_default_minibuffer_frame (kb, Qnil);
1466 } 1466 }
1467 1467
1468 /* Cause frame titles to update--necessary if we now have just one frame. */ 1468 /* Cause frame titles to update--necessary if we now have just one frame. */
diff --git a/src/keyboard.c b/src/keyboard.c
index b26a2c88e5d..868d0c8d2c1 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -18,6 +18,9 @@ You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include <config.h> 20#include <config.h>
21
22#define KEYBOARD_INLINE EXTERN_INLINE
23
21#include <signal.h> 24#include <signal.h>
22#include <stdio.h> 25#include <stdio.h>
23#include <setjmp.h> 26#include <setjmp.h>
@@ -469,6 +472,53 @@ static void handle_user_signal (int);
469static char *find_user_signal_name (int); 472static char *find_user_signal_name (int);
470static int store_user_signal_events (void); 473static int store_user_signal_events (void);
471 474
475/* These setters are used only in this file, so they can be private. */
476static inline void
477kset_echo_string (struct kboard *kb, Lisp_Object val)
478{
479 kb->INTERNAL_FIELD (echo_string) = val;
480}
481static inline void
482kset_kbd_queue (struct kboard *kb, Lisp_Object val)
483{
484 kb->INTERNAL_FIELD (kbd_queue) = val;
485}
486static inline void
487kset_keyboard_translate_table (struct kboard *kb, Lisp_Object val)
488{
489 kb->INTERNAL_FIELD (Vkeyboard_translate_table) = val;
490}
491static inline void
492kset_last_prefix_arg (struct kboard *kb, Lisp_Object val)
493{
494 kb->INTERNAL_FIELD (Vlast_prefix_arg) = val;
495}
496static inline void
497kset_last_repeatable_command (struct kboard *kb, Lisp_Object val)
498{
499 kb->INTERNAL_FIELD (Vlast_repeatable_command) = val;
500}
501static inline void
502kset_local_function_key_map (struct kboard *kb, Lisp_Object val)
503{
504 kb->INTERNAL_FIELD (Vlocal_function_key_map) = val;
505}
506static inline void
507kset_overriding_terminal_local_map (struct kboard *kb, Lisp_Object val)
508{
509 kb->INTERNAL_FIELD (Voverriding_terminal_local_map) = val;
510}
511static inline void
512kset_real_last_command (struct kboard *kb, Lisp_Object val)
513{
514 kb->INTERNAL_FIELD (Vreal_last_command) = val;
515}
516static inline void
517kset_system_key_syms (struct kboard *kb, Lisp_Object val)
518{
519 kb->INTERNAL_FIELD (system_key_syms) = val;
520}
521
472 522
473/* Add C to the echo string, if echoing is going on. 523/* Add C to the echo string, if echoing is going on.
474 C can be a character, which is printed prettily ("M-C-x" and all that 524 C can be a character, which is printed prettily ("M-C-x" and all that
@@ -551,8 +601,9 @@ echo_char (Lisp_Object c)
551 else if (STRINGP (echo_string)) 601 else if (STRINGP (echo_string))
552 echo_string = concat2 (echo_string, build_string (" ")); 602 echo_string = concat2 (echo_string, build_string (" "));
553 603
554 KSET (current_kboard, echo_string, 604 kset_echo_string
555 concat2 (echo_string, make_string (buffer, ptr - buffer))); 605 (current_kboard,
606 concat2 (echo_string, make_string (buffer, ptr - buffer)));
556 607
557 echo_now (); 608 echo_now ();
558 } 609 }
@@ -597,8 +648,9 @@ echo_dash (void)
597 648
598 /* Put a dash at the end of the buffer temporarily, 649 /* Put a dash at the end of the buffer temporarily,
599 but make it go away when the next character is added. */ 650 but make it go away when the next character is added. */
600 KSET (current_kboard, echo_string, 651 kset_echo_string
601 concat2 (KVAR (current_kboard, echo_string), build_string ("-"))); 652 (current_kboard,
653 concat2 (KVAR (current_kboard, echo_string), build_string ("-")));
602 echo_now (); 654 echo_now ();
603} 655}
604 656
@@ -660,7 +712,7 @@ cancel_echoing (void)
660{ 712{
661 current_kboard->immediate_echo = 0; 713 current_kboard->immediate_echo = 0;
662 current_kboard->echo_after_prompt = -1; 714 current_kboard->echo_after_prompt = -1;
663 KSET (current_kboard, echo_string, Qnil); 715 kset_echo_string (current_kboard, Qnil);
664 ok_to_echo_at_next_pause = NULL; 716 ok_to_echo_at_next_pause = NULL;
665 echo_kboard = NULL; 717 echo_kboard = NULL;
666 echo_message_buffer = Qnil; 718 echo_message_buffer = Qnil;
@@ -684,9 +736,9 @@ static void
684echo_truncate (ptrdiff_t nchars) 736echo_truncate (ptrdiff_t nchars)
685{ 737{
686 if (STRINGP (KVAR (current_kboard, echo_string))) 738 if (STRINGP (KVAR (current_kboard, echo_string)))
687 KSET (current_kboard, echo_string, 739 kset_echo_string (current_kboard,
688 Fsubstring (KVAR (current_kboard, echo_string), 740 Fsubstring (KVAR (current_kboard, echo_string),
689 make_number (0), make_number (nchars))); 741 make_number (0), make_number (nchars)));
690 truncate_echo_area (nchars); 742 truncate_echo_area (nchars);
691} 743}
692 744
@@ -1016,8 +1068,8 @@ cmd_error (Lisp_Object data)
1016 Vstandard_input = Qt; 1068 Vstandard_input = Qt;
1017 Vexecuting_kbd_macro = Qnil; 1069 Vexecuting_kbd_macro = Qnil;
1018 executing_kbd_macro = Qnil; 1070 executing_kbd_macro = Qnil;
1019 KSET (current_kboard, Vprefix_arg, Qnil); 1071 kset_prefix_arg (current_kboard, Qnil);
1020 KSET (current_kboard, Vlast_prefix_arg, Qnil); 1072 kset_last_prefix_arg (current_kboard, Qnil);
1021 cancel_echoing (); 1073 cancel_echoing ();
1022 1074
1023 /* Avoid unquittable loop if data contains a circular list. */ 1075 /* Avoid unquittable loop if data contains a circular list. */
@@ -1338,8 +1390,8 @@ command_loop_1 (void)
1338#endif 1390#endif
1339 int already_adjusted = 0; 1391 int already_adjusted = 0;
1340 1392
1341 KSET (current_kboard, Vprefix_arg, Qnil); 1393 kset_prefix_arg (current_kboard, Qnil);
1342 KSET (current_kboard, Vlast_prefix_arg, Qnil); 1394 kset_last_prefix_arg (current_kboard, Qnil);
1343 Vdeactivate_mark = Qnil; 1395 Vdeactivate_mark = Qnil;
1344 waiting_for_input = 0; 1396 waiting_for_input = 0;
1345 cancel_echoing (); 1397 cancel_echoing ();
@@ -1371,10 +1423,10 @@ command_loop_1 (void)
1371 } 1423 }
1372 1424
1373 /* Do this after running Vpost_command_hook, for consistency. */ 1425 /* Do this after running Vpost_command_hook, for consistency. */
1374 KSET (current_kboard, Vlast_command, Vthis_command); 1426 kset_last_command (current_kboard, Vthis_command);
1375 KSET (current_kboard, Vreal_last_command, Vreal_this_command); 1427 kset_real_last_command (current_kboard, Vreal_this_command);
1376 if (!CONSP (last_command_event)) 1428 if (!CONSP (last_command_event))
1377 KSET (current_kboard, Vlast_repeatable_command, Vreal_this_command); 1429 kset_last_repeatable_command (current_kboard, Vreal_this_command);
1378 1430
1379 while (1) 1431 while (1)
1380 { 1432 {
@@ -1546,7 +1598,7 @@ command_loop_1 (void)
1546 keys = Fkey_description (keys, Qnil); 1598 keys = Fkey_description (keys, Qnil);
1547 bitch_at_user (); 1599 bitch_at_user ();
1548 message_with_string ("%s is undefined", keys, 0); 1600 message_with_string ("%s is undefined", keys, 0);
1549 KSET (current_kboard, defining_kbd_macro, Qnil); 1601 kset_defining_kbd_macro (current_kboard, Qnil);
1550 update_mode_lines = 1; 1602 update_mode_lines = 1;
1551 /* If this is a down-mouse event, don't reset prefix-arg; 1603 /* If this is a down-mouse event, don't reset prefix-arg;
1552 pass it to the command run by the up event. */ 1604 pass it to the command run by the up event. */
@@ -1556,10 +1608,10 @@ command_loop_1 (void)
1556 = parse_modifiers (EVENT_HEAD (last_command_event)); 1608 = parse_modifiers (EVENT_HEAD (last_command_event));
1557 int modifiers = XINT (XCAR (XCDR (breakdown))); 1609 int modifiers = XINT (XCAR (XCDR (breakdown)));
1558 if (!(modifiers & down_modifier)) 1610 if (!(modifiers & down_modifier))
1559 KSET (current_kboard, Vprefix_arg, Qnil); 1611 kset_prefix_arg (current_kboard, Qnil);
1560 } 1612 }
1561 else 1613 else
1562 KSET (current_kboard, Vprefix_arg, Qnil); 1614 kset_prefix_arg (current_kboard, Qnil);
1563 } 1615 }
1564 else 1616 else
1565 { 1617 {
@@ -1596,7 +1648,7 @@ command_loop_1 (void)
1596 unbind_to (scount, Qnil); 1648 unbind_to (scount, Qnil);
1597#endif 1649#endif
1598 } 1650 }
1599 KSET (current_kboard, Vlast_prefix_arg, Vcurrent_prefix_arg); 1651 kset_last_prefix_arg (current_kboard, Vcurrent_prefix_arg);
1600 1652
1601 safe_run_hooks (Qpost_command_hook); 1653 safe_run_hooks (Qpost_command_hook);
1602 1654
@@ -1627,10 +1679,10 @@ command_loop_1 (void)
1627 if (NILP (KVAR (current_kboard, Vprefix_arg)) 1679 if (NILP (KVAR (current_kboard, Vprefix_arg))
1628 || CONSP (last_command_event)) 1680 || CONSP (last_command_event))
1629 { 1681 {
1630 KSET (current_kboard, Vlast_command, Vthis_command); 1682 kset_last_command (current_kboard, Vthis_command);
1631 KSET (current_kboard, Vreal_last_command, Vreal_this_command); 1683 kset_real_last_command (current_kboard, Vreal_this_command);
1632 if (!CONSP (last_command_event)) 1684 if (!CONSP (last_command_event))
1633 KSET (current_kboard, Vlast_repeatable_command, Vreal_this_command); 1685 kset_last_repeatable_command (current_kboard, Vreal_this_command);
1634 cancel_echoing (); 1686 cancel_echoing ();
1635 this_command_key_count = 0; 1687 this_command_key_count = 0;
1636 this_command_key_count_reset = 0; 1688 this_command_key_count_reset = 0;
@@ -2573,7 +2625,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2573 abort (); 2625 abort ();
2574 } 2626 }
2575 if (!CONSP (last)) 2627 if (!CONSP (last))
2576 KSET (kb, kbd_queue, Fcons (c, Qnil)); 2628 kset_kbd_queue (kb, Fcons (c, Qnil));
2577 else 2629 else
2578 XSETCDR (last, Fcons (c, Qnil)); 2630 XSETCDR (last, Fcons (c, Qnil));
2579 kb->kbd_queue_has_data = 1; 2631 kb->kbd_queue_has_data = 1;
@@ -2745,8 +2797,8 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2745 if (!CONSP (KVAR (current_kboard, kbd_queue))) 2797 if (!CONSP (KVAR (current_kboard, kbd_queue)))
2746 abort (); 2798 abort ();
2747 c = XCAR (KVAR (current_kboard, kbd_queue)); 2799 c = XCAR (KVAR (current_kboard, kbd_queue));
2748 KSET (current_kboard, kbd_queue, 2800 kset_kbd_queue (current_kboard,
2749 XCDR (KVAR (current_kboard, kbd_queue))); 2801 XCDR (KVAR (current_kboard, kbd_queue)));
2750 if (NILP (KVAR (current_kboard, kbd_queue))) 2802 if (NILP (KVAR (current_kboard, kbd_queue)))
2751 current_kboard->kbd_queue_has_data = 0; 2803 current_kboard->kbd_queue_has_data = 0;
2752 input_pending = readable_events (0); 2804 input_pending = readable_events (0);
@@ -2813,7 +2865,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2813 abort (); 2865 abort ();
2814 } 2866 }
2815 if (!CONSP (last)) 2867 if (!CONSP (last))
2816 KSET (kb, kbd_queue, Fcons (c, Qnil)); 2868 kset_kbd_queue (kb, Fcons (c, Qnil));
2817 else 2869 else
2818 XSETCDR (last, Fcons (c, Qnil)); 2870 XSETCDR (last, Fcons (c, Qnil));
2819 kb->kbd_queue_has_data = 1; 2871 kb->kbd_queue_has_data = 1;
@@ -3071,7 +3123,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
3071 3123
3072 cancel_echoing (); 3124 cancel_echoing ();
3073 ok_to_echo_at_next_pause = saved_ok_to_echo; 3125 ok_to_echo_at_next_pause = saved_ok_to_echo;
3074 KSET (current_kboard, echo_string, saved_echo_string); 3126 kset_echo_string (current_kboard, saved_echo_string);
3075 current_kboard->echo_after_prompt = saved_echo_after_prompt; 3127 current_kboard->echo_after_prompt = saved_echo_after_prompt;
3076 if (saved_immediate_echo) 3128 if (saved_immediate_echo)
3077 echo_now (); 3129 echo_now ();
@@ -3542,9 +3594,9 @@ kbd_buffer_store_event_hold (register struct input_event *event,
3542 3594
3543 if (single_kboard && kb != current_kboard) 3595 if (single_kboard && kb != current_kboard)
3544 { 3596 {
3545 KSET (kb, kbd_queue, 3597 kset_kbd_queue
3546 Fcons (make_lispy_switch_frame (event->frame_or_window), 3598 (kb, Fcons (make_lispy_switch_frame (event->frame_or_window),
3547 Fcons (make_number (c), Qnil))); 3599 Fcons (make_number (c), Qnil)));
3548 kb->kbd_queue_has_data = 1; 3600 kb->kbd_queue_has_data = 1;
3549 for (sp = kbd_fetch_ptr; sp != kbd_store_ptr; sp++) 3601 for (sp = kbd_fetch_ptr; sp != kbd_store_ptr; sp++)
3550 { 3602 {
@@ -5416,7 +5468,7 @@ make_lispy_event (struct input_event *event)
5416 /* We need to use an alist rather than a vector as the cache 5468 /* We need to use an alist rather than a vector as the cache
5417 since we can't make a vector long enough. */ 5469 since we can't make a vector long enough. */
5418 if (NILP (KVAR (current_kboard, system_key_syms))) 5470 if (NILP (KVAR (current_kboard, system_key_syms)))
5419 KSET (current_kboard, system_key_syms, Fcons (Qnil, Qnil)); 5471 kset_system_key_syms (current_kboard, Fcons (Qnil, Qnil));
5420 return modify_event_symbol (event->code, 5472 return modify_event_symbol (event->code,
5421 event->modifiers, 5473 event->modifiers,
5422 Qfunction_key, 5474 Qfunction_key,
@@ -8739,11 +8791,11 @@ read_char_minibuf_menu_prompt (int commandflag,
8739 is not used on replay. 8791 is not used on replay.
8740 */ 8792 */
8741 orig_defn_macro = KVAR (current_kboard, defining_kbd_macro); 8793 orig_defn_macro = KVAR (current_kboard, defining_kbd_macro);
8742 KSET (current_kboard, defining_kbd_macro, Qnil); 8794 kset_defining_kbd_macro (current_kboard, Qnil);
8743 do 8795 do
8744 obj = read_char (commandflag, 0, 0, Qt, 0, NULL); 8796 obj = read_char (commandflag, 0, 0, Qt, 0, NULL);
8745 while (BUFFERP (obj)); 8797 while (BUFFERP (obj));
8746 KSET (current_kboard, defining_kbd_macro, orig_defn_macro); 8798 kset_defining_kbd_macro (current_kboard, orig_defn_macro);
8747 8799
8748 if (!INTEGERP (obj)) 8800 if (!INTEGERP (obj))
8749 return obj; 8801 return obj;
@@ -9099,7 +9151,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9099 /* Install the string STR as the beginning of the string of 9151 /* Install the string STR as the beginning of the string of
9100 echoing, so that it serves as a prompt for the next 9152 echoing, so that it serves as a prompt for the next
9101 character. */ 9153 character. */
9102 KSET (current_kboard, echo_string, prompt); 9154 kset_echo_string (current_kboard, prompt);
9103 current_kboard->echo_after_prompt = SCHARS (prompt); 9155 current_kboard->echo_after_prompt = SCHARS (prompt);
9104 echo_now (); 9156 echo_now ();
9105 } 9157 }
@@ -9345,15 +9397,17 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9345 9397
9346 if (!NILP (delayed_switch_frame)) 9398 if (!NILP (delayed_switch_frame))
9347 { 9399 {
9348 KSET (interrupted_kboard, kbd_queue, 9400 kset_kbd_queue
9349 Fcons (delayed_switch_frame, 9401 (interrupted_kboard,
9350 KVAR (interrupted_kboard, kbd_queue))); 9402 Fcons (delayed_switch_frame,
9403 KVAR (interrupted_kboard, kbd_queue)));
9351 delayed_switch_frame = Qnil; 9404 delayed_switch_frame = Qnil;
9352 } 9405 }
9353 9406
9354 while (t > 0) 9407 while (t > 0)
9355 KSET (interrupted_kboard, kbd_queue, 9408 kset_kbd_queue
9356 Fcons (keybuf[--t], KVAR (interrupted_kboard, kbd_queue))); 9409 (interrupted_kboard,
9410 Fcons (keybuf[--t], KVAR (interrupted_kboard, kbd_queue)));
9357 9411
9358 /* If the side queue is non-empty, ensure it begins with a 9412 /* If the side queue is non-empty, ensure it begins with a
9359 switch-frame, so we'll replay it in the right context. */ 9413 switch-frame, so we'll replay it in the right context. */
@@ -9365,9 +9419,10 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9365 { 9419 {
9366 Lisp_Object frame; 9420 Lisp_Object frame;
9367 XSETFRAME (frame, interrupted_frame); 9421 XSETFRAME (frame, interrupted_frame);
9368 KSET (interrupted_kboard, kbd_queue, 9422 kset_kbd_queue
9369 Fcons (make_lispy_switch_frame (frame), 9423 (interrupted_kboard,
9370 KVAR (interrupted_kboard, kbd_queue))); 9424 Fcons (make_lispy_switch_frame (frame),
9425 KVAR (interrupted_kboard, kbd_queue)));
9371 } 9426 }
9372 mock_input = 0; 9427 mock_input = 0;
9373 orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); 9428 orig_local_map = get_local_map (PT, current_buffer, Qlocal_map);
@@ -10261,7 +10316,7 @@ a special event, so ignore the prefix argument and don't clear it. */)
10261 { 10316 {
10262 prefixarg = KVAR (current_kboard, Vprefix_arg); 10317 prefixarg = KVAR (current_kboard, Vprefix_arg);
10263 Vcurrent_prefix_arg = prefixarg; 10318 Vcurrent_prefix_arg = prefixarg;
10264 KSET (current_kboard, Vprefix_arg, Qnil); 10319 kset_prefix_arg (current_kboard, Qnil);
10265 } 10320 }
10266 else 10321 else
10267 prefixarg = Qnil; 10322 prefixarg = Qnil;
@@ -11256,30 +11311,30 @@ The `posn-' functions access elements of such lists. */)
11256void 11311void
11257init_kboard (KBOARD *kb) 11312init_kboard (KBOARD *kb)
11258{ 11313{
11259 KSET (kb, Voverriding_terminal_local_map, Qnil); 11314 kset_overriding_terminal_local_map (kb, Qnil);
11260 KSET (kb, Vlast_command, Qnil); 11315 kset_last_command (kb, Qnil);
11261 KSET (kb, Vreal_last_command, Qnil); 11316 kset_real_last_command (kb, Qnil);
11262 KSET (kb, Vkeyboard_translate_table, Qnil); 11317 kset_keyboard_translate_table (kb, Qnil);
11263 KSET (kb, Vlast_repeatable_command, Qnil); 11318 kset_last_repeatable_command (kb, Qnil);
11264 KSET (kb, Vprefix_arg, Qnil); 11319 kset_prefix_arg (kb, Qnil);
11265 KSET (kb, Vlast_prefix_arg, Qnil); 11320 kset_last_prefix_arg (kb, Qnil);
11266 KSET (kb, kbd_queue, Qnil); 11321 kset_kbd_queue (kb, Qnil);
11267 kb->kbd_queue_has_data = 0; 11322 kb->kbd_queue_has_data = 0;
11268 kb->immediate_echo = 0; 11323 kb->immediate_echo = 0;
11269 KSET (kb, echo_string, Qnil); 11324 kset_echo_string (kb, Qnil);
11270 kb->echo_after_prompt = -1; 11325 kb->echo_after_prompt = -1;
11271 kb->kbd_macro_buffer = 0; 11326 kb->kbd_macro_buffer = 0;
11272 kb->kbd_macro_bufsize = 0; 11327 kb->kbd_macro_bufsize = 0;
11273 KSET (kb, defining_kbd_macro, Qnil); 11328 kset_defining_kbd_macro (kb, Qnil);
11274 KSET (kb, Vlast_kbd_macro, Qnil); 11329 kset_last_kbd_macro (kb, Qnil);
11275 kb->reference_count = 0; 11330 kb->reference_count = 0;
11276 KSET (kb, Vsystem_key_alist, Qnil); 11331 kset_system_key_alist (kb, Qnil);
11277 KSET (kb, system_key_syms, Qnil); 11332 kset_system_key_syms (kb, Qnil);
11278 KSET (kb, Vwindow_system, Qt); /* Unset. */ 11333 kset_window_system (kb, Qt); /* Unset. */
11279 KSET (kb, Vinput_decode_map, Fmake_sparse_keymap (Qnil)); 11334 kset_input_decode_map (kb, Fmake_sparse_keymap (Qnil));
11280 KSET (kb, Vlocal_function_key_map, Fmake_sparse_keymap (Qnil)); 11335 kset_local_function_key_map (kb, Fmake_sparse_keymap (Qnil));
11281 Fset_keymap_parent (KVAR (kb, Vlocal_function_key_map), Vfunction_key_map); 11336 Fset_keymap_parent (KVAR (kb, Vlocal_function_key_map), Vfunction_key_map);
11282 KSET (kb, Vdefault_minibuffer_frame, Qnil); 11337 kset_default_minibuffer_frame (kb, Qnil);
11283} 11338}
11284 11339
11285/* 11340/*
@@ -11355,7 +11410,7 @@ init_keyboard (void)
11355 init_kboard (current_kboard); 11410 init_kboard (current_kboard);
11356 /* A value of nil for Vwindow_system normally means a tty, but we also use 11411 /* A value of nil for Vwindow_system normally means a tty, but we also use
11357 it for the initial terminal since there is no window system there. */ 11412 it for the initial terminal since there is no window system there. */
11358 KSET (current_kboard, Vwindow_system, Qnil); 11413 kset_window_system (current_kboard, Qnil);
11359 11414
11360 if (!noninteractive) 11415 if (!noninteractive)
11361 { 11416 {
diff --git a/src/keyboard.h b/src/keyboard.h
index f83643d6f6e..91484b3649b 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -19,10 +19,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19#include "systime.h" /* for EMACS_TIME, Time */ 19#include "systime.h" /* for EMACS_TIME, Time */
20#include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */ 20#include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */
21 21
22INLINE_HEADER_BEGIN
23#ifndef KEYBOARD_INLINE
24# define KEYBOARD_INLINE INLINE
25#endif
26
22/* Most code should use this macro to access Lisp fields in struct kboard. */ 27/* Most code should use this macro to access Lisp fields in struct kboard. */
23 28
24#define KVAR(kboard, field) ((kboard)->INTERNAL_FIELD (field)) 29#define KVAR(kboard, field) ((kboard)->INTERNAL_FIELD (field))
25#define KSET(kboard, field, value) ((kboard)->INTERNAL_FIELD (field) = (value))
26 30
27/* Each KBOARD represents one logical input stream from which Emacs 31/* Each KBOARD represents one logical input stream from which Emacs
28 gets input. If we are using ordinary terminals, it has one KBOARD 32 gets input. If we are using ordinary terminals, it has one KBOARD
@@ -173,6 +177,47 @@ struct kboard
173 char echo_after_prompt; 177 char echo_after_prompt;
174 }; 178 };
175 179
180KEYBOARD_INLINE void
181kset_default_minibuffer_frame (struct kboard *kb, Lisp_Object val)
182{
183 kb->INTERNAL_FIELD (Vdefault_minibuffer_frame) = val;
184}
185KEYBOARD_INLINE void
186kset_defining_kbd_macro (struct kboard *kb, Lisp_Object val)
187{
188 kb->INTERNAL_FIELD (defining_kbd_macro) = val;
189}
190KEYBOARD_INLINE void
191kset_input_decode_map (struct kboard *kb, Lisp_Object val)
192{
193 kb->INTERNAL_FIELD (Vinput_decode_map) = val;
194}
195KEYBOARD_INLINE void
196kset_last_command (struct kboard *kb, Lisp_Object val)
197{
198 kb->INTERNAL_FIELD (Vlast_command) = val;
199}
200KEYBOARD_INLINE void
201kset_last_kbd_macro (struct kboard *kb, Lisp_Object val)
202{
203 kb->INTERNAL_FIELD (Vlast_kbd_macro) = val;
204}
205KEYBOARD_INLINE void
206kset_prefix_arg (struct kboard *kb, Lisp_Object val)
207{
208 kb->INTERNAL_FIELD (Vprefix_arg) = val;
209}
210KEYBOARD_INLINE void
211kset_system_key_alist (struct kboard *kb, Lisp_Object val)
212{
213 kb->INTERNAL_FIELD (Vsystem_key_alist) = val;
214}
215KEYBOARD_INLINE void
216kset_window_system (struct kboard *kb, Lisp_Object val)
217{
218 kb->INTERNAL_FIELD (Vwindow_system) = val;
219}
220
176/* Temporarily used before a frame has been opened. */ 221/* Temporarily used before a frame has been opened. */
177extern KBOARD *initial_kboard; 222extern KBOARD *initial_kboard;
178 223
@@ -510,3 +555,5 @@ extern void mark_kboards (void);
510#ifdef WINDOWSNT 555#ifdef WINDOWSNT
511extern const char *const lispy_function_keys[]; 556extern const char *const lispy_function_keys[];
512#endif 557#endif
558
559INLINE_HEADER_END
diff --git a/src/macros.c b/src/macros.c
index d74d12e6158..e81068181b9 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -127,7 +127,7 @@ macro before appending to it. */)
127 127
128 message ("Appending to kbd macro..."); 128 message ("Appending to kbd macro...");
129 } 129 }
130 KSET (current_kboard, defining_kbd_macro, Qt); 130 kset_defining_kbd_macro (current_kboard, Qt);
131 131
132 return Qnil; 132 return Qnil;
133} 133}
@@ -137,12 +137,13 @@ macro before appending to it. */)
137void 137void
138end_kbd_macro (void) 138end_kbd_macro (void)
139{ 139{
140 KSET (current_kboard, defining_kbd_macro, Qnil); 140 kset_defining_kbd_macro (current_kboard, Qnil);
141 update_mode_lines++; 141 update_mode_lines++;
142 KSET (current_kboard, Vlast_kbd_macro, 142 kset_last_kbd_macro
143 make_event_array ((current_kboard->kbd_macro_end 143 (current_kboard,
144 - current_kboard->kbd_macro_buffer), 144 make_event_array ((current_kboard->kbd_macro_end
145 current_kboard->kbd_macro_buffer)); 145 - current_kboard->kbd_macro_buffer),
146 current_kboard->kbd_macro_buffer));
146} 147}
147 148
148DEFUN ("end-kbd-macro", Fend_kbd_macro, Send_kbd_macro, 0, 2, "p", 149DEFUN ("end-kbd-macro", Fend_kbd_macro, Send_kbd_macro, 0, 2, "p",
@@ -330,7 +331,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
330 executing_kbd_macro = final; 331 executing_kbd_macro = final;
331 executing_kbd_macro_index = 0; 332 executing_kbd_macro_index = 0;
332 333
333 KSET (current_kboard, Vprefix_arg, Qnil); 334 kset_prefix_arg (current_kboard, Qnil);
334 335
335 if (!NILP (loopfunc)) 336 if (!NILP (loopfunc))
336 { 337 {
diff --git a/src/msdos.c b/src/msdos.c
index bcb7fbe75e0..30435820d9e 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -520,8 +520,8 @@ dos_set_window_size (int *rows, int *cols)
520 520
521 /* If the user specified a special video mode for these dimensions, 521 /* If the user specified a special video mode for these dimensions,
522 use that mode. */ 522 use that mode. */
523 video_mode 523 video_mode
524 = Fsymbol_value (Fintern_soft (make_formatted_string 524 = Fsymbol_value (Fintern_soft (make_formatted_string
525 (video_name, "screen-dimensions-%dx%d", 525 (video_name, "screen-dimensions-%dx%d",
526 *rows, *cols), Qnil)); 526 *rows, *cols), Qnil));
527 527
@@ -1801,7 +1801,7 @@ internal_terminal_init (void)
1801 } 1801 }
1802 1802
1803 tty = FRAME_TTY (sf); 1803 tty = FRAME_TTY (sf);
1804 KSET (current_kboard, Vwindow_system, Qpc); 1804 kset_window_system (current_kboard, Qpc);
1805 sf->output_method = output_msdos_raw; 1805 sf->output_method = output_msdos_raw;
1806 if (init_needed) 1806 if (init_needed)
1807 { 1807 {
diff --git a/src/nsfns.m b/src/nsfns.m
index abfcb71cbfc..e8b5d22077a 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1391,7 +1391,7 @@ This function is an internal primitive--use `make-frame' instead. */)
1391 if (FRAME_HAS_MINIBUF_P (f) 1391 if (FRAME_HAS_MINIBUF_P (f)
1392 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) 1392 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
1393 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) 1393 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
1394 KSET (kb, Vdefault_minibuffer_frame, frame); 1394 kset_default_minibuffer_frame (kb, frame);
1395 1395
1396 /* All remaining specified parameters, which have not been "used" 1396 /* All remaining specified parameters, which have not been "used"
1397 by x_get_arg and friends, now go in the misc. alist of the frame. */ 1397 by x_get_arg and friends, now go in the misc. alist of the frame. */
diff --git a/src/nsterm.m b/src/nsterm.m
index 137ad299ddd..75877b1ee91 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4093,7 +4093,7 @@ ns_term_init (Lisp_Object display_name)
4093 4093
4094 terminal->kboard = xmalloc (sizeof *terminal->kboard); 4094 terminal->kboard = xmalloc (sizeof *terminal->kboard);
4095 init_kboard (terminal->kboard); 4095 init_kboard (terminal->kboard);
4096 KSET (terminal->kboard, Vwindow_system, Qns); 4096 kset_window_system (terminal->kboard, Qns);
4097 terminal->kboard->next_kboard = all_kboards; 4097 terminal->kboard->next_kboard = all_kboards;
4098 all_kboards = terminal->kboard; 4098 all_kboards = terminal->kboard;
4099 /* Don't let the initial kboard remain current longer than necessary. 4099 /* Don't let the initial kboard remain current longer than necessary.
diff --git a/src/term.c b/src/term.c
index c5cec3062e3..23e074287c1 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1332,7 +1332,7 @@ term_get_fkeys_1 (void)
1332 1332
1333 /* This can happen if CANNOT_DUMP or with strange options. */ 1333 /* This can happen if CANNOT_DUMP or with strange options. */
1334 if (!KEYMAPP (KVAR (kboard, Vinput_decode_map))) 1334 if (!KEYMAPP (KVAR (kboard, Vinput_decode_map)))
1335 KSET (kboard, Vinput_decode_map, Fmake_sparse_keymap (Qnil)); 1335 kset_input_decode_map (kboard, Fmake_sparse_keymap (Qnil));
1336 1336
1337 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) 1337 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
1338 { 1338 {
@@ -3280,7 +3280,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3280 3280
3281 terminal->kboard = xmalloc (sizeof *terminal->kboard); 3281 terminal->kboard = xmalloc (sizeof *terminal->kboard);
3282 init_kboard (terminal->kboard); 3282 init_kboard (terminal->kboard);
3283 KSET (terminal->kboard, Vwindow_system, Qnil); 3283 kset_window_system (terminal->kboard, Qnil);
3284 terminal->kboard->next_kboard = all_kboards; 3284 terminal->kboard->next_kboard = all_kboards;
3285 all_kboards = terminal->kboard; 3285 all_kboards = terminal->kboard;
3286 terminal->kboard->reference_count++; 3286 terminal->kboard->reference_count++;
diff --git a/src/w32fns.c b/src/w32fns.c
index 3f84823c366..3b35147d3ca 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -4381,7 +4381,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4381 if (FRAME_HAS_MINIBUF_P (f) 4381 if (FRAME_HAS_MINIBUF_P (f)
4382 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) 4382 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
4383 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) 4383 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
4384 KSET (kb, Vdefault_minibuffer_frame, frame); 4384 kset_default_minibuffer_frame (kb, frame);
4385 4385
4386 /* All remaining specified parameters, which have not been "used" 4386 /* All remaining specified parameters, which have not been "used"
4387 by x_get_arg and friends, now go in the misc. alist of the frame. */ 4387 by x_get_arg and friends, now go in the misc. alist of the frame. */
diff --git a/src/w32term.c b/src/w32term.c
index a74dfbc3bd2..9b7dc896aaf 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -6232,7 +6232,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo)
6232 terminal like X does. */ 6232 terminal like X does. */
6233 terminal->kboard = xmalloc (sizeof (KBOARD)); 6233 terminal->kboard = xmalloc (sizeof (KBOARD));
6234 init_kboard (terminal->kboard); 6234 init_kboard (terminal->kboard);
6235 KSET (terminal->kboard, Vwindow_system, intern ("w32")); 6235 kset_window_system (terminal->kboard, intern ("w32"));
6236 terminal->kboard->next_kboard = all_kboards; 6236 terminal->kboard->next_kboard = all_kboards;
6237 all_kboards = terminal->kboard; 6237 all_kboards = terminal->kboard;
6238 /* Don't let the initial kboard remain current longer than necessary. 6238 /* Don't let the initial kboard remain current longer than necessary.
diff --git a/src/xfns.c b/src/xfns.c
index 7960a42709b..f4c7f4714a4 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3455,7 +3455,7 @@ This function is an internal primitive--use `make-frame' instead. */)
3455 if (FRAME_HAS_MINIBUF_P (f) 3455 if (FRAME_HAS_MINIBUF_P (f)
3456 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) 3456 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
3457 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) 3457 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
3458 KSET (kb, Vdefault_minibuffer_frame, frame); 3458 kset_default_minibuffer_frame (kb, frame);
3459 3459
3460 /* All remaining specified parameters, which have not been "used" 3460 /* All remaining specified parameters, which have not been "used"
3461 by x_get_arg and friends, now go in the misc. alist of the frame. */ 3461 by x_get_arg and friends, now go in the misc. alist of the frame. */
diff --git a/src/xterm.c b/src/xterm.c
index 715e3664ec2..6a195543ed7 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -7834,7 +7834,7 @@ x_connection_closed (Display *dpy, const char *error_message)
7834 { 7834 {
7835 /* Set this to t so that delete_frame won't get confused 7835 /* Set this to t so that delete_frame won't get confused
7836 trying to find a replacement. */ 7836 trying to find a replacement. */
7837 KSET (FRAME_KBOARD (XFRAME (frame)), Vdefault_minibuffer_frame, Qt); 7837 kset_default_minibuffer_frame (FRAME_KBOARD (XFRAME (frame)), Qt);
7838 delete_frame (frame, Qnoelisp); 7838 delete_frame (frame, Qnoelisp);
7839 } 7839 }
7840 7840
@@ -10114,7 +10114,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10114 { 10114 {
10115 terminal->kboard = xmalloc (sizeof *terminal->kboard); 10115 terminal->kboard = xmalloc (sizeof *terminal->kboard);
10116 init_kboard (terminal->kboard); 10116 init_kboard (terminal->kboard);
10117 KSET (terminal->kboard, Vwindow_system, Qx); 10117 kset_window_system (terminal->kboard, Qx);
10118 10118
10119 /* Add the keyboard to the list before running Lisp code (via 10119 /* Add the keyboard to the list before running Lisp code (via
10120 Qvendor_specific_keysyms below), since these are not traced 10120 Qvendor_specific_keysyms below), since these are not traced
@@ -10136,9 +10136,10 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10136 /* Temporarily hide the partially initialized terminal. */ 10136 /* Temporarily hide the partially initialized terminal. */
10137 terminal_list = terminal->next_terminal; 10137 terminal_list = terminal->next_terminal;
10138 UNBLOCK_INPUT; 10138 UNBLOCK_INPUT;
10139 KSET (terminal->kboard, Vsystem_key_alist, 10139 kset_system_key_alist
10140 call1 (Qvendor_specific_keysyms, 10140 (terminal->kboard,
10141 vendor ? build_string (vendor) : empty_unibyte_string)); 10141 call1 (Qvendor_specific_keysyms,
10142 vendor ? build_string (vendor) : empty_unibyte_string));
10142 BLOCK_INPUT; 10143 BLOCK_INPUT;
10143 terminal->next_terminal = terminal_list; 10144 terminal->next_terminal = terminal_list;
10144 terminal_list = terminal; 10145 terminal_list = terminal;