changeset 55520:30d4272bcc4b

(eventp): Be more discriminating with integers.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 11 May 2004 03:17:45 +0000
parents 0224aadaa92f
children ea0f46cadeb2
files lisp/subr.el
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Mon May 10 22:08:58 2004 +0000
+++ b/lisp/subr.el	Tue May 11 03:17:45 2004 +0000
@@ -629,7 +629,11 @@
 
 (defsubst eventp (obj)
   "True if the argument is an event object."
-  (or (integerp obj)
+  (or (and (integerp obj)
+	   ;; Filter out integers too large to be events.
+	   ;; M is the biggest modifier.
+	   (zerop (logand obj (lognot (1- (lsh ?\M-\^@ 1)))))
+	   (char-valid-p (event-basic-type obj)))
       (and (symbolp obj)
 	   (get obj 'event-symbol-elements))
       (and (consp obj)