diff options
| -rw-r--r-- | lisp/subr.el | 53 |
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. | ||
| 262 | If EVENT is a mouse press or a mouse click, this returns the location | ||
| 263 | of the event. | ||
| 264 | If EVENT is a drag, this returns the drag's starting position. | ||
| 265 | The return value is of the form | ||
| 266 | (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP) | ||
| 267 | The `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. | ||
| 272 | If EVENT is a click event, this function is the same as `event-start'. | ||
| 273 | The return value is of the form | ||
| 274 | (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP) | ||
| 275 | The `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. | ||
| 280 | POSITION should be a list of the form | ||
| 281 | (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP) | ||
| 282 | as 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. | ||
| 287 | POSITION should be a list of the form | ||
| 288 | (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP) | ||
| 289 | as 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. | ||
| 294 | POSITION should be a list of the form | ||
| 295 | (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP) | ||
| 296 | as 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. | ||
| 301 | POSITION should be a list of the form | ||
| 302 | (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP) | ||
| 303 | nas 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"))) |