/* This function can GC */
struct frame *f = selected_frame ();
- command_builder->echo_buf_index = -1;
+ if (command_builder)
+ command_builder->echo_buf_index = -1;
if (remove_echo_area_echo)
clear_echo_area (f, Qcommand, 0);
This way is safer. */
zero_event (&ev2);
character_to_event (XCHAR (traduit), &ev2,
- XCONSOLE (EVENT_CHANNEL (XEVENT (event))), 1, 1);
+ XCONSOLE (EVENT_CHANNEL (XEVENT (event))), 0, 1);
XEVENT (event)->event.key.keysym = ev2.event.key.keysym;
XEVENT (event)->event.key.modifiers = ev2.event.key.modifiers;
did_translate = 1;
zero_event (&ev2);
character_to_event (XCHAR (traduit), &ev2,
- XCONSOLE (EVENT_CHANNEL (XEVENT (event))), 1, 1);
+ XCONSOLE (EVENT_CHANNEL (XEVENT (event))), 0, 1);
XEVENT (event)->event.key.keysym = ev2.event.key.keysym;
XEVENT (event)->event.key.modifiers |= ev2.event.key.modifiers;
did_translate = 1;
switch (XEVENT_TYPE (event))
{
- default:
- goto RETURN;
case button_release_event:
case misc_user_event:
/* don't echo menu accelerator keys */
goto STORE_AND_EXECUTE_KEY;
case key_press_event: /* any key input can trigger autosave */
break;
+ default:
+ goto RETURN;
}
maybe_do_auto_save ();
void
reset_this_command_keys (Lisp_Object console, int clear_echo_area_p)
{
- struct command_builder *command_builder =
- XCOMMAND_BUILDER (XCONSOLE (console)->command_builder);
-
- reset_key_echo (command_builder, clear_echo_area_p);
+ if (!NILP (console))
+ {
+ /* console is nil if we just deleted the console as a result of C-x 5
+ 0. Unfortunately things are currently in a messy situation where
+ some stuff is console-local and other stuff isn't, so we need to
+ do everything that's not console-local. */
+ struct command_builder *command_builder =
+ XCOMMAND_BUILDER (XCONSOLE (console)->command_builder);
+
+ reset_key_echo (command_builder, clear_echo_area_p);
+ reset_current_events (command_builder);
+ }
+ else
+ reset_key_echo (0, clear_echo_area_p);
deallocate_event_chain (Vthis_command_keys);
Vthis_command_keys = Qnil;
Vthis_command_keys_tail = Qnil;
-
- reset_current_events (command_builder);
}
static void
static int
is_scrollbar_event (Lisp_Object event)
{
+#ifdef HAVE_SCROLLBARS
Lisp_Object fun;
if (XEVENT (event)->event_type != misc_user_event)
EQ (fun, Qscrollbar_to_left) ||
EQ (fun, Qscrollbar_to_right) ||
EQ (fun, Qscrollbar_horizontal_drag));
+#else
+ return 0;
+#endif /* HAVE_SCROLLBARS */
}
static void
post_command_hook ();
- if (!NILP (con->prefix_arg))
+ /* Console might have been deleted by command */
+ if (CONSOLE_LIVE_P (con) && !NILP (con->prefix_arg))
{
/* Commands that set the prefix arg don't update last-command, don't
reset the echoing state, and don't go into keyboard macros unless
so we don't either */
if (!is_scrollbar_event (event))
- reset_this_command_keys (make_console (con), 0);
+ reset_this_command_keys (CONSOLE_LIVE_P (con) ? make_console (con)
+ : Qnil, 0);
}
}
struct gcpro gcpro1;
GCPRO1 (event);
+ record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
if (!NILP (prompt))
CHECK_STRING (prompt);
/* else prompt = Fkeymap_prompt (current_buffer->keymap); may GC */