The lowest level functions for command input are those which read a single event. These functions often make a distinction between command events, which are user actions (keystrokes and mouse actions), and other events, which serve as communication between SXEmacs and the window system.
This function reads and returns the next available event from the window system or terminal driver, waiting if necessary until an event is available. Pass this object to
dispatch-eventto handle it. If an event object is supplied, it is filled in and returned; otherwise a new event object will be created.Events can come directly from the user, from a keyboard macro, or from
unread-command-events.In most cases, the function
next-command-eventis more appropriate.
This function returns the next available “user” event from the window system or terminal driver. Pass this object to
dispatch-eventto handle it. If an event object is supplied, it is filled in and returned, otherwise a new event object will be created.The event returned will be a keyboard, mouse press, or mouse release event. If there are non-command events available (mouse motion, sub-process output, etc) then these will be executed (with
dispatch-event) and discarded. This function is provided as a convenience; it is equivalent to the Lisp code(while (progn (next-event event) (not (or (key-press-event-p event) (button-press-event-p event) (button-release-event-p event) (menu-event-p event)))) (dispatch-event event))Here is what happens if you call
next-command-eventand then press the right-arrow function key:(next-command-event) ⇒ #<keypress-event right>
This function reads and returns a character of command input. If a mouse click is detected, an error is signalled. The character typed is returned as an ascii value.
Note: This function is retained for compatibility with Emacs 18, and is most likely the wrong thing for you to be using: consider using
next-command-eventinstead.