From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: dancol@dancol.org Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 6fdc3fa: Support terminal focus notifications Date: Sat, 9 Jun 2018 13:19:54 -0700 Message-ID: References: <20180609055212.3056.85949@vcs0.savannah.gnu.org> <20180609055213.B7E0920498@vcs0.savannah.gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1528575519 26716 195.159.176.226 (9 Jun 2018 20:18:39 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 9 Jun 2018 20:18:39 +0000 (UTC) User-Agent: SquirrelMail/1.4.23 [SVN] Cc: Daniel Colascione , Stefan Monnier , emacs-devel@gnu.org To: dancol@dancol.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jun 09 22:18:35 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fRkJm-0006lc-I2 for ged-emacs-devel@m.gmane.org; Sat, 09 Jun 2018 22:18:35 +0200 Original-Received: from localhost ([::1]:41391 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRkLo-0006F6-E3 for ged-emacs-devel@m.gmane.org; Sat, 09 Jun 2018 16:20:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRkL8-0006Em-5y for emacs-devel@gnu.org; Sat, 09 Jun 2018 16:19:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRkL7-0007nK-7I for emacs-devel@gnu.org; Sat, 09 Jun 2018 16:19:58 -0400 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:44438) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRkL6-0007mM-UW for emacs-devel@gnu.org; Sat, 09 Jun 2018 16:19:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:To:From:Subject:Date:References:In-Reply-To:Message-ID; bh=EggEwvRMkoU2akxQoDgFdf/eLRi0zmGOEYOaCz0PwPo=; b=cF24gHRe5nKbsSPoPsqXhXiUvARIMu3dvY0hBBCrZu2RCxHQMfkb2JQjc9XMonSigadZt/N62b2UfgjscCrQV6nYrpVPyceLtmu1QfMcSOL+ZC4yoNYsLMmyt5Yl+81VNwZlBajc9eR/LYBy8cbJLkYPhL8IAtYRHvHQ5ugdpieIDOtoA53wAwmxojN3R3p8QQyAp5yr6yNc48FGJ3ta+WvpJkp08l5rZr/XHMoy9GLnH8EUo4SbMFKUTdtIFqZaWwqyqhoASI2p8ztSIQHM4r0awikvKcCHDnldjymkTx4jeJZA/5WG7rG0a4i6638wUIBXIc8qpizlmyiOnkjTPQ==; Original-Received: from localhost ([127.0.0.1] helo=dancol.org) by dancol.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fRkL4-0004Z2-DH; Sat, 09 Jun 2018 13:19:54 -0700 Original-Received: from 127.0.0.1 (SquirrelMail authenticated user dancol) by dancol.org with HTTP; Sat, 9 Jun 2018 13:19:54 -0700 In-Reply-To: X-Priority: 3 (Normal) Importance: Normal X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2600:3c01::f03c:91ff:fedf:adf3 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:226152 Archived-At: >>> +(defun xterm-handle-focus-in () >>> + (interactive) >>> + (handle-focus-in)) >>> +(defun xterm-handle-focus-out () >>> + (interactive) >>> + (handle-focus-out)) >> >> Aka >> >> (defalias 'xterm-handle-focus-in #'handle-focus-in) >> (defalias 'xterm-handle-focus-out #'handle-focus-out) >> >> right? > > handle-focus-{in,out} have an interactive specification that makes them > not work when bound directly to the synthetic event --- which seems silly, > since we never actually use the event --- but I didn't want to touch the > existing focus code. > >>> +(define-key global-map [xterm-focus-in] #'xterm-handle-focus-in) >>> +(define-key global-map [xterm-focus-out] #'xterm-handle-focus-out) >> >> I think this deserves a comment explaining why we don't use the >> pre-existing `focus-in` and `focus-out` events and why we bind our >> events in global-map rather than in special-map (as is done for >> `focus-in/out` events). > > I was being consistent with the xterm-paste event. All three events should > go in special-map if that's the right place, shouldn't they? It doesn't > seem to make a difference in this case. Thanks for pointing out this inelegance. It prompted me to do some digging and uncover a larger problem. I agree that all three events should be in special-event-map. The trouble is that only read-event consults special-event-map, and read-event doesn't do event remapping, since it handles one low-level event at a time. I've installed a change that does the moral equivalent of the special-event-map handling (but inside read-key-sequence) by abusing function bindings in the function key translation map.