diff lisp/subr.el @ 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 75efe89a09b7
children 093305d9b188 2ccd88cfde01
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)