Mercurial > emacs
annotate lisp/emacs-lisp/levents.el @ 54736:b94de166de9d
(ethio-sera-being-called-by-w3): New
variable.
(ethio-sera-to-fidel-ethio): Check ethio-sera-being-called-by-w3
instead of sera-being-called-by-w3.
(ethio-fidel-to-sera-buffer): Likewise.
(ethio-find-file): Bind ethio-sera-being-called-by-w3 to t
instead of sera-being-called-by-w3.
(ethio-write-file): Likewise.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Mon, 05 Apr 2004 23:27:37 +0000 |
| parents | 695cf19ef79e |
| children | 18a818a2ee7c 375f2633d815 |
| rev | line source |
|---|---|
|
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Jan?k <Pavel@Janik.cz>
parents:
18383
diff
changeset
|
1 ;;; levents.el --- emulate the Lucid event data type and associated functions |
|
2232
4f9d60f7de9d
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2066
diff
changeset
|
2 |
| 39117 | 3 ;; Copyright (C) 1993, 2001 Free Software Foundation, Inc. |
| 2034 | 4 |
|
38961
5b23575286e6
Add the Maintainer keyword. From Pavel Janik.
Eli Zaretskii <eliz@gnu.org>
parents:
38414
diff
changeset
|
5 ;; Maintainer: FSF |
| 39117 | 6 ;; Keywords: emulations |
|
38961
5b23575286e6
Add the Maintainer keyword. From Pavel Janik.
Eli Zaretskii <eliz@gnu.org>
parents:
38414
diff
changeset
|
7 |
| 2034 | 8 ;; This file is part of GNU Emacs. |
| 9 | |
| 10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
| 11 ;; it under the terms of the GNU General Public License as published by | |
| 12 ;; the Free Software Foundation; either version 2, or (at your option) | |
| 13 ;; any later version. | |
| 14 | |
| 15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
| 16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 ;; GNU General Public License for more details. | |
| 19 | |
| 20 ;; You should have received a copy of the GNU General Public License | |
| 14169 | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
| 22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
| 23 ;; Boston, MA 02111-1307, USA. | |
| 2034 | 24 |
|
2232
4f9d60f7de9d
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2066
diff
changeset
|
25 ;;; Commentary: |
| 2034 | 26 |
| 27 ;; Things we cannot emulate in Lisp: | |
| 28 ;; It is not possible to emulate current-mouse-event as a variable, | |
| 29 ;; though it is not hard to obtain the data from (this-command-keys). | |
| 30 | |
| 31 ;; We do not have a variable unread-command-event; | |
| 32 ;; instead, we have the more general unread-command-events. | |
| 33 | |
|
2039
e062b4567dc6
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2034
diff
changeset
|
34 ;; Our read-key-sequence and read-char are not precisely |
|
e062b4567dc6
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2034
diff
changeset
|
35 ;; compatible with those in Lucid Emacs, but they should work ok. |
| 2034 | 36 |
| 37 ;;; Code: | |
| 38 | |
|
2057
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
39 (defun next-command-event (event) |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
40 (error "You must rewrite to use `read-command-event' instead of `next-command-event'")) |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
41 |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
42 (defun next-event (event) |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
43 (error "You must rewrite to use `read-event' instead of `next-event'")) |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
44 |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
45 (defun dispatch-event (event) |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
46 (error "`dispatch-event' not supported")) |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
47 |
| 2034 | 48 ;; Make events of type eval, menu and timeout |
| 49 ;; execute properly. | |
| 50 | |
| 51 (define-key global-map [menu] 'execute-eval-event) | |
| 52 (define-key global-map [timeout] 'execute-eval-event) | |
| 53 (define-key global-map [eval] 'execute-eval-event) | |
| 54 | |
| 55 (defun execute-eval-event (event) | |
| 56 (interactive "e") | |
| 57 (funcall (nth 1 event) (nth 2 event))) | |
| 58 | |
| 59 (put 'eval 'event-symbol-elements '(eval)) | |
| 60 (put 'menu 'event-symbol-elements '(eval)) | |
| 61 (put 'timeout 'event-symbol-elements '(eval)) | |
| 62 | |
| 63 (defun allocate-event () | |
| 64 "Returns an empty event structure. | |
| 65 In this emulation, it returns nil." | |
| 66 nil) | |
| 67 | |
| 68 (defun button-press-event-p (obj) | |
| 69 "True if the argument is a mouse-button-press event object." | |
| 70 (and (consp obj) (symbolp (car obj)) | |
| 71 (memq 'down (get (car obj) 'event-symbol-elements)))) | |
| 72 | |
| 73 (defun button-release-event-p (obj) | |
| 74 "True if the argument is a mouse-button-release event object." | |
| 75 (and (consp obj) (symbolp (car obj)) | |
| 76 (or (memq 'click (get (car obj) 'event-symbol-elements)) | |
| 77 (memq 'drag (get (car obj) 'event-symbol-elements))))) | |
| 78 | |
|
17858
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
79 (defun button-event-p (obj) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
80 "True if the argument is a mouse-button press or release event object." |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
81 (and (consp obj) (symbolp (car obj)) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
82 (or (memq 'click (get (car obj) 'event-symbol-elements)) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
83 (memq 'down (get (car obj) 'event-symbol-elements)) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
84 (memq 'drag (get (car obj) 'event-symbol-elements))))) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
85 |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
86 (defun mouse-event-p (obj) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
87 "True if the argument is a mouse-button press or release event object." |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
88 (and (consp obj) (symbolp (car obj)) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
89 (or (eq (car obj) 'mouse-movement) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
90 (memq 'click (get (car obj) 'event-symbol-elements)) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
91 (memq 'down (get (car obj) 'event-symbol-elements)) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
92 (memq 'drag (get (car obj) 'event-symbol-elements))))) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
93 |
| 2034 | 94 (defun character-to-event (ch &optional event) |
| 95 "Converts a numeric ASCII value to an event structure, replete with | |
| 96 bucky bits. The character is the first argument, and the event to fill | |
| 97 in is the second. This function contains knowledge about what the codes | |
| 98 mean -- for example, the number 9 is converted to the character Tab, | |
| 99 not the distinct character Control-I. | |
| 100 | |
|
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39117
diff
changeset
|
101 Beware that character-to-event and event-to-character are not strictly |
|
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39117
diff
changeset
|
102 inverse functions, since events contain much more information than the |
| 2034 | 103 ASCII character set can encode." |
| 104 ch) | |
| 105 | |
| 106 (defun copy-event (event1 &optional event2) | |
| 107 "Make a copy of the given event object. | |
| 108 In this emulation, `copy-event' just returns its argument." | |
| 109 event1) | |
| 110 | |
| 111 (defun deallocate-event (event) | |
| 112 "Allow the given event structure to be reused. | |
| 113 In actual Lucid Emacs, you MUST NOT use this event object after | |
| 114 calling this function with it. You will lose. It is not necessary to | |
| 115 call this function, as event objects are garbage- collected like all | |
| 116 other objects; however, it may be more efficient to explicitly | |
| 117 deallocate events when you are sure that that is safe. | |
| 118 | |
| 119 This emulation does not actually deallocate or reuse events | |
| 120 except via garbage collection and `cons'." | |
| 121 nil) | |
| 122 | |
| 123 (defun enqueue-eval-event: (function object) | |
| 124 "Add an eval event to the back of the queue. | |
| 125 It will be the next event read after all pending events." | |
| 126 (setq unread-command-events | |
| 127 (nconc unread-command-events | |
| 128 (list (list 'eval function object))))) | |
| 129 | |
| 130 (defun eval-event-p (obj) | |
| 131 "True if the argument is an eval or menu event object." | |
| 132 (eq (car-safe obj) 'eval)) | |
| 133 | |
| 134 (defun event-button (event) | |
| 135 "Return the button-number of the given mouse-button-press event." | |
| 136 (let ((sym (car (get (car event) 'event-symbol-elements)))) | |
| 137 (cdr (assq sym '((mouse-1 . 1) (mouse-2 . 2) (mouse-3 . 3) | |
| 138 (mouse-4 . 4) (mouse-5 . 5)))))) | |
| 139 | |
| 140 (defun event-function (event) | |
| 141 "Return the callback function of the given timeout, menu, or eval event." | |
| 142 (nth 1 event)) | |
| 143 | |
| 144 (defun event-key (event) | |
| 145 "Returns the KeySym of the given key-press event. | |
| 146 The value is an ASCII printing character (not upper case) or a symbol." | |
| 147 (if (symbolp event) | |
| 148 (car (get event 'event-symbol-elements)) | |
| 149 (let ((base (logand event (1- (lsh 1 18))))) | |
| 150 (downcase (if (< base 32) (logior base 64) base))))) | |
| 151 | |
| 152 (defun event-object (event) | |
| 153 "Returns the function argument of the given timeout, menu, or eval event." | |
| 154 (nth 2 event)) | |
| 155 | |
| 156 (defun event-point (event) | |
| 157 "Returns the character position of the given mouse-related event. | |
| 158 If the event did not occur over a window, or did | |
| 159 not occur over text, then this returns nil. Otherwise, it returns an index | |
| 160 into the buffer visible in the event's window." | |
| 161 (posn-point (event-end event))) | |
| 162 | |
|
17858
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
163 ;; Return position of start of line LINE in WINDOW. |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
164 ;; If LINE is nil, return the last position |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
165 ;; visible in WINDOW. |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
166 (defun event-closest-point-1 (window &optional line) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
167 (let* ((total (- (window-height window) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
168 (if (window-minibuffer-p window) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
169 0 1))) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
170 (distance (or line total))) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
171 (save-excursion |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
172 (goto-char (window-start window)) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
173 (if (= (vertical-motion distance) distance) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
174 (if (not line) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
175 (forward-char -1))) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
176 (point)))) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
177 |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
178 (defun event-closest-point (event &optional start-window) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
179 "Return the nearest position to where EVENT ended its motion. |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
180 This is computed for the window where EVENT's motion started, |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
181 or for window WINDOW if that is specified." |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
182 (or start-window (setq start-window (posn-window (event-start event)))) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
183 (if (eq start-window (posn-window (event-end event))) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
184 (if (eq (event-point event) 'vertical-line) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
185 (event-closest-point-1 start-window |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
186 (cdr (posn-col-row (event-end event)))) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
187 (if (eq (event-point event) 'mode-line) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
188 (event-closest-point-1 start-window) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
189 (event-point event))) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
190 ;; EVENT ended in some other window. |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
191 (let* ((end-w (posn-window (event-end event))) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
192 (end-w-top) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
193 (w-top (nth 1 (window-edges start-window)))) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
194 (setq end-w-top |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
195 (if (windowp end-w) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
196 (nth 1 (window-edges end-w)) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
197 (/ (cdr (posn-x-y (event-end event))) |
|
17897
02b656fa8243
(event-closest-point): Fix paren error.
Richard M. Stallman <rms@gnu.org>
parents:
17858
diff
changeset
|
198 (frame-char-height end-w)))) |
|
17858
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
199 (if (>= end-w-top w-top) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
200 (event-closest-point-1 start-window) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
201 (window-start start-window))))) |
|
72e538330a11
(event-closest-point): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14704
diff
changeset
|
202 |
| 2034 | 203 (defun event-process (event) |
| 204 "Returns the process of the given process-output event." | |
| 205 (nth 1 event)) | |
| 206 | |
| 207 (defun event-timestamp (event) | |
| 208 "Returns the timestamp of the given event object. | |
| 209 In Lucid Emacs, this works for any kind of event. | |
| 210 In this emulation, it returns nil for non-mouse-related events." | |
| 211 (and (listp event) | |
| 212 (posn-timestamp (event-end event)))) | |
| 213 | |
| 214 (defun event-to-character (event &optional lenient) | |
| 215 "Returns the closest ASCII approximation to the given event object. | |
| 216 If the event isn't a keypress, this returns nil. | |
|
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39117
diff
changeset
|
217 If the second argument is non-nil, then this is lenient in its |
| 2034 | 218 translation; it will ignore modifier keys other than control and meta, |
|
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39117
diff
changeset
|
219 and will ignore the shift modifier on those characters which have no |
|
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39117
diff
changeset
|
220 shifted ASCII equivalent (Control-Shift-A for example, will be mapped to |
|
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39117
diff
changeset
|
221 the same ASCII code as Control-A.) If the second arg is nil, then nil |
| 2034 | 222 will be returned for events which have no direct ASCII equivalent." |
| 223 (if (symbolp event) | |
| 224 (and lenient | |
| 225 (cdr (assq event '((backspace . 8) (delete . 127) (tab . 9) | |
| 226 (return . 10) (enter . 10))))) | |
| 227 ;; Our interpretation is, ASCII means anything a number can represent. | |
| 228 (if (integerp event) | |
| 229 event nil))) | |
| 230 | |
| 231 (defun event-window (event) | |
| 232 "Returns the window of the given mouse-related event object." | |
| 233 (posn-window (event-end event))) | |
| 234 | |
| 235 (defun event-x (event) | |
| 236 "Returns the X position in characters of the given mouse-related event." | |
| 237 (/ (car (posn-col-row (event-end event))) | |
| 2066 | 238 (frame-char-width (window-frame (event-window event))))) |
| 2034 | 239 |
| 240 (defun event-x-pixel (event) | |
| 241 "Returns the X position in pixels of the given mouse-related event." | |
| 242 (car (posn-col-row (event-end event)))) | |
| 243 | |
| 244 (defun event-y (event) | |
| 245 "Returns the Y position in characters of the given mouse-related event." | |
| 246 (/ (cdr (posn-col-row (event-end event))) | |
| 2066 | 247 (frame-char-height (window-frame (event-window event))))) |
| 2034 | 248 |
| 249 (defun event-y-pixel (event) | |
| 250 "Returns the Y position in pixels of the given mouse-related event." | |
| 251 (cdr (posn-col-row (event-end event)))) | |
| 252 | |
| 253 (defun key-press-event-p (obj) | |
| 254 "True if the argument is a keyboard event object." | |
| 255 (or (integerp obj) | |
| 256 (and (symbolp obj) | |
| 257 (get obj 'event-symbol-elements)))) | |
| 258 | |
| 259 (defun menu-event-p (obj) | |
| 260 "True if the argument is a menu event object." | |
| 261 (eq (car-safe obj) 'menu)) | |
| 262 | |
| 263 (defun motion-event-p (obj) | |
| 264 "True if the argument is a mouse-motion event object." | |
| 265 (eq (car-safe obj) 'mouse-movement)) | |
| 266 | |
|
2057
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
267 (defun read-command-event () |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
268 "Return the next keyboard or mouse event; execute other events. |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
269 This is similar to the function `next-command-event' of Lucid Emacs, |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
270 but different in that it returns the event rather than filling in |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
271 an existing event object." |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
272 (let (event) |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
273 (while (progn |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
274 (setq event (read-event)) |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
275 (not (or (key-press-event-p event) |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
276 (button-press-event-p event) |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
277 (button-release-event-p event) |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
278 (menu-event-p event)))) |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
279 (let ((type (car-safe event))) |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
280 (cond ((eq type 'eval) |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
281 (funcall (nth 1 event) (nth 2 event))) |
|
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
282 ((eq type 'switch-frame) |
|
2957
ec432bd5d5b9
(event-modifiers): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
2232
diff
changeset
|
283 (select-frame (nth 1 event)))))) |
|
2057
265b81ff7eee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2039
diff
changeset
|
284 event)) |
| 2034 | 285 |
| 286 (defun process-event-p (obj) | |
| 287 "True if the argument is a process-output event object. | |
| 288 GNU Emacs 19 does not currently generate process-output events." | |
| 289 (eq (car-safe obj) 'process)) | |
| 290 | |
| 18383 | 291 (provide 'levents) |
| 292 | |
| 52401 | 293 ;;; arch-tag: a80c21da-69d7-46de-9cdb-5f68577b5525 |
| 2034 | 294 ;;; levents.el ends here |
