/* Keyboard and mouse input; editor command loop.
-Copyright (C) 1985-1989, 1993-1997, 1999-2012 Free Software Foundation, Inc.
+Copyright (C) 1985-1989, 1993-1997, 1999-2013 Free Software Foundation,
+Inc.
This file is part of GNU Emacs.
Lisp_Object Qmouse_click;
#ifdef HAVE_NTGUI
Lisp_Object Qlanguage_change;
+#ifdef WINDOWSNT
+Lisp_Object Qfile_w32notify;
+#endif
#endif
static Lisp_Object Qdrag_n_drop;
static Lisp_Object Qsave_session;
#ifdef HAVE_DBUS
static Lisp_Object Qdbus_event;
#endif
+#ifdef HAVE_INOTIFY
+static Lisp_Object Qfile_inotify;
+#endif /* HAVE_INOTIFY */
static Lisp_Object Qconfig_changed_event;
/* Lisp_Object Qmouse_movement; - also an event header */
Vsignaling_function = Qnil;
}
-\f
-Lisp_Object command_loop_1 (void);
+
static Lisp_Object command_loop_2 (Lisp_Object);
static Lisp_Object top_level_1 (Lisp_Object);
value to us. A value of nil means that command_loop_1 itself
returned due to end of file (or end of kbd macro). */
-Lisp_Object
+static Lisp_Object
command_loop_2 (Lisp_Object ignore)
{
register Lisp_Object val;
return Feval (Vtop_level, Qnil);
}
-Lisp_Object
+static Lisp_Object
top_level_1 (Lisp_Object ignore)
{
/* On entry to the outer level, run the startup file */
make_number (event->modifiers)));
kbd_fetch_ptr = event + 1;
}
+#endif
+#ifdef WINDOWSNT
+ else if (event->kind == FILE_NOTIFY_EVENT)
+ {
+ /* Make an event (file-notify (DESCRIPTOR ACTION FILE) CALLBACK). */
+ obj = Fcons (Qfile_w32notify,
+ list2 (list3 (make_number (event->code),
+ XCAR (event->arg),
+ XCDR (event->arg)),
+ event->frame_or_window));
+ kbd_fetch_ptr = event + 1;
+ }
#endif
else if (event->kind == SAVE_SESSION_EVENT)
{
obj = make_lispy_event (event);
kbd_fetch_ptr = event + 1;
}
+#endif
+#ifdef HAVE_INOTIFY
+ else if (event->kind == FILE_NOTIFY_EVENT)
+ {
+ obj = make_lispy_event (event);
+ kbd_fetch_ptr = event + 1;
+ }
#endif
else if (event->kind == CONFIG_CHANGED_EVENT)
{
string_info = Fcons (string, make_number (charpos));
textpos = (w == XWINDOW (selected_window)
&& current_buffer == XBUFFER (w->buffer))
- ? PT : XMARKER (w->pointm)->charpos;
+ ? PT : marker_position (w->pointm);
xret = wx;
yret = wy;
}
#endif /* HAVE_DBUS */
+#ifdef HAVE_INOTIFY
+ case FILE_NOTIFY_EVENT:
+ {
+ return Fcons (Qfile_inotify, event->arg);
+ }
+#endif /* HAVE_INOTIFY */
+
case CONFIG_CHANGED_EVENT:
return Fcons (Qconfig_changed_event,
Fcons (event->arg,
void
record_asynch_buffer_change (void)
{
- struct input_event event;
- Lisp_Object tem;
- EVENT_INIT (event);
-
- event.kind = BUFFER_SWITCH_EVENT;
- event.frame_or_window = Qnil;
- event.arg = Qnil;
-
/* We don't need a buffer-switch event unless Emacs is waiting for input.
The purpose of the event is to make read_key_sequence look up the
keymaps again. If we aren't in read_key_sequence, we don't need one,
and the event could cause trouble by messing up (input-pending-p).
Note: Fwaiting_for_user_input_p always returns nil when async
subprocesses aren't supported. */
- tem = Fwaiting_for_user_input_p ();
- if (NILP (tem))
- return;
+ if (!NILP (Fwaiting_for_user_input_p ()))
+ {
+ struct input_event event;
+
+ EVENT_INIT (event);
+ event.kind = BUFFER_SWITCH_EVENT;
+ event.frame_or_window = Qnil;
+ event.arg = Qnil;
- /* Make sure no interrupt happens while storing the event. */
+ /* Make sure no interrupt happens while storing the event. */
#ifdef USABLE_SIGIO
- if (interrupt_input)
- kbd_buffer_store_event (&event);
- else
+ if (interrupt_input)
+ kbd_buffer_store_event (&event);
+ else
#endif
- {
- stop_polling ();
- kbd_buffer_store_event (&event);
- start_polling ();
+ {
+ stop_polling ();
+ kbd_buffer_store_event (&event);
+ start_polling ();
+ }
}
}
-\f
+
/* Read any terminal input already buffered up by the system
into the kbd_buffer, but do not wait.
an EAGAIN error. Does anybody know of a situation
where a retry is actually needed? */
#if 0
- nread < 0 && (errno == EAGAIN
-#ifdef EFAULT
- || errno == EFAULT
-#endif
+ nread < 0 && (errno == EAGAIN || errno == EFAULT
#ifdef EBADSLT
|| errno == EBADSLT
#endif
fflush (stdout);
reset_all_sys_modes ();
-#ifdef SIGTSTP /* Support possible in later USG versions */
+#ifdef SIGTSTP
/*
* On systems which can suspend the current process and return to the original
* shell, this command causes the user to end up back at the shell.
DEFSYM (Qlanguage_change, "language-change");
#endif
+#ifdef WINDOWSNT
+ DEFSYM (Qfile_w32notify, "file-w32notify");
+#endif
+
#ifdef HAVE_DBUS
DEFSYM (Qdbus_event, "dbus-event");
#endif
+#ifdef HAVE_INOTIFY
+ DEFSYM (Qfile_inotify, "file-inotify");
+#endif /* HAVE_INOTIFY */
+
DEFSYM (QCenable, ":enable");
DEFSYM (QCvisible, ":visible");
DEFSYM (QChelp, ":help");
"dbus-handle-event");
#endif
+#ifdef HAVE_INOTIFY
+ /* Define a special event which is raised for inotify callback
+ functions. */
+ initial_define_lispy_key (Vspecial_event_map, "file-inotify",
+ "inotify-handle-event");
+#endif /* HAVE_INOTIFY */
+
initial_define_lispy_key (Vspecial_event_map, "config-changed-event",
"ignore");
#if defined (WINDOWSNT)
initial_define_lispy_key (Vspecial_event_map, "language-change",
"ignore");
+ initial_define_lispy_key (Vspecial_event_map, "file-w32notify",
+ "w32notify-handle-event");
#endif
}