aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-03-08 08:10:13 +0000
committerRichard M. Stallman1993-03-08 08:10:13 +0000
commit0f03054a858b614eae5c4fa8365aec02cc8ac03b (patch)
treed7d7e82590b46f8e8d4a73bcdbe4c56dc5f19c6f
parent9a408b1d638f8cdaf4639c02b82b2057cb5fe999 (diff)
downloademacs-0f03054a858b614eae5c4fa8365aec02cc8ac03b.tar.gz
emacs-0f03054a858b614eae5c4fa8365aec02cc8ac03b.zip
(posn-timestamp, posn-col-row, posn-point, posn-window):
(event-end, event-start, mouse-movement-p): Moved from mouse.el.
-rw-r--r--lisp/subr.el53
1 files changed, 52 insertions, 1 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index a8533e19b0b..464fea25f9c 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -197,7 +197,7 @@ in KEYMAP as NEWDEF those chars which are defined as OLDDEF in OLDMAP."
197 prefix1))))) 197 prefix1)))))
198 (setq i (1+ i)))))) 198 (setq i (1+ i))))))
199 (setq scan (cdr scan))))) 199 (setq scan (cdr scan)))))
200 200
201(defun listify-key-sequence (key) 201(defun listify-key-sequence (key)
202 "Convert a key sequence to a list of events." 202 "Convert a key sequence to a list of events."
203 (if (vectorp key) 203 (if (vectorp key)
@@ -252,6 +252,57 @@ The value is an ASCII printing character (not upper case) or a symbol."
252 (let ((base (logand event (1- (lsh 1 18))))) 252 (let ((base (logand event (1- (lsh 1 18)))))
253 (downcase (if (< base 32) (logior base 64) base))))) 253 (downcase (if (< base 32) (logior base 64) base)))))
254 254
255(defsubst mouse-movement-p (object)
256 "Return non-nil if OBJECT is a mouse movement event."
257 (and (consp object)
258 (eq (car object) 'mouse-movement)))
259
260(defsubst event-start (event)
261 "Return the starting position of EVENT.
262If EVENT is a mouse press or a mouse click, this returns the location
263of the event.
264If EVENT is a drag, this returns the drag's starting position.
265The return value is of the form
266 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP)
267The `posn-' functions access elements of such lists."
268 (nth 1 event))
269
270(defsubst event-end (event)
271 "Return the ending location of EVENT. EVENT should be a click or drag event.
272If EVENT is a click event, this function is the same as `event-start'.
273The return value is of the form
274 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP)
275The `posn-' functions access elements of such lists."
276 (nth (1- (length event)) event))
277
278(defsubst posn-window (position)
279 "Return the window in POSITION.
280POSITION should be a list of the form
281 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP)
282as returned by the `event-start' and `event-end' functions."
283 (nth 0 position))
284
285(defsubst posn-point (position)
286 "Return the buffer location in POSITION.
287POSITION should be a list of the form
288 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP)
289as returned by the `event-start' and `event-end' functions."
290 (nth 1 position))
291
292(defsubst posn-col-row (position)
293 "Return the row and column in POSITION.
294POSITION should be a list of the form
295 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP)
296as returned by the `event-start' and `event-end' functions."
297 (nth 2 position))
298
299(defsubst posn-timestamp (position)
300 "Return the timestamp of POSITION.
301POSITION should be a list of the form
302 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP)
303nas returned by the `event-start' and `event-end' functions."
304 (nth 3 position))
305
255(defmacro save-match-data (&rest body) 306(defmacro save-match-data (&rest body)
256 "Execute the BODY forms, restoring the global value of the match data." 307 "Execute the BODY forms, restoring the global value of the match data."
257 (let ((original (make-symbol "match-data"))) 308 (let ((original (make-symbol "match-data")))