From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chris Feng Newsgroups: gmane.emacs.devel Subject: Re: [elpa] externals/exwm 0b8a373: Fix a `unread-command-events' issue for Emacs 24 Date: Fri, 15 Jul 2016 09:03:23 +0800 Message-ID: References: <20160715001351.14660.27588@vcs.savannah.gnu.org> <20160715001351.9FD2C22014B@vcs.savannah.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1468544648 26025 80.91.229.3 (15 Jul 2016 01:04:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 Jul 2016 01:04:08 +0000 (UTC) Cc: emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 15 03:04:07 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bNrXy-0005Bk-1t for ged-emacs-devel@m.gmane.org; Fri, 15 Jul 2016 03:04:06 +0200 Original-Received: from localhost ([::1]:57695 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNrXx-0000Xx-53 for ged-emacs-devel@m.gmane.org; Thu, 14 Jul 2016 21:04:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNrXK-0000Pn-GR for emacs-devel@gnu.org; Thu, 14 Jul 2016 21:03:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNrXJ-0002N7-Gy for emacs-devel@gnu.org; Thu, 14 Jul 2016 21:03:26 -0400 Original-Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:36644) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNrXJ-0002Mo-9F for emacs-devel@gnu.org; Thu, 14 Jul 2016 21:03:25 -0400 Original-Received: by mail-wm0-x244.google.com with SMTP id x83so635226wma.3 for ; Thu, 14 Jul 2016 18:03:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=/pAAPyQkj/HqZHTZ8acW9PSNXhg/MiMBZYbRkEXVwsw=; b=ficIQq/HGvLwv/4eWEvnGhblRddxsUY4CnitRKxQTPZ9RVjk5LXMF828GVgswjxJAN 8ijTb+EFECYc2ohpdfqvKU4D1c0bESoK8sKY8TXz4aHfRnBMOnJe/1XAfYamWqSLEwlS 9YNDaSzG9KBkZMB7xbSfuuN/cSZEFgxjJyc+9DqiotFvr5GKole4kz0jSsslTDStjoBm SI4Y7vpfkybZ47GzfJfqtVZT6iic9oi3uj3Aj2yQJBqC3lTL7fD2qdg8TYo7Dw+IfYoG J37cc6RlwDrSn0T48xHMexzvlIaJjzp41TZIqjfmdnmbqktNF5+cKdACuTqujjUj48XX oCcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/pAAPyQkj/HqZHTZ8acW9PSNXhg/MiMBZYbRkEXVwsw=; b=BrontjbldGAFKvde6E+t17HTRBcgGTI1QuFl5ubk27Q98/abPx+loDCaY3wKMyBgvG NIE5dyEMhtuclTFYbgOI9gIUex1RVrAuJVr19Tp58s84/ZeSbyaQeHksosdpLBNNPoRc XKHKTLTcbZOLeUn7pUNhwMT7HG+kUiSdPyo6bukDVhYq5MZZqmj0PnKzW/sNQRsANFMT 400usLTu4dWLFAGueOccd5Bg9q6Oa0DEkG9GQahSyoNUpmR44eZqH2kOxiHZlrSVg4qe zC4lgCtXtw7ZjSHVeez1bHjlOtCrFiGonAjvrwe2txXRm1sp1q5kWl7nlI3wfAxejApo I7JA== X-Gm-Message-State: ALyK8tKlhi0wvu0B5BQQDxoOjsER3gU6cZCKCTVKS4+LDhZJuS9zJmZlh6J0+L47GljkQlTYHMTT+Ozz8bMcwA== X-Received: by 10.28.125.80 with SMTP id y77mr18853342wmc.25.1468544604506; Thu, 14 Jul 2016 18:03:24 -0700 (PDT) Original-Received: by 10.194.97.20 with HTTP; Thu, 14 Jul 2016 18:03:23 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::244 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:205694 Archived-At: >> +(eval-and-compile >> + (if (< emacs-major-version 25) >> + (defsubst exwm-input--unread-event (event) >> + (setq unread-command-events >> + (append unread-command-events (list event)))) >> + (defsubst exwm-input--unread-event (event) >> + (setq unread-command-events >> + (append unread-command-events `((t . ,event))))))) > > This ends up choosing the version of the code at the time it's compiled > rather than at the time it's executed (since this is a defsubst and the > version chosen at compile time will end up being inlined everywhere). > > I'd advise against using defsubst here (performance is probably of no > importance compared to the time it will take to process the event). My concern was that the function would get called very frequently (on every key event in certain circumstances) so I made them inline. As for your the problem you pointed out, my understanding is that bytecodes for Emacs 24 and 25 are largely not compatible, at least for this package which heavily relies on EIEIO. So even if we can choose between the two functions at run time the compiled code still won't run correctly. > and while I'm here, I wonder why you use `append` instead of `push`, > i.e. why you add the event to the end rather than to the beginning of > the queue. > > The content of the queue is "the event we haven't processed yet", so in > order to do something akin to rerunning the current event, you usually > want to put at the beginning of the queue. The events are received directly from X server (rather than Emacs) in chronological order so I think it makes sense to append them to `unread-command-events', in case previous events added not processed timely. Also there're related bugs with `unread-command-events' (bug#23980). Could you take a look? I hope it's not too late to fix them for emacs-25. Chris