/* Keyboard and mouse input; editor command loop.
Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, 1995,
1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+ 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU Emacs.
/* If the window system or terminal frame hasn't been initialized
yet, or we're not interactive, write the message to stderr and exit. */
else if (!sf->glyphs_initialized_p
- || FRAME_INITIAL_P (sf)
+ /* We used to check if "This is the case of the frame dumped with
+ Emacs, when we're running under a window system" with
+ || (!NILP (Vwindow_system) && !inhibit_window_system
+ && FRAME_TERMCAP_P (sf))
+ then the multi-tty code generalized this check to
+ || FRAME_INITIAL_P (sf)
+ but this leads to undesirable behavior in daemon mode where
+ we don't want to exit just because we got an error without
+ having a frame (bug#1310).
+ So I just removed the check, and rely instead on the `message_*'
+ functions properly using FRAME_INITIAL_P. In the worst case
+ this should just make Emacs not exit when it should. */
|| noninteractive)
{
print_error_message (data, Qexternal_debugging_output,
static Lisp_Object help_form_saved_window_configs;
static Lisp_Object
-read_char_help_form_unwind (arg)
+read_char_help_form_unwind (Lisp_Object arg)
{
Lisp_Object window_config = XCAR (help_form_saved_window_configs);
help_form_saved_window_configs = XCDR (help_form_saved_window_configs);
register int c;
Lisp_Object obj;
- if (noninteractive)
+ if (noninteractive
+ /* In case we are running as a daemon, only do this before
+ detaching from the terminal. */
+ || (IS_DAEMON && daemon_pipe[1] >= 0))
{
c = getchar ();
XSETINT (obj, c);
&object, &dx, &dy, &width, &height);
if (STRINGP (string))
string_info = Fcons (string, make_number (charpos));
- if (w == XWINDOW (selected_window))
+ if (w == XWINDOW (selected_window)
+ && current_buffer == XBUFFER (w->buffer))
textpos = PT;
else
textpos = XMARKER (w->pointm)->charpos;
&& ('0' <= SREF (name, i + 6) && SREF (name, i + 6) <= '9'))
modifiers |= click_modifier;
+ if (! (modifiers & (double_modifier | triple_modifier))
+ && i + 6 < SBYTES (name)
+ && strncmp (SDATA (name) + i, "wheel-", 6) == 0)
+ modifiers |= click_modifier;
+
if (modifier_end)
*modifier_end = i;
alone in its group. */
kill (getpid (), SIGHUP);
- /* XXX Is calling delete_terminal safe here? It calls Fdelete_frame. */
+ /* XXX Is calling delete_terminal safe here? It calls delete_frame. */
{
Lisp_Object tmp;
XSETTERMINAL (tmp, t);