Previous: , Up: Events and the Event Loop   [Contents][Index]

13.12 Editor-Level Control Flow Modules


These implement the handling of events (user input and other system notifications).

events.c and events.h define the event Lisp object type and primitives for manipulating it.

event-stream.c implements the basic functions for working with event queues, dispatching an event by looking it up in relevant keymaps and such, and handling timeouts; this includes the primitives next-event and dispatch-event, as well as related primitives such as sit-for, sleep-for, and accept-process-output. (event-stream.c is one of the hairiest and trickiest modules in XEmacs. Beware! You can easily mess things up here.)

event-Xt.c and event-tty.c implement the low-level interfaces onto retrieving events from Xt (the X toolkit) and from TTY’s (using read() and select()), respectively. The event interface enforces a clean separation between the specific code for interfacing with the operating system and the generic code for working with events, by defining an API of basic, low-level event methods; event-Xt.c and event-tty.c are two different implementations of this API. To add support for a new operating system (e.g. NeXTstep), one merely needs to provide another implementation of those API functions.

Note that the choice of whether to use event-Xt.c or event-tty.c is made at compile time! Or at the very latest, it is made at startup time. event-Xt.c handles events for both X and TTY frames; event-tty.c is only used when X support is not compiled into XEmacs. The reason for this is that there is only one event loop in XEmacs: thus, it needs to be able to receive events from all different kinds of frames.


keymap.c and keymap.h define the keymap Lisp object type and associated methods and primitives. (Remember that keymaps are objects that associate event descriptions with functions to be called to “execute” those events; dispatch-event looks up events in the relevant keymaps.)


cmdloop.c contains functions that implement the actual editor command loop—i.e. the event loop that cyclically retrieves and dispatches events. This code is also rather tricky, just like event-stream.c.


These two modules contain the basic code for defining keyboard macros. These functions don’t actually do much; most of the code that handles keyboard macros is mixed in with the event-handling code in event-stream.c.


This contains some miscellaneous code related to the minibuffer (most of the minibuffer code was moved into Lisp by Richard Mlynarik). This includes the primitives for completion (although filename completion is in dired.c), the lowest-level interface to the minibuffer (if the command loop were cleaned up, this too could be in Lisp), and code for dealing with the echo area (this, too, was mostly moved into Lisp, and the only code remaining is code to call out to Lisp or provide simple bootstrapping implementations early in temacs, before the echo-area Lisp code is loaded).

Previous: , Up: Events and the Event Loop   [Contents][Index]