From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.bugs Subject: bug#35238: 27.0.50; Clarify eventp behaviour with booleans Date: Fri, 12 Apr 2019 12:11:01 +0100 Message-ID: <87y34fscl6.fsf@tcd.ie> References: <87pnpsp3jd.fsf@tcd.ie> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="12331"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 35238@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Apr 12 13:12:15 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hEu6Q-00035b-Nb for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Apr 2019 13:12:14 +0200 Original-Received: from localhost ([127.0.0.1]:34411 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEu6P-000477-Iu for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Apr 2019 07:12:13 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEu6F-00045o-Pp for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2019 07:12:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hEu6E-0004sU-Sm for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2019 07:12:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41968) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hEu6E-0004sN-Iz for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2019 07:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hEu6E-0004gB-Dg for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2019 07:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Apr 2019 11:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35238 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 35238-submit@debbugs.gnu.org id=B35238.155506747117930 (code B ref 35238); Fri, 12 Apr 2019 11:12:02 +0000 Original-Received: (at 35238) by debbugs.gnu.org; 12 Apr 2019 11:11:11 +0000 Original-Received: from localhost ([127.0.0.1]:55512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hEu5P-0004f8-4O for submit@debbugs.gnu.org; Fri, 12 Apr 2019 07:11:11 -0400 Original-Received: from mail-ed1-f44.google.com ([209.85.208.44]:40957) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hEu5N-0004et-2S for 35238@debbugs.gnu.org; Fri, 12 Apr 2019 07:11:09 -0400 Original-Received: by mail-ed1-f44.google.com with SMTP id d46so3171696eda.7 for <35238@debbugs.gnu.org>; Fri, 12 Apr 2019 04:11:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=zHMg20rTE4RfySz+MwdNl6SBDv7AVlfIduLUNWMpAWI=; b=xAxS2qkgWk9//gHHysvpfAADRrVcz7Ne3FVtZeYr60Wq5eSx2B5yVTC30DjrO/Xgfm oa+2QAEftlivJ+0FJVYsp7YQi0SsAZuaHOXfgIsGtAxDi+kqnFoZlPej1qjB4+gnM+Gf TRWzOzxowiHmFnuLO9xUPbk8MIGLRq2+P/r8VOYiytKhq2gfiIjkAmsN7yNSgYSdvqvk DE35PoziglkOfmuYw5OW5P+DVpIrR3HAUmFJNockJG4gCyZZgyrFyjHV2C1FeOUH+ONl cSwxEwkP76qUO8zgAtK+VfIOQh4TxPGMsvmldX0ZseJ6N5js6msNeCaFIUAtOaZDJUGZ yCag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=zHMg20rTE4RfySz+MwdNl6SBDv7AVlfIduLUNWMpAWI=; b=lccVecyPgVBZL3albdAO4aMOFJ7KKmUq9wvNpDfQVstg7590gxeZRxTJjdAglhhELH MjG0au1r8C4AMae7DSDFkD2RAA24AuegYFbLXN0lU9ckkCGs35aER1YRw+iqnCm6cj7y XqVCXrZ/oMZ0OuDb5dMkgIY7xJAa9XUPca0BN21CaYyK/VvqQ3WZu2JebFe0nluihwUy 3Mek4xW/aF6LoYCVOfmmZTfnpfJav+A1KN8OsFjJUsR/Gkrm87jCf9TJKLcCZwmAoRyt u6gKQhteoWZq7ofSozETXbqk3bEbf1KNVkPrNvZIb07bIHBcUJ6ZUKyZny72jKxvlt9a Yrvw== X-Gm-Message-State: APjAAAVZLtg8bfFtXgp8rtF5mnnJ0J2V5T+V0TTmm0RYZsFIo0QhI0gD ukYdeHZlgCe3FyxRfbh2DQDnZ0dADYa7xvzO X-Google-Smtp-Source: APXvYqzdX5Na9O3WLoE0lRltKk6ituMa8TpoCPma5HFxe6Rw2WQXBIMMobIdmpFOzRpZtFRip8LQSg== X-Received: by 2002:aa7:c383:: with SMTP id k3mr26879377edq.137.1555067463423; Fri, 12 Apr 2019 04:11:03 -0700 (PDT) Original-Received: from localhost ([2a02:8084:20e2:c380:f786:805d:f4ab:1006]) by smtp.gmail.com with ESMTPSA id i91sm4228834edd.72.2019.04.12.04.11.02 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 12 Apr 2019 04:11:02 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Thu, 11 Apr 2019 19:42:46 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:157544 Archived-At: --=-=-= Content-Type: text/plain Stefan Monnier writes: >> 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? > > Not sure it's worth the trouble (there are already lots of other objects > that aren't events but for which eventp returns non-nil). Sure, but the following would at least make eventp treat nil consistently: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=eventp.diff diff --git a/lisp/subr.el b/lisp/subr.el index bdf98979c4..407bd6379d 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1227,12 +1227,13 @@ 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 (keywordp object))))) (defun event-modifiers (event) "Return a list of symbols representing the modifier keys in event EVENT. --=-=-= Content-Type: text/plain >> Should t be counted as an event? >> >> (eventp t) ; => t >> (eventp '(t)) ; => t > > Not sure if we ever generate such an event, but what would be the > benefit of rejecting it? I don't know, it could even be detrimental; I was just curious. Thanks, -- Basil --=-=-=--