changeset 2057:265b81ff7eee

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Sun, 07 Mar 1993 20:57:30 +0000
parents 0c95942fc8da
children a43d0bb1b7d8
files lisp/emacs-lisp/levents.el
diffstat 1 files changed, 27 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/levents.el	Sun Mar 07 20:18:52 1993 +0000
+++ b/lisp/emacs-lisp/levents.el	Sun Mar 07 20:57:30 1993 +0000
@@ -31,6 +31,15 @@
 
 ;;; Code:
 
+(defun next-command-event (event)
+  (error "You must rewrite to use `read-command-event' instead of `next-command-event'"))
+
+(defun next-event (event)
+  (error "You must rewrite to use `read-event' instead of `next-event'"))
+
+(defun dispatch-event (event)
+  (error "`dispatch-event' not supported"))
+
 ;; Make events of type eval, menu and timeout
 ;; execute properly.
 
@@ -100,17 +109,6 @@
 except via garbage collection and `cons'."
   nil)
 
-(defun dispatch-event (event)
-  "Given an event object returned by next-event, execute it."
-  (let ((type (car-safe event)))
-    (cond ((eq type 'eval)
-	   (funcall (nth 1 event) (nth 2 event)))
-	  ((eq type 'menu)
-	   (funcall (nth 1 event) (nth 2 event)))
-	  ((eq type 'switch-frame)
-	   (internal-select-frame (nth 1 event)))
-	  (t (error "keyboard and mouse events not allowed in `dispatch-event'")))))
-
 (defun enqueue-eval-event: (function object)
   "Add an eval event to the back of the queue.
 It will be the next event read after all pending events."
@@ -261,31 +259,24 @@
   "True if the argument is a mouse-motion event object."
   (eq (car-safe obj) 'mouse-movement))
 
-(defun next-command-event (event)
-  "Given an event structure, fills it in with the next keyboard, mouse
-press, or mouse release event available from the user.  If there are
-non-command events available (mouse motion, sub-process output, etc) then
-these will be executed (with dispatch-event) and discarded."
-  (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)))
-
-(defun next-event (event &optional ignore)
-  "Given an event structure, fills it in with the next event available
-from the window system or terminal driver.  Pass this object to
-`dispatch-event' to handle it.
-
-See also the function `next-command-event'.
-
-If the second optional argument is non-nil, then this will never return
-key-press and mouse-click events, but will delay them until later.  You
-should probably never need to use this option; it is used for implementing
-the `wait-reading-process-input' function."
-  (read-event))
+(defun read-command-event ()
+  "Return the next keyboard or mouse event; execute other events.
+This is similar to the function `next-command-event' of Lucid Emacs,
+but different in that it returns the event rather than filling in
+an existing event object."
+  (let (event)
+    (while (progn
+	     (setq event (read-event))
+	     (not (or (key-press-event-p event)
+		      (button-press-event-p event)
+		      (button-release-event-p event)
+		      (menu-event-p event))))
+      (let ((type (car-safe event)))
+	(cond ((eq type 'eval)
+	       (funcall (nth 1 event) (nth 2 event)))
+	      ((eq type 'switch-frame)
+	       (internal-select-frame (nth 1 event))))))
+    event))
 
 (defun process-event-p (obj)
   "True if the argument is a process-output event object.