unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: dancol@dancol.org
To: dancol@dancol.org
Cc: Daniel Colascione <dancol@dancol.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master 6fdc3fa: Support terminal focus notifications
Date: Sat, 9 Jun 2018 13:19:54 -0700	[thread overview]
Message-ID: <e47e93431adac5a2c8eb27429499097f.squirrel@dancol.org> (raw)
In-Reply-To: <c7238f9b25566e4b38c4ca1e119e1d5d.squirrel@dancol.org>

>>> +(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.




  parent reply	other threads:[~2018-06-09 20:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180609055212.3056.85949@vcs0.savannah.gnu.org>
     [not found] ` <20180609055213.B7E0920498@vcs0.savannah.gnu.org>
2018-06-09 15:33   ` [Emacs-diffs] master 6fdc3fa: Support terminal focus notifications Stefan Monnier
2018-06-09 15:49     ` dancol
2018-06-09 19:05       ` Stefan Monnier
2018-06-09 20:19       ` dancol [this message]
2018-06-09 23:10       ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e47e93431adac5a2c8eb27429499097f.squirrel@dancol.org \
    --to=dancol@dancol.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).