From: Tom Tromey Date: Wed, 16 Feb 2011 16:35:16 +0000 (-0700) Subject: Hide implementation of `struct kboard' X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~860 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1344aad491d0951920efef6cae1c6934f92cd59b;p=emacs.git Hide implementation of `struct kboard' * callint.c (Fcall_interactively): Update. * doc.c (Fsubstitute_command_keys): Update. * cmds.c (Fself_insert_command): Update. * keymap.c (Fcurrent_active_maps, Fkey_binding) (Fdescribe_buffer_bindings): Update. * macros.c (Fstart_kbd_macro, end_kbd_macro, Fend_kbd_macro) (store_kbd_macro_char, Fcall_last_kbd_macro, Fexecute_kbd_macro): Update. * keyboard.c (echo_char, echo_dash, echo_now, cancel_echoing) (echo_length, echo_truncate, cmd_error, command_loop_1) (read_char, kbd_buffer_store_event_hold, make_lispy_event) (menu_bar_items, tool_bar_items, read_char_minibuf_menu_prompt) (read_key_sequence, Fcommand_execute, Fexecute_extended_command) (Fdiscard_input, init_kboard, init_keyboard, mark_kboards): Update. * xfns.c (Fx_create_frame): Update. * xterm.c (x_connection_closed, x_term_init): Update. * term.c (term_get_fkeys_1, CONDITIONAL_REASSIGN, init_tty): Update. * window.c (window_scroll_pixel_based, window_scroll_line_based): Update. * frame.c (make_frame_without_minibuffer, Fhandle_switch_frame) (delete_frame): Update. * lisp.h (DEFVAR_KBOARD): Update for change to field names. * keyboard.h (struct kboard): Rename all Lisp_Object fields. (KBOARD_INTERNAL_FIELD, KVAR): New macros. --- diff --git a/src/ChangeLog b/src/ChangeLog index 1f4e23b7504..13b19453562 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,32 @@ +2011-02-16 Tom Tromey + + * callint.c (Fcall_interactively): Update. + * doc.c (Fsubstitute_command_keys): Update. + * cmds.c (Fself_insert_command): Update. + * keymap.c (Fcurrent_active_maps, Fkey_binding) + (Fdescribe_buffer_bindings): Update. + * macros.c (Fstart_kbd_macro, end_kbd_macro, Fend_kbd_macro) + (store_kbd_macro_char, Fcall_last_kbd_macro, Fexecute_kbd_macro): + Update. + * keyboard.c (echo_char, echo_dash, echo_now, cancel_echoing) + (echo_length, echo_truncate, cmd_error, command_loop_1) + (read_char, kbd_buffer_store_event_hold, make_lispy_event) + (menu_bar_items, tool_bar_items, read_char_minibuf_menu_prompt) + (read_key_sequence, Fcommand_execute, Fexecute_extended_command) + (Fdiscard_input, init_kboard, init_keyboard, mark_kboards): + Update. + * xfns.c (Fx_create_frame): Update. + * xterm.c (x_connection_closed, x_term_init): Update. + * term.c (term_get_fkeys_1, CONDITIONAL_REASSIGN, init_tty): + Update. + * window.c (window_scroll_pixel_based, window_scroll_line_based): + Update. + * frame.c (make_frame_without_minibuffer, Fhandle_switch_frame) + (delete_frame): Update. + * lisp.h (DEFVAR_KBOARD): Update for change to field names. + * keyboard.h (struct kboard): Rename all Lisp_Object fields. + (KBOARD_INTERNAL_FIELD, KVAR): New macros. + 2011-02-16 Tom Tromey * lisp.h (DEFVAR_BUFFER_DEFAULTS): Use BVAR. diff --git a/src/callint.c b/src/callint.c index b998c70187d..21dd3cd4d9d 100644 --- a/src/callint.c +++ b/src/callint.c @@ -280,7 +280,7 @@ invoke it. If KEYS is omitted or nil, the return value of save_this_command = Vthis_command; save_this_original_command = Vthis_original_command; save_real_this_command = real_this_command; - save_last_command = current_kboard->Vlast_command; + save_last_command = KVAR (current_kboard, Vlast_command); if (NILP (keys)) keys = this_command_keys, key_count = this_command_key_count; @@ -363,7 +363,7 @@ invoke it. If KEYS is omitted or nil, the return value of Vthis_command = save_this_command; Vthis_original_command = save_this_original_command; real_this_command= save_real_this_command; - current_kboard->Vlast_command = save_last_command; + KVAR (current_kboard, Vlast_command) = save_last_command; temporarily_switch_to_single_kboard (NULL); return unbind_to (speccount, apply1 (function, specs)); @@ -832,7 +832,7 @@ invoke it. If KEYS is omitted or nil, the return value of Vthis_command = save_this_command; Vthis_original_command = save_this_original_command; real_this_command= save_real_this_command; - current_kboard->Vlast_command = save_last_command; + KVAR (current_kboard, Vlast_command) = save_last_command; { Lisp_Object val; diff --git a/src/cmds.c b/src/cmds.c index 253b8d6a5ec..336bf1154f9 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -277,7 +277,7 @@ After insertion, the value of `auto-fill-function' is called if the int remove_boundary = 1; CHECK_NATNUM (n); - if (!EQ (Vthis_command, current_kboard->Vlast_command)) + if (!EQ (Vthis_command, KVAR (current_kboard, Vlast_command))) nonundocount = 0; if (NILP (Vexecuting_kbd_macro) diff --git a/src/doc.c b/src/doc.c index 31f1e5a9175..e572d43dbf4 100644 --- a/src/doc.c +++ b/src/doc.c @@ -719,7 +719,7 @@ a new string, without any text properties, is returned. */) or a specified local map (which means search just that and the global map). If non-nil, it might come from Voverriding_local_map, or from a \\ construct in STRING itself.. */ - keymap = current_kboard->Voverriding_terminal_local_map; + keymap = KVAR (current_kboard, Voverriding_terminal_local_map); if (NILP (keymap)) keymap = Voverriding_local_map; diff --git a/src/frame.c b/src/frame.c index edbd45a2a34..56e0e7ec919 100644 --- a/src/frame.c +++ b/src/frame.c @@ -428,20 +428,20 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis if (NILP (mini_window)) { /* Use default-minibuffer-frame if possible. */ - if (!FRAMEP (kb->Vdefault_minibuffer_frame) - || ! FRAME_LIVE_P (XFRAME (kb->Vdefault_minibuffer_frame))) + if (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) + || ! FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))) { Lisp_Object frame_dummy; XSETFRAME (frame_dummy, f); GCPRO1 (frame_dummy); /* If there's no minibuffer frame to use, create one. */ - kb->Vdefault_minibuffer_frame = + KVAR (kb, Vdefault_minibuffer_frame) = call1 (intern ("make-initial-minibuffer-frame"), display); UNGCPRO; } - mini_window = XFRAME (kb->Vdefault_minibuffer_frame)->minibuffer_window; + mini_window = XFRAME (KVAR (kb, Vdefault_minibuffer_frame))->minibuffer_window; } f->minibuffer_window = mini_window; @@ -889,7 +889,7 @@ to that frame. */) (Lisp_Object event) { /* Preserve prefix arg that the command loop just cleared. */ - current_kboard->Vprefix_arg = Vcurrent_prefix_arg; + KVAR (current_kboard, Vprefix_arg) = Vcurrent_prefix_arg; call1 (Vrun_hooks, Qmouse_leave_buffer_hook); return do_switch_frame (event, 0, 0, Qnil); } @@ -1526,7 +1526,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* If we've deleted this keyboard's default_minibuffer_frame, try to find another one. Prefer minibuffer-only frames, but also notice frames with other windows. */ - if (kb != NULL && EQ (frame, kb->Vdefault_minibuffer_frame)) + if (kb != NULL && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame))) { Lisp_Object frames; @@ -1575,11 +1575,11 @@ delete_frame (Lisp_Object frame, Lisp_Object force) if (NILP (frame_with_minibuf)) abort (); - kb->Vdefault_minibuffer_frame = frame_with_minibuf; + KVAR (kb, Vdefault_minibuffer_frame) = frame_with_minibuf; } else /* No frames left on this kboard--say no minibuffer either. */ - kb->Vdefault_minibuffer_frame = Qnil; + KVAR (kb, Vdefault_minibuffer_frame) = Qnil; } /* Cause frame titles to update--necessary if we now have just one frame. */ diff --git a/src/keyboard.c b/src/keyboard.c index a1d851408e3..e9c6d508fa2 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -461,7 +461,7 @@ echo_char (Lisp_Object c) char *ptr = buffer; Lisp_Object echo_string; - echo_string = current_kboard->echo_string; + echo_string = KVAR (current_kboard, echo_string); /* If someone has passed us a composite event, use its head symbol. */ c = EVENT_HEAD (c); @@ -528,7 +528,7 @@ echo_char (Lisp_Object c) else if (STRINGP (echo_string)) echo_string = concat2 (echo_string, build_string (" ")); - current_kboard->echo_string + KVAR (current_kboard, echo_string) = concat2 (echo_string, make_string (buffer, ptr - buffer)); echo_now (); @@ -542,31 +542,31 @@ void echo_dash (void) { /* Do nothing if not echoing at all. */ - if (NILP (current_kboard->echo_string)) + if (NILP (KVAR (current_kboard, echo_string))) return; if (this_command_key_count == 0) return; if (!current_kboard->immediate_echo - && SCHARS (current_kboard->echo_string) == 0) + && SCHARS (KVAR (current_kboard, echo_string)) == 0) return; /* Do nothing if we just printed a prompt. */ if (current_kboard->echo_after_prompt - == SCHARS (current_kboard->echo_string)) + == SCHARS (KVAR (current_kboard, echo_string))) return; /* Do nothing if we have already put a dash at the end. */ - if (SCHARS (current_kboard->echo_string) > 1) + if (SCHARS (KVAR (current_kboard, echo_string)) > 1) { Lisp_Object last_char, prev_char, idx; - idx = make_number (SCHARS (current_kboard->echo_string) - 2); - prev_char = Faref (current_kboard->echo_string, idx); + idx = make_number (SCHARS (KVAR (current_kboard, echo_string)) - 2); + prev_char = Faref (KVAR (current_kboard, echo_string), idx); - idx = make_number (SCHARS (current_kboard->echo_string) - 1); - last_char = Faref (current_kboard->echo_string, idx); + idx = make_number (SCHARS (KVAR (current_kboard, echo_string)) - 1); + last_char = Faref (KVAR (current_kboard, echo_string), idx); if (XINT (last_char) == '-' && XINT (prev_char) != ' ') return; @@ -574,7 +574,7 @@ echo_dash (void) /* Put a dash at the end of the buffer temporarily, but make it go away when the next character is added. */ - current_kboard->echo_string = concat2 (current_kboard->echo_string, + KVAR (current_kboard, echo_string) = concat2 (KVAR (current_kboard, echo_string), build_string ("-")); echo_now (); } @@ -617,9 +617,9 @@ echo_now (void) } echoing = 1; - message3_nolog (current_kboard->echo_string, - SBYTES (current_kboard->echo_string), - STRING_MULTIBYTE (current_kboard->echo_string)); + message3_nolog (KVAR (current_kboard, echo_string), + SBYTES (KVAR (current_kboard, echo_string)), + STRING_MULTIBYTE (KVAR (current_kboard, echo_string))); echoing = 0; /* Record in what buffer we echoed, and from which kboard. */ @@ -637,7 +637,7 @@ cancel_echoing (void) { current_kboard->immediate_echo = 0; current_kboard->echo_after_prompt = -1; - current_kboard->echo_string = Qnil; + KVAR (current_kboard, echo_string) = Qnil; ok_to_echo_at_next_pause = NULL; echo_kboard = NULL; echo_message_buffer = Qnil; @@ -648,8 +648,8 @@ cancel_echoing (void) static int echo_length (void) { - return (STRINGP (current_kboard->echo_string) - ? SCHARS (current_kboard->echo_string) + return (STRINGP (KVAR (current_kboard, echo_string)) + ? SCHARS (KVAR (current_kboard, echo_string)) : 0); } @@ -660,9 +660,9 @@ echo_length (void) static void echo_truncate (EMACS_INT nchars) { - if (STRINGP (current_kboard->echo_string)) - current_kboard->echo_string - = Fsubstring (current_kboard->echo_string, + if (STRINGP (KVAR (current_kboard, echo_string))) + KVAR (current_kboard, echo_string) + = Fsubstring (KVAR (current_kboard, echo_string), make_number (0), make_number (nchars)); truncate_echo_area (nchars); } @@ -993,8 +993,8 @@ cmd_error (Lisp_Object data) Vstandard_input = Qt; Vexecuting_kbd_macro = Qnil; executing_kbd_macro = Qnil; - current_kboard->Vprefix_arg = Qnil; - current_kboard->Vlast_prefix_arg = Qnil; + KVAR (current_kboard, Vprefix_arg) = Qnil; + KVAR (current_kboard, Vlast_prefix_arg) = Qnil; cancel_echoing (); /* Avoid unquittable loop if data contains a circular list. */ @@ -1302,8 +1302,8 @@ command_loop_1 (void) #endif int already_adjusted = 0; - current_kboard->Vprefix_arg = Qnil; - current_kboard->Vlast_prefix_arg = Qnil; + KVAR (current_kboard, Vprefix_arg) = Qnil; + KVAR (current_kboard, Vlast_prefix_arg) = Qnil; Vdeactivate_mark = Qnil; waiting_for_input = 0; cancel_echoing (); @@ -1331,10 +1331,10 @@ command_loop_1 (void) } /* Do this after running Vpost_command_hook, for consistency. */ - current_kboard->Vlast_command = Vthis_command; - current_kboard->Vreal_last_command = real_this_command; + KVAR (current_kboard, Vlast_command) = Vthis_command; + KVAR (current_kboard, Vreal_last_command) = real_this_command; if (!CONSP (last_command_event)) - current_kboard->Vlast_repeatable_command = real_this_command; + KVAR (current_kboard, Vlast_repeatable_command) = real_this_command; while (1) { @@ -1504,9 +1504,9 @@ command_loop_1 (void) keys = Fkey_description (keys, Qnil); bitch_at_user (); message_with_string ("%s is undefined", keys, 0); - current_kboard->defining_kbd_macro = Qnil; + KVAR (current_kboard, defining_kbd_macro) = Qnil; update_mode_lines = 1; - current_kboard->Vprefix_arg = Qnil; + KVAR (current_kboard, Vprefix_arg) = Qnil; } else { @@ -1523,7 +1523,7 @@ command_loop_1 (void) } #endif - if (NILP (current_kboard->Vprefix_arg)) /* FIXME: Why? --Stef */ + if (NILP (KVAR (current_kboard, Vprefix_arg))) /* FIXME: Why? --Stef */ Fundo_boundary (); Fcommand_execute (Vthis_command, Qnil, Qnil, Qnil); @@ -1537,7 +1537,7 @@ command_loop_1 (void) unbind_to (scount, Qnil); #endif } - current_kboard->Vlast_prefix_arg = Vcurrent_prefix_arg; + KVAR (current_kboard, Vlast_prefix_arg) = Vcurrent_prefix_arg; /* Note that the value cell will never directly contain nil if the symbol is a local variable. */ @@ -1565,12 +1565,12 @@ command_loop_1 (void) If the command didn't actually create a prefix arg, but is merely a frame event that is transparent to prefix args, then the above doesn't apply. */ - if (NILP (current_kboard->Vprefix_arg) || CONSP (last_command_event)) + if (NILP (KVAR (current_kboard, Vprefix_arg)) || CONSP (last_command_event)) { - current_kboard->Vlast_command = Vthis_command; - current_kboard->Vreal_last_command = real_this_command; + KVAR (current_kboard, Vlast_command) = Vthis_command; + KVAR (current_kboard, Vreal_last_command) = real_this_command; if (!CONSP (last_command_event)) - current_kboard->Vlast_repeatable_command = real_this_command; + KVAR (current_kboard, Vlast_repeatable_command) = real_this_command; cancel_echoing (); this_command_key_count = 0; this_command_key_count_reset = 0; @@ -1649,8 +1649,8 @@ command_loop_1 (void) /* Install chars successfully executed in kbd macro. */ - if (!NILP (current_kboard->defining_kbd_macro) - && NILP (current_kboard->Vprefix_arg)) + if (!NILP (KVAR (current_kboard, defining_kbd_macro)) + && NILP (KVAR (current_kboard, Vprefix_arg))) finalize_kbd_macro_chars (); #if 0 /* This shouldn't be necessary anymore. --lorentey */ if (!was_locked) @@ -2461,7 +2461,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event KBOARD *kb = FRAME_KBOARD (XFRAME (selected_frame)); if (kb != current_kboard) { - Lisp_Object link = kb->kbd_queue; + Lisp_Object link = KVAR (kb, kbd_queue); /* We shouldn't get here if we were in single-kboard mode! */ if (single_kboard) abort (); @@ -2473,7 +2473,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event abort (); } if (!CONSP (link)) - kb->kbd_queue = Fcons (c, Qnil); + KVAR (kb, kbd_queue) = Fcons (c, Qnil); else XSETCDR (link, Fcons (c, Qnil)); kb->kbd_queue_has_data = 1; @@ -2645,12 +2645,12 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event { if (current_kboard->kbd_queue_has_data) { - if (!CONSP (current_kboard->kbd_queue)) + if (!CONSP (KVAR (current_kboard, kbd_queue))) abort (); - c = XCAR (current_kboard->kbd_queue); - current_kboard->kbd_queue - = XCDR (current_kboard->kbd_queue); - if (NILP (current_kboard->kbd_queue)) + c = XCAR (KVAR (current_kboard, kbd_queue)); + KVAR (current_kboard, kbd_queue) + = XCDR (KVAR (current_kboard, kbd_queue)); + if (NILP (KVAR (current_kboard, kbd_queue))) current_kboard->kbd_queue_has_data = 0; input_pending = readable_events (0); if (EVENT_HAS_PARAMETERS (c) @@ -2712,7 +2712,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event if (! NILP (c) && (kb != current_kboard)) { - Lisp_Object link = kb->kbd_queue; + Lisp_Object link = KVAR (kb, kbd_queue); if (CONSP (link)) { while (CONSP (XCDR (link))) @@ -2721,7 +2721,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event abort (); } if (!CONSP (link)) - kb->kbd_queue = Fcons (c, Qnil); + KVAR (kb, kbd_queue) = Fcons (c, Qnil); else XSETCDR (link, Fcons (c, Qnil)); kb->kbd_queue_has_data = 1; @@ -2829,15 +2829,15 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event if (XINT (c) == -1) goto exit; - if ((STRINGP (current_kboard->Vkeyboard_translate_table) - && SCHARS (current_kboard->Vkeyboard_translate_table) > (unsigned) XFASTINT (c)) - || (VECTORP (current_kboard->Vkeyboard_translate_table) - && XVECTOR (current_kboard->Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c)) - || (CHAR_TABLE_P (current_kboard->Vkeyboard_translate_table) + if ((STRINGP (KVAR (current_kboard, Vkeyboard_translate_table)) + && SCHARS (KVAR (current_kboard, Vkeyboard_translate_table)) > (unsigned) XFASTINT (c)) + || (VECTORP (KVAR (current_kboard, Vkeyboard_translate_table)) + && XVECTOR (KVAR (current_kboard, Vkeyboard_translate_table))->size > (unsigned) XFASTINT (c)) + || (CHAR_TABLE_P (KVAR (current_kboard, Vkeyboard_translate_table)) && CHARACTERP (c))) { Lisp_Object d; - d = Faref (current_kboard->Vkeyboard_translate_table, c); + d = Faref (KVAR (current_kboard, Vkeyboard_translate_table), c); /* nil in keyboard-translate-table means no translation. */ if (!NILP (d)) c = d; @@ -2918,7 +2918,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event /* Save the echo status. */ int saved_immediate_echo = current_kboard->immediate_echo; struct kboard *saved_ok_to_echo = ok_to_echo_at_next_pause; - Lisp_Object saved_echo_string = current_kboard->echo_string; + Lisp_Object saved_echo_string = KVAR (current_kboard, echo_string); int saved_echo_after_prompt = current_kboard->echo_after_prompt; #if 0 @@ -2973,7 +2973,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event cancel_echoing (); ok_to_echo_at_next_pause = saved_ok_to_echo; - current_kboard->echo_string = saved_echo_string; + KVAR (current_kboard, echo_string) = saved_echo_string; current_kboard->echo_after_prompt = saved_echo_after_prompt; if (saved_immediate_echo) echo_now (); @@ -3459,7 +3459,7 @@ kbd_buffer_store_event_hold (register struct input_event *event, if (single_kboard && kb != current_kboard) { - kb->kbd_queue + KVAR (kb, kbd_queue) = Fcons (make_lispy_switch_frame (event->frame_or_window), Fcons (make_number (c), Qnil)); kb->kbd_queue_has_data = 1; @@ -5322,13 +5322,13 @@ make_lispy_event (struct input_event *event) { /* We need to use an alist rather than a vector as the cache since we can't make a vector long enuf. */ - if (NILP (current_kboard->system_key_syms)) - current_kboard->system_key_syms = Fcons (Qnil, Qnil); + if (NILP (KVAR (current_kboard, system_key_syms))) + KVAR (current_kboard, system_key_syms) = Fcons (Qnil, Qnil); return modify_event_symbol (event->code, event->modifiers, Qfunction_key, - current_kboard->Vsystem_key_alist, - 0, ¤t_kboard->system_key_syms, + KVAR (current_kboard, Vsystem_key_alist), + 0, &KVAR (current_kboard, system_key_syms), (unsigned) -1); } @@ -7360,8 +7360,8 @@ menu_bar_items (Lisp_Object old) /* Yes, use them (if non-nil) as well as the global map. */ maps = (Lisp_Object *) alloca (3 * sizeof (maps[0])); nmaps = 0; - if (!NILP (current_kboard->Voverriding_terminal_local_map)) - maps[nmaps++] = current_kboard->Voverriding_terminal_local_map; + if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) + maps[nmaps++] = KVAR (current_kboard, Voverriding_terminal_local_map); if (!NILP (Voverriding_local_map)) maps[nmaps++] = Voverriding_local_map; } @@ -7897,8 +7897,8 @@ tool_bar_items (Lisp_Object reuse, int *nitems) /* Yes, use them (if non-nil) as well as the global map. */ maps = (Lisp_Object *) alloca (3 * sizeof (maps[0])); nmaps = 0; - if (!NILP (current_kboard->Voverriding_terminal_local_map)) - maps[nmaps++] = current_kboard->Voverriding_terminal_local_map; + if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) + maps[nmaps++] = KVAR (current_kboard, Voverriding_terminal_local_map); if (!NILP (Voverriding_local_map)) maps[nmaps++] = Voverriding_local_map; } @@ -8614,12 +8614,12 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps) is pressed. Help characters are not recorded because menu prompting is not used on replay. */ - orig_defn_macro = current_kboard->defining_kbd_macro; - current_kboard->defining_kbd_macro = Qnil; + orig_defn_macro = KVAR (current_kboard, defining_kbd_macro); + KVAR (current_kboard, defining_kbd_macro) = Qnil; do obj = read_char (commandflag, 0, 0, Qt, 0, NULL); while (BUFFERP (obj)); - current_kboard->defining_kbd_macro = orig_defn_macro; + KVAR (current_kboard, defining_kbd_macro) = orig_defn_macro; if (!INTEGERP (obj)) return obj; @@ -8632,7 +8632,7 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps) && (!INTEGERP (menu_prompt_more_char) || ! EQ (obj, make_number (Ctl (XINT (menu_prompt_more_char)))))) { - if (!NILP (current_kboard->defining_kbd_macro)) + if (!NILP (KVAR (current_kboard, defining_kbd_macro))) store_kbd_macro_char (obj); return obj; } @@ -8974,7 +8974,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, /* Install the string STR as the beginning of the string of echoing, so that it serves as a prompt for the next character. */ - current_kboard->echo_string = prompt; + KVAR (current_kboard, echo_string) = prompt; current_kboard->echo_after_prompt = SCHARS (prompt); echo_now (); } @@ -9012,8 +9012,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, happens if we switch keyboards between rescans. */ replay_entire_sequence: - indec.map = indec.parent = current_kboard->Vinput_decode_map; - fkey.map = fkey.parent = current_kboard->Vlocal_function_key_map; + indec.map = indec.parent = KVAR (current_kboard, Vinput_decode_map); + fkey.map = fkey.parent = KVAR (current_kboard, Vlocal_function_key_map); keytran.map = keytran.parent = Vkey_translation_map; indec.start = indec.end = 0; fkey.start = fkey.end = 0; @@ -9034,7 +9034,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, the initial keymaps from the current buffer. */ nmaps = 0; - if (!NILP (current_kboard->Voverriding_terminal_local_map)) + if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) { if (2 > nmaps_allocated) { @@ -9042,7 +9042,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, defs = (Lisp_Object *) alloca (2 * sizeof (defs[0])); nmaps_allocated = 2; } - submaps[nmaps++] = current_kboard->Voverriding_terminal_local_map; + submaps[nmaps++] = KVAR (current_kboard, Voverriding_terminal_local_map); } else if (!NILP (Voverriding_local_map)) { @@ -9218,29 +9218,29 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, if (!NILP (delayed_switch_frame)) { - interrupted_kboard->kbd_queue + KVAR (interrupted_kboard, kbd_queue) = Fcons (delayed_switch_frame, - interrupted_kboard->kbd_queue); + KVAR (interrupted_kboard, kbd_queue)); delayed_switch_frame = Qnil; } while (t > 0) - interrupted_kboard->kbd_queue - = Fcons (keybuf[--t], interrupted_kboard->kbd_queue); + KVAR (interrupted_kboard, kbd_queue) + = Fcons (keybuf[--t], KVAR (interrupted_kboard, kbd_queue)); /* If the side queue is non-empty, ensure it begins with a switch-frame, so we'll replay it in the right context. */ - if (CONSP (interrupted_kboard->kbd_queue) - && (key = XCAR (interrupted_kboard->kbd_queue), + if (CONSP (KVAR (interrupted_kboard, kbd_queue)) + && (key = XCAR (KVAR (interrupted_kboard, kbd_queue)), !(EVENT_HAS_PARAMETERS (key) && EQ (EVENT_HEAD_KIND (EVENT_HEAD (key)), Qswitch_frame)))) { Lisp_Object frame; XSETFRAME (frame, interrupted_frame); - interrupted_kboard->kbd_queue + KVAR (interrupted_kboard, kbd_queue) = Fcons (make_lispy_switch_frame (frame), - interrupted_kboard->kbd_queue); + KVAR (interrupted_kboard, kbd_queue)); } mock_input = 0; orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); @@ -10115,9 +10115,9 @@ a special event, so ignore the prefix argument and don't clear it. */) if (NILP (special)) { - prefixarg = current_kboard->Vprefix_arg; + prefixarg = KVAR (current_kboard, Vprefix_arg); Vcurrent_prefix_arg = prefixarg; - current_kboard->Vprefix_arg = Qnil; + KVAR (current_kboard, Vprefix_arg) = Qnil; } else prefixarg = Qnil; @@ -10251,7 +10251,7 @@ give to the command you invoke, if it asks for an argument. */) UNGCPRO; function = Fintern (function, Qnil); - current_kboard->Vprefix_arg = prefixarg; + KVAR (current_kboard, Vprefix_arg) = prefixarg; Vthis_command = function; real_this_command = function; @@ -10574,7 +10574,7 @@ DEFUN ("discard-input", Fdiscard_input, Sdiscard_input, 0, 0, 0, Also end any kbd macro being defined. */) (void) { - if (!NILP (current_kboard->defining_kbd_macro)) + if (!NILP (KVAR (current_kboard, defining_kbd_macro))) { /* Discard the last command from the macro. */ Fcancel_kbd_macro_events (); @@ -11224,30 +11224,30 @@ The `posn-' functions access elements of such lists. */) void init_kboard (KBOARD *kb) { - kb->Voverriding_terminal_local_map = Qnil; - kb->Vlast_command = Qnil; - kb->Vreal_last_command = Qnil; - kb->Vkeyboard_translate_table = Qnil; - kb->Vlast_repeatable_command = Qnil; - kb->Vprefix_arg = Qnil; - kb->Vlast_prefix_arg = Qnil; - kb->kbd_queue = Qnil; + KVAR (kb, Voverriding_terminal_local_map) = Qnil; + KVAR (kb, Vlast_command) = Qnil; + KVAR (kb, Vreal_last_command) = Qnil; + KVAR (kb, Vkeyboard_translate_table) = Qnil; + KVAR (kb, Vlast_repeatable_command) = Qnil; + KVAR (kb, Vprefix_arg) = Qnil; + KVAR (kb, Vlast_prefix_arg) = Qnil; + KVAR (kb, kbd_queue) = Qnil; kb->kbd_queue_has_data = 0; kb->immediate_echo = 0; - kb->echo_string = Qnil; + KVAR (kb, echo_string) = Qnil; kb->echo_after_prompt = -1; kb->kbd_macro_buffer = 0; kb->kbd_macro_bufsize = 0; - kb->defining_kbd_macro = Qnil; - kb->Vlast_kbd_macro = Qnil; + KVAR (kb, defining_kbd_macro) = Qnil; + KVAR (kb, Vlast_kbd_macro) = Qnil; kb->reference_count = 0; - kb->Vsystem_key_alist = Qnil; - kb->system_key_syms = Qnil; - kb->Vwindow_system = Qt; /* Unset. */ - kb->Vinput_decode_map = Fmake_sparse_keymap (Qnil); - kb->Vlocal_function_key_map = Fmake_sparse_keymap (Qnil); - Fset_keymap_parent (kb->Vlocal_function_key_map, Vfunction_key_map); - kb->Vdefault_minibuffer_frame = Qnil; + KVAR (kb, Vsystem_key_alist) = Qnil; + KVAR (kb, system_key_syms) = Qnil; + KVAR (kb, Vwindow_system) = Qt; /* Unset. */ + KVAR (kb, Vinput_decode_map) = Fmake_sparse_keymap (Qnil); + KVAR (kb, Vlocal_function_key_map) = Fmake_sparse_keymap (Qnil); + Fset_keymap_parent (KVAR (kb, Vlocal_function_key_map), Vfunction_key_map); + KVAR (kb, Vdefault_minibuffer_frame) = Qnil; } /* @@ -11323,7 +11323,7 @@ init_keyboard (void) init_kboard (current_kboard); /* A value of nil for Vwindow_system normally means a tty, but we also use it for the initial terminal since there is no window system there. */ - current_kboard->Vwindow_system = Qnil; + KVAR (current_kboard, Vwindow_system) = Qnil; if (!noninteractive) { @@ -12266,23 +12266,23 @@ mark_kboards (void) if (kb->kbd_macro_buffer) for (p = kb->kbd_macro_buffer; p < kb->kbd_macro_ptr; p++) mark_object (*p); - mark_object (kb->Voverriding_terminal_local_map); - mark_object (kb->Vlast_command); - mark_object (kb->Vreal_last_command); - mark_object (kb->Vkeyboard_translate_table); - mark_object (kb->Vlast_repeatable_command); - mark_object (kb->Vprefix_arg); - mark_object (kb->Vlast_prefix_arg); - mark_object (kb->kbd_queue); - mark_object (kb->defining_kbd_macro); - mark_object (kb->Vlast_kbd_macro); - mark_object (kb->Vsystem_key_alist); - mark_object (kb->system_key_syms); - mark_object (kb->Vwindow_system); - mark_object (kb->Vinput_decode_map); - mark_object (kb->Vlocal_function_key_map); - mark_object (kb->Vdefault_minibuffer_frame); - mark_object (kb->echo_string); + mark_object (KVAR (kb, Voverriding_terminal_local_map)); + mark_object (KVAR (kb, Vlast_command)); + mark_object (KVAR (kb, Vreal_last_command)); + mark_object (KVAR (kb, Vkeyboard_translate_table)); + mark_object (KVAR (kb, Vlast_repeatable_command)); + mark_object (KVAR (kb, Vprefix_arg)); + mark_object (KVAR (kb, Vlast_prefix_arg)); + mark_object (KVAR (kb, kbd_queue)); + mark_object (KVAR (kb, defining_kbd_macro)); + mark_object (KVAR (kb, Vlast_kbd_macro)); + mark_object (KVAR (kb, Vsystem_key_alist)); + mark_object (KVAR (kb, system_key_syms)); + mark_object (KVAR (kb, Vwindow_system)); + mark_object (KVAR (kb, Vinput_decode_map)); + mark_object (KVAR (kb, Vlocal_function_key_map)); + mark_object (KVAR (kb, Vdefault_minibuffer_frame)); + mark_object (KVAR (kb, echo_string)); } { struct input_event *event; diff --git a/src/keyboard.h b/src/keyboard.h index 7b3374ac3bd..10bf16d5c5c 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -19,6 +19,15 @@ along with GNU Emacs. If not, see . */ #include "systime.h" /* for EMACS_TIME */ #include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */ +/* Lisp fields in struct keyboard are hidden from most code and accessed + via the KVAR macro, below. Only select pieces of code, like the GC, + are allowed to use KBOARD_INTERNAL_FIELD. */ +#define KBOARD_INTERNAL_FIELD(field) field ## _ + +/* Most code should use this macro to access Lisp fields in struct + kboard. */ +#define KVAR(kboard, field) ((kboard)->KBOARD_INTERNAL_FIELD (field)) + /* Each KBOARD represents one logical input stream from which Emacs gets input. If we are using ordinary terminals, it has one KBOARD object for each terminal device. @@ -70,32 +79,32 @@ struct kboard can effectively wait for input in the any-kboard state, and hence avoid blocking out the other KBOARDs. See universal-argument in lisp/simple.el for an example. */ - Lisp_Object Voverriding_terminal_local_map; + Lisp_Object KBOARD_INTERNAL_FIELD (Voverriding_terminal_local_map); /* Last command executed by the editor command loop, not counting commands that set the prefix argument. */ - Lisp_Object Vlast_command; + Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_command); /* Normally same as last-command, but never modified by other commands. */ - Lisp_Object Vreal_last_command; + Lisp_Object KBOARD_INTERNAL_FIELD (Vreal_last_command); /* User-supplied table to translate input characters through. */ - Lisp_Object Vkeyboard_translate_table; + Lisp_Object KBOARD_INTERNAL_FIELD (Vkeyboard_translate_table); /* Last command that may be repeated by `repeat'. */ - Lisp_Object Vlast_repeatable_command; + Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_repeatable_command); /* The prefix argument for the next command, in raw form. */ - Lisp_Object Vprefix_arg; + Lisp_Object KBOARD_INTERNAL_FIELD (Vprefix_arg); /* Saved prefix argument for the last command, in raw form. */ - Lisp_Object Vlast_prefix_arg; + Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_prefix_arg); /* Unread events specific to this kboard. */ - Lisp_Object kbd_queue; + Lisp_Object KBOARD_INTERNAL_FIELD (kbd_queue); /* Non-nil while a kbd macro is being defined. */ - Lisp_Object defining_kbd_macro; + Lisp_Object KBOARD_INTERNAL_FIELD (defining_kbd_macro); /* The start of storage for the current keyboard macro. */ Lisp_Object *kbd_macro_buffer; @@ -117,28 +126,28 @@ struct kboard int kbd_macro_bufsize; /* Last anonymous kbd macro defined. */ - Lisp_Object Vlast_kbd_macro; + Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_kbd_macro); /* Alist of system-specific X windows key symbols. */ - Lisp_Object Vsystem_key_alist; + Lisp_Object KBOARD_INTERNAL_FIELD (Vsystem_key_alist); /* Cache for modify_event_symbol. */ - Lisp_Object system_key_syms; + Lisp_Object KBOARD_INTERNAL_FIELD (system_key_syms); /* The kind of display: x, w32, ... */ - Lisp_Object Vwindow_system; + Lisp_Object KBOARD_INTERNAL_FIELD (Vwindow_system); /* Keymap mapping keys to alternative preferred forms. See the DEFVAR for more documentation. */ - Lisp_Object Vlocal_function_key_map; + Lisp_Object KBOARD_INTERNAL_FIELD (Vlocal_function_key_map); /* Keymap mapping ASCII function key sequences onto their preferred forms. Initialized by the terminal-specific lisp files. See the DEFVAR for more documentation. */ - Lisp_Object Vinput_decode_map; + Lisp_Object KBOARD_INTERNAL_FIELD (Vinput_decode_map); /* Minibufferless frames on this display use this frame's minibuffer. */ - Lisp_Object Vdefault_minibuffer_frame; + Lisp_Object KBOARD_INTERNAL_FIELD (Vdefault_minibuffer_frame); /* Number of displays using this KBOARD. Normally 1, but can be larger when you have multiple screens on a single X display. */ @@ -146,7 +155,7 @@ struct kboard /* The text we're echoing in the modeline - partial key sequences, usually. This is nil when not echoing. */ - Lisp_Object echo_string; + Lisp_Object KBOARD_INTERNAL_FIELD (echo_string); /* This flag indicates that events were put into kbd_queue while Emacs was running for some other KBOARD. diff --git a/src/keymap.c b/src/keymap.c index d9de2bc804b..0e4715e4b8b 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1565,8 +1565,8 @@ like in the respective argument of `key-binding'. */) if (!NILP (olp)) { - if (!NILP (current_kboard->Voverriding_terminal_local_map)) - keymaps = Fcons (current_kboard->Voverriding_terminal_local_map, keymaps); + if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) + keymaps = Fcons (KVAR (current_kboard, Voverriding_terminal_local_map), keymaps); /* The doc said that overriding-terminal-local-map should override overriding-local-map. The code used them both, but it seems clearer to use just one. rms, jan 2005. */ @@ -1745,9 +1745,9 @@ specified buffer position instead of point are used. } } - if (! NILP (current_kboard->Voverriding_terminal_local_map)) + if (! NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) { - value = Flookup_key (current_kboard->Voverriding_terminal_local_map, + value = Flookup_key (KVAR (current_kboard, Voverriding_terminal_local_map), key, accept_default); if (! NILP (value) && !INTEGERP (value)) goto done; @@ -2941,11 +2941,11 @@ You type Translation\n\ outbuf = Fcurrent_buffer (); /* Report on alternates for keys. */ - if (STRINGP (current_kboard->Vkeyboard_translate_table) && !NILP (prefix)) + if (STRINGP (KVAR (current_kboard, Vkeyboard_translate_table)) && !NILP (prefix)) { int c; - const unsigned char *translate = SDATA (current_kboard->Vkeyboard_translate_table); - int translate_len = SCHARS (current_kboard->Vkeyboard_translate_table); + const unsigned char *translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table)); + int translate_len = SCHARS (KVAR (current_kboard, Vkeyboard_translate_table)); for (c = 0; c < translate_len; c++) if (translate[c] != c) @@ -2968,7 +2968,7 @@ You type Translation\n\ insert ("\n", 1); /* Insert calls signal_after_change which may GC. */ - translate = SDATA (current_kboard->Vkeyboard_translate_table); + translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table)); } insert ("\n", 1); @@ -2981,8 +2981,8 @@ You type Translation\n\ /* Print the (major mode) local map. */ start1 = Qnil; - if (!NILP (current_kboard->Voverriding_terminal_local_map)) - start1 = current_kboard->Voverriding_terminal_local_map; + if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) + start1 = KVAR (current_kboard, Voverriding_terminal_local_map); else if (!NILP (Voverriding_local_map)) start1 = Voverriding_local_map; @@ -3064,13 +3064,13 @@ You type Translation\n\ "\f\nGlobal Bindings", nomenu, 0, 1, 0); /* Print the function-key-map translations under this prefix. */ - if (!NILP (current_kboard->Vlocal_function_key_map)) - describe_map_tree (current_kboard->Vlocal_function_key_map, 0, Qnil, prefix, + if (!NILP (KVAR (current_kboard, Vlocal_function_key_map))) + describe_map_tree (KVAR (current_kboard, Vlocal_function_key_map), 0, Qnil, prefix, "\f\nFunction key map translations", nomenu, 1, 0, 0); /* Print the input-decode-map translations under this prefix. */ - if (!NILP (current_kboard->Vinput_decode_map)) - describe_map_tree (current_kboard->Vinput_decode_map, 0, Qnil, prefix, + if (!NILP (KVAR (current_kboard, Vinput_decode_map))) + describe_map_tree (KVAR (current_kboard, Vinput_decode_map), 0, Qnil, prefix, "\f\nInput decoding map translations", nomenu, 1, 0, 0); UNGCPRO; diff --git a/src/lisp.h b/src/lisp.h index b82f1b2f722..7cc2a8e7d45 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -1890,7 +1890,7 @@ extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int); static struct Lisp_Kboard_Objfwd ko_fwd; \ defvar_kboard (&ko_fwd, \ lname, \ - (int)((char *)(¤t_kboard->vname) \ + (int)((char *)(¤t_kboard->vname ## _) \ - (char *)current_kboard)); \ } while (0) diff --git a/src/macros.c b/src/macros.c index 34ac08c3284..d90b31b503f 100644 --- a/src/macros.c +++ b/src/macros.c @@ -56,7 +56,7 @@ If optional second arg, NO-EXEC, is non-nil, do not re-execute last macro before appending to it. */) (Lisp_Object append, Lisp_Object no_exec) { - if (!NILP (current_kboard->defining_kbd_macro)) + if (!NILP (KVAR (current_kboard, defining_kbd_macro))) error ("Already defining kbd macro"); if (!current_kboard->kbd_macro_buffer) @@ -85,9 +85,9 @@ macro before appending to it. */) int cvt; /* Check the type of last-kbd-macro in case Lisp code changed it. */ - CHECK_VECTOR_OR_STRING (current_kboard->Vlast_kbd_macro); + CHECK_VECTOR_OR_STRING (KVAR (current_kboard, Vlast_kbd_macro)); - len = XINT (Flength (current_kboard->Vlast_kbd_macro)); + len = XINT (Flength (KVAR (current_kboard, Vlast_kbd_macro))); /* Copy last-kbd-macro into the buffer, in case the Lisp code has put another macro there. */ @@ -100,11 +100,11 @@ macro before appending to it. */) } /* Must convert meta modifier when copying string to vector. */ - cvt = STRINGP (current_kboard->Vlast_kbd_macro); + cvt = STRINGP (KVAR (current_kboard, Vlast_kbd_macro)); for (i = 0; i < len; i++) { Lisp_Object c; - c = Faref (current_kboard->Vlast_kbd_macro, make_number (i)); + c = Faref (KVAR (current_kboard, Vlast_kbd_macro), make_number (i)); if (cvt && NATNUMP (c) && (XFASTINT (c) & 0x80)) XSETFASTINT (c, CHAR_META | (XFASTINT (c) & ~0x80)); current_kboard->kbd_macro_buffer[i] = c; @@ -116,12 +116,12 @@ macro before appending to it. */) /* Re-execute the macro we are appending to, for consistency of behavior. */ if (NILP (no_exec)) - Fexecute_kbd_macro (current_kboard->Vlast_kbd_macro, + Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), make_number (1), Qnil); message ("Appending to kbd macro..."); } - current_kboard->defining_kbd_macro = Qt; + KVAR (current_kboard, defining_kbd_macro) = Qt; return Qnil; } @@ -131,9 +131,9 @@ macro before appending to it. */) void end_kbd_macro (void) { - current_kboard->defining_kbd_macro = Qnil; + KVAR (current_kboard, defining_kbd_macro) = Qnil; update_mode_lines++; - current_kboard->Vlast_kbd_macro + KVAR (current_kboard, Vlast_kbd_macro) = make_event_array ((current_kboard->kbd_macro_end - current_kboard->kbd_macro_buffer), current_kboard->kbd_macro_buffer); @@ -154,7 +154,7 @@ In Lisp, optional second arg LOOPFUNC may be a function that is called prior to each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) (Lisp_Object repeat, Lisp_Object loopfunc) { - if (NILP (current_kboard->defining_kbd_macro)) + if (NILP (KVAR (current_kboard, defining_kbd_macro))) error ("Not defining kbd macro"); if (NILP (repeat)) @@ -162,19 +162,19 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) else CHECK_NUMBER (repeat); - if (!NILP (current_kboard->defining_kbd_macro)) + if (!NILP (KVAR (current_kboard, defining_kbd_macro))) { end_kbd_macro (); message ("Keyboard macro defined"); } if (XFASTINT (repeat) == 0) - Fexecute_kbd_macro (current_kboard->Vlast_kbd_macro, repeat, loopfunc); + Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), repeat, loopfunc); else { XSETINT (repeat, XINT (repeat)-1); if (XINT (repeat) > 0) - Fexecute_kbd_macro (current_kboard->Vlast_kbd_macro, repeat, loopfunc); + Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), repeat, loopfunc); } return Qnil; } @@ -186,7 +186,7 @@ store_kbd_macro_char (Lisp_Object c) { struct kboard *kb = current_kboard; - if (!NILP (kb->defining_kbd_macro)) + if (!NILP (KVAR (kb, defining_kbd_macro))) { if (kb->kbd_macro_ptr - kb->kbd_macro_buffer == kb->kbd_macro_bufsize) { @@ -248,21 +248,21 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) { /* Don't interfere with recognition of the previous command from before this macro started. */ - Vthis_command = current_kboard->Vlast_command; + Vthis_command = KVAR (current_kboard, Vlast_command); /* C-x z after the macro should repeat the macro. */ - real_this_command = current_kboard->Vlast_kbd_macro; + real_this_command = KVAR (current_kboard, Vlast_kbd_macro); - if (! NILP (current_kboard->defining_kbd_macro)) + if (! NILP (KVAR (current_kboard, defining_kbd_macro))) error ("Can't execute anonymous macro while defining one"); - else if (NILP (current_kboard->Vlast_kbd_macro)) + else if (NILP (KVAR (current_kboard, Vlast_kbd_macro))) error ("No kbd macro has been defined"); else - Fexecute_kbd_macro (current_kboard->Vlast_kbd_macro, prefix, loopfunc); + Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), prefix, loopfunc); /* command_loop_1 sets this to nil before it returns; get back the last command within the macro so that it can be last, again, after we return. */ - Vthis_command = current_kboard->Vlast_command; + Vthis_command = KVAR (current_kboard, Vlast_command); return Qnil; } @@ -322,7 +322,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) executing_kbd_macro = final; executing_kbd_macro_index = 0; - current_kboard->Vprefix_arg = Qnil; + KVAR (current_kboard, Vprefix_arg) = Qnil; if (!NILP (loopfunc)) { diff --git a/src/term.c b/src/term.c index 1aefe02421f..21ed163c934 100644 --- a/src/term.c +++ b/src/term.c @@ -1350,14 +1350,14 @@ term_get_fkeys_1 (void) KBOARD *kboard = term_get_fkeys_kboard; /* This can happen if CANNOT_DUMP or with strange options. */ - if (!KEYMAPP (kboard->Vinput_decode_map)) - kboard->Vinput_decode_map = Fmake_sparse_keymap (Qnil); + if (!KEYMAPP (KVAR (kboard, Vinput_decode_map))) + KVAR (kboard, Vinput_decode_map) = Fmake_sparse_keymap (Qnil); for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) { char *sequence = tgetstr (keys[i].cap, address); if (sequence) - Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), + Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence), Fmake_vector (make_number (1), intern (keys[i].name))); } @@ -1377,13 +1377,13 @@ term_get_fkeys_1 (void) if (k0) /* Define f0 first, so that f10 takes precedence in case the key sequences happens to be the same. */ - Fdefine_key (kboard->Vinput_decode_map, build_string (k0), + Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0), Fmake_vector (make_number (1), intern ("f0"))); - Fdefine_key (kboard->Vinput_decode_map, build_string (k_semi), + Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k_semi), Fmake_vector (make_number (1), intern ("f10"))); } else if (k0) - Fdefine_key (kboard->Vinput_decode_map, build_string (k0), + Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0), Fmake_vector (make_number (1), intern (k0_name))); } @@ -1406,7 +1406,7 @@ term_get_fkeys_1 (void) if (sequence) { sprintf (fkey, "f%d", i); - Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), + Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence), Fmake_vector (make_number (1), intern (fkey))); } @@ -1423,7 +1423,7 @@ term_get_fkeys_1 (void) { \ char *sequence = tgetstr (cap2, address); \ if (sequence) \ - Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), \ + Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence), \ Fmake_vector (make_number (1), \ intern (sym))); \ } @@ -3418,7 +3418,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); init_kboard (terminal->kboard); - terminal->kboard->Vwindow_system = Qnil; + KVAR (terminal->kboard, Vwindow_system) = Qnil; terminal->kboard->next_kboard = all_kboards; all_kboards = terminal->kboard; terminal->kboard->reference_count++; diff --git a/src/window.c b/src/window.c index 675a493e18e..7965269f0e7 100644 --- a/src/window.c +++ b/src/window.c @@ -4834,8 +4834,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) possibility of point becoming "stuck" on a tall line when scrolling by one line. */ if (window_scroll_pixel_based_preserve_y < 0 - || !SYMBOLP (current_kboard->Vlast_command) - || NILP (Fget (current_kboard->Vlast_command, Qscroll_command))) + || !SYMBOLP (KVAR (current_kboard, Vlast_command)) + || NILP (Fget (KVAR (current_kboard, Vlast_command), Qscroll_command))) { start_display (&it, w, start); move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); @@ -5091,8 +5091,8 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) if (!NILP (Vscroll_preserve_screen_position)) { if (window_scroll_preserve_vpos <= 0 - || !SYMBOLP (current_kboard->Vlast_command) - || NILP (Fget (current_kboard->Vlast_command, Qscroll_command))) + || !SYMBOLP (KVAR (current_kboard, Vlast_command)) + || NILP (Fget (KVAR (current_kboard, Vlast_command), Qscroll_command))) { struct position posit = *compute_motion (startpos, 0, 0, 0, diff --git a/src/xfns.c b/src/xfns.c index d8d4a8ca772..deb0e192a54 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -3473,9 +3473,9 @@ This function is an internal primitive--use `make-frame' instead. */) /* Initialize `default-minibuffer-frame' in case this is the first frame on this terminal. */ if (FRAME_HAS_MINIBUF_P (f) - && (!FRAMEP (kb->Vdefault_minibuffer_frame) - || !FRAME_LIVE_P (XFRAME (kb->Vdefault_minibuffer_frame)))) - kb->Vdefault_minibuffer_frame = frame; + && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) + || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) + KVAR (kb, Vdefault_minibuffer_frame) = frame; /* All remaining specified parameters, which have not been "used" 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 52d79e8dad7..909b6978f5a 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -7727,7 +7727,7 @@ x_connection_closed (Display *dpy, const char *error_message) { /* Set this to t so that delete_frame won't get confused trying to find a replacement. */ - FRAME_KBOARD (XFRAME (frame))->Vdefault_minibuffer_frame = Qt; + KVAR (FRAME_KBOARD (XFRAME (frame)), Vdefault_minibuffer_frame) = Qt; delete_frame (frame, Qnoelisp); } @@ -9966,7 +9966,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) { terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); init_kboard (terminal->kboard); - terminal->kboard->Vwindow_system = Qx; + KVAR (terminal->kboard, Vwindow_system) = Qx; /* Add the keyboard to the list before running Lisp code (via Qvendor_specific_keysyms below), since these are not traced @@ -9988,7 +9988,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) /* Temporarily hide the partially initialized terminal. */ terminal_list = terminal->next_terminal; UNBLOCK_INPUT; - terminal->kboard->Vsystem_key_alist + KVAR (terminal->kboard, Vsystem_key_alist) = call1 (Qvendor_specific_keysyms, vendor ? build_string (vendor) : empty_unibyte_string); BLOCK_INPUT;