GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
}
\f
+static bool
+echo_keystrokes_p (void)
+{
+ return (FLOATP (Vecho_keystrokes) ? XFLOAT_DATA (Vecho_keystrokes) > 0.0
+ : INTEGERP (Vecho_keystrokes) ? XINT (Vecho_keystrokes) > 0
+ : false);
+}
+
/* Add C to the echo string, without echoing it immediately. C can be
a character, which is pretty-printed, or a symbol, whose name is
printed. */
static void
echo_now (void)
{
- if (!current_kboard->immediate_echo)
+ if (!current_kboard->immediate_echo
+ /* This test breaks calls that use `echo_now' to display the echo_prompt.
+ && echo_keystrokes_p () */)
{
current_kboard->immediate_echo = true;
echo_update ();
Lisp_Object prev_event,
bool *used_mouse_menu)
{
-#define MAX_ENCODED_BYTES 16
#ifndef WINDOWSNT
+#define MAX_ENCODED_BYTES 16
Lisp_Object events[MAX_ENCODED_BYTES];
int n = 0;
#endif
}
}
-static bool
-echo_keystrokes_p (void)
-{
- return (FLOATP (Vecho_keystrokes) ? XFLOAT_DATA (Vecho_keystrokes) > 0.0
- : INTEGERP (Vecho_keystrokes) ? XINT (Vecho_keystrokes) > 0 : false);
-}
+#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wclobbered"
+#endif
/* Read a character from the keyboard; call the redisplay if needed. */
/* commandflag 0 means do not autosave, but do redisplay.
if (KEYMAPP (map) && INTERACTIVE
&& !NILP (prev_event) && ! EVENT_HAS_PARAMETERS (prev_event)
/* Don't bring up a menu if we already have another event. */
- && NILP (Vunread_command_events)
+ && !CONSP (Vunread_command_events)
&& !detect_input_pending_run_timers (0))
{
c = read_char_minibuf_menu_prompt (commandflag, map);
&& !EQ (XCAR (prev_event), Qmenu_bar)
&& !EQ (XCAR (prev_event), Qtool_bar)
/* Don't bring up a menu if we already have another event. */
- && NILP (Vunread_command_events))
+ && !CONSP (Vunread_command_events))
{
c = read_char_x_menu_prompt (map, prev_event, used_mouse_menu);
last_input_event = c;
call4 (Qcommand_execute, tem, Qnil, Fvector (1, &last_input_event), Qt);
- if (CONSP (c) && EQ (XCAR (c), Qselect_window) && !end_time)
+ if (CONSP (c)
+ && (EQ (XCAR (c), Qselect_window)
+#ifdef HAVE_DBUS
+ || EQ (XCAR (c), Qdbus_event)
+#endif
+#ifdef USE_FILE_NOTIFY
+ || EQ (XCAR (c), Qfile_notify)
+#endif
+ || EQ (XCAR (c), Qconfig_changed_event))
+ && !end_time)
/* We stopped being idle for this event; undo that. This
prevents automatic window selection (under
- mouse_autoselect_window from acting as a real input event, for
+ mouse-autoselect-window) from acting as a real input event, for
example banishing the mouse under mouse-avoidance-mode. */
timer_resume_idle ();
return c;
}
+#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
+# pragma GCC diagnostic pop
+#endif
+
/* Record a key that came from a mouse menu.
Record it for echoing, for this-command-keys, and so on. */
kbd_fetch_ptr = event + 1;
}
#endif
+
+#ifdef HAVE_NTGUI
+ else if (event->kind == END_SESSION_EVENT)
+ {
+ /* Make an event (end-session). */
+ obj = list1 (Qend_session);
+ kbd_fetch_ptr = event + 1;
+ }
+#endif
+
#if defined (HAVE_X11) || defined (HAVE_NTGUI) \
|| defined (HAVE_NS)
else if (event->kind == ICONIFY_EVENT)
the kbd_buffer can really hold. That may prevent loss
of characters on some systems when input is stuffed at us. */
unsigned char cbuf[KBD_BUFFER_SIZE - 1];
- int n_to_read, i;
+#ifndef WINDOWSNT
+ int n_to_read;
+#endif
+ int i;
struct tty_display_info *tty = terminal->display_info.tty;
int nread = 0;
#ifdef subprocesses
of echoing, so that it serves as a prompt for the next
character. */
kset_echo_prompt (current_kboard, prompt);
+ /* FIXME: This use of echo_now doesn't look quite right and is ugly
+ since it forces us to fiddle with current_kboard->immediate_echo
+ before and after. */
current_kboard->immediate_echo = false;
echo_now ();
+ if (!echo_keystrokes_p ())
+ current_kboard->immediate_echo = false;
}
- else if (cursor_in_echo_area
+ else if (cursor_in_echo_area /* FIXME: Not sure why we test this here,
+ maybe we should just drop this test. */
&& echo_keystrokes_p ())
/* This doesn't put in a dash if the echo buffer is empty, so
you don't always see a dash hanging out in the minibuffer. */
bool
requeued_events_pending_p (void)
{
- return (!NILP (Vunread_command_events));
+ return (CONSP (Vunread_command_events));
}
DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 1, 0,
If CHECK-TIMERS is non-nil, timers that are ready to run will do so. */)
(Lisp_Object check_timers)
{
- if (!NILP (Vunread_command_events)
+ if (CONSP (Vunread_command_events)
|| !NILP (Vunread_post_input_method_events)
|| !NILP (Vunread_input_method_events))
return (Qt);
#ifdef HAVE_NTGUI
DEFSYM (Qlanguage_change, "language-change");
+ DEFSYM (Qend_session, "end-session");
#endif
#ifdef HAVE_DBUS
DEFVAR_BOOL ("cannot-suspend", cannot_suspend,
doc: /* Non-nil means to always spawn a subshell instead of suspending.
-(Even if the operating system has support for stopping a process.) */);
+\(Even if the operating system has support for stopping a process.) */);
cannot_suspend = false;
DEFVAR_BOOL ("menu-prompting", menu_prompting,
DEFVAR_LISP ("input-method-function", Vinput_method_function,
doc: /* If non-nil, the function that implements the current input method.
It's called with one argument, a printing character that was just read.
-(That means a character with code 040...0176.)
+\(That means a character with code 040...0176.)
Typically this function uses `read-event' to read additional events.
When it does so, it should first bind `input-method-function' to nil
so it will not be called recursively.
DEFVAR_LISP ("disable-point-adjustment", Vdisable_point_adjustment,
doc: /* If non-nil, suppress point adjustment after executing a command.
-After a command is executed, if point is moved into a region that has
-special properties (e.g. composition, display), we adjust point to
-the boundary of the region. But, when a command sets this variable to
-non-nil, we suppress the point adjustment.
+After a command is executed, if point moved into a region that has
+special properties (e.g. composition, display), Emacs adjusts point to
+the boundary of the region. But when a command leaves this variable at
+a non-nil value (e.g., with a setq), this point adjustment is suppressed.
This variable is set to nil before reading a command, and is checked
just after executing the command. */);
DEFVAR_LISP ("global-disable-point-adjustment",
Vglobal_disable_point_adjustment,
- doc: /* If non-nil, always suppress point adjustment.
+ doc: /* If non-nil, always suppress point adjustments.
-The default value is nil, in which case, point adjustment are
-suppressed only after special commands that set
-`disable-point-adjustment' (which see) to non-nil. */);
+The default value is nil, in which case point adjustments are
+suppressed only after special commands that leave
+`disable-point-adjustment' (which see) at a non-nil value. */);
Vglobal_disable_point_adjustment = Qnil;
DEFVAR_LISP ("minibuffer-message-timeout", Vminibuffer_message_timeout,
initial_define_lispy_key (Vspecial_event_map, "delete-frame",
"handle-delete-frame");
+#ifdef HAVE_NTGUI
+ initial_define_lispy_key (Vspecial_event_map, "end-session",
+ "kill-emacs");
+#endif
initial_define_lispy_key (Vspecial_event_map, "ns-put-working-text",
"ns-put-working-text");
initial_define_lispy_key (Vspecial_event_map, "ns-unput-working-text",