unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35238: 27.0.50; Clarify eventp behaviour with booleans
@ 2019-04-11 22:42 Basil L. Contovounesios
  2019-04-11 23:42 ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Basil L. Contovounesios @ 2019-04-11 22:42 UTC (permalink / raw
  To: 35238; +Cc: Stefan Monnier

[-- Attachment #1: Type: text/plain, Size: 347 bytes --]

Severity: minor
Tags: patch

As mentioned in a past commit[1], nil is not an event.
Since the car of a mouse click event is considered its type,
shouldn't (nil) also be rejected as an event?

  (eventp '(nil)) ; => t

Should t be counted as an event?

  (eventp t)    ; => t
  (eventp '(t)) ; => t

If not, would the following change be welcome?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: eventp.diff --]
[-- Type: text/x-diff, Size: 817 bytes --]

diff --git a/lisp/subr.el b/lisp/subr.el
index bdf98979c4..8c4df5bc6c 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1227,12 +1227,14 @@ listify-key-sequence
 			  c)))
 	    key)))
 
-(defun eventp (obj)
-  "True if the argument is an event object."
-  (when obj
-    (or (integerp obj)
-        (and (symbolp obj) obj (not (keywordp obj)))
-        (and (consp obj) (symbolp (car obj))))))
+(defun eventp (object)
+  "Return non-nil if OBJECT is an input event or event object."
+  (or (integerp object)
+      (and (symbolp (if (consp object)
+                        (setq object (car object))
+                      object))
+           (not (booleanp object))
+           (not (keywordp object)))))
 
 (defun event-modifiers (event)
   "Return a list of symbols representing the modifier keys in event EVENT.

[-- Attachment #3: Type: text/plain, Size: 532 bytes --]


[1: e18941095a]: * lisp/term/x-win.el (x-menu-bar-open): ...
  2012-08-10 10:47:12 -0400
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=e18941095a56075d6eb908a65aafcd1697fea2ae

Thanks,

-- 
Basil

In GNU Emacs 27.0.50 (build 9, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2019-04-11 built on thunk
Repository revision: 0627a8d7bc6ffa29d7a503fd36e760778ecb9fa1
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12003000
System Description: Debian GNU/Linux buster/sid

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-05-07 17:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-11 22:42 bug#35238: 27.0.50; Clarify eventp behaviour with booleans Basil L. Contovounesios
2019-04-11 23:42 ` Stefan Monnier
2019-04-12 11:11   ` Basil L. Contovounesios
2019-04-12 12:25     ` Stefan Monnier
2019-04-12 12:30     ` Eli Zaretskii
2019-04-13 17:53       ` Basil L. Contovounesios
2019-04-14  3:13         ` Stefan Monnier
2019-04-22 23:19           ` Basil L. Contovounesios
2019-04-23  2:06             ` Stefan Monnier
2019-05-07 17:08               ` Basil L. Contovounesios

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).