all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: foucs-in-hook uses the last tty no the current.
Date: Thu, 24 Nov 2016 21:35:38 +0200	[thread overview]
Message-ID: <831sy06585.fsf@gnu.org> (raw)
In-Reply-To: <b2f00a02-626f-480e-bde0-cd7f43fb7571@googlegroups.com> (message from Shiyao Ma on Wed, 23 Nov 2016 20:29:51 -0800 (PST))

> Date: Wed, 23 Nov 2016 20:29:51 -0800 (PST)
> From: Shiyao Ma <i@introo.me>
> 
> In emacs25, I found 'focus-in-hook uses the last focus-ed tty, not the to be focus-ed tty.
> For example,
> (add-hook 'focus-in-hook (lambda () (princ (terminal-name))))
> 
> It will print the last focus-ed tty.

terminal-name is documented to return the name of the terminal of the
selected frame, so I don't think you can assume it will return the
terminal of the frame which _will_ be selected after the focus-in
event is processed.

> This is semantically wrong and makes this hook not useful at all, (we already have 'foucs-out-hook).

focus-in-hook is useful for doing something when Emacs gets focus, not
necessarily related to the frame which was or will be the selected
frame.  For example, blink-cursor-mode uses this hook just fine.

It sounds like you want to use some other hook or feature for your
purpose.  Did you try to bind your function to the switch-frame
pseudo-key, for example?



      reply	other threads:[~2016-11-24 19:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-24  4:29 foucs-in-hook uses the last tty no the current Shiyao Ma
2016-11-24 19:35 ` Eli Zaretskii [this message]

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

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

  git send-email \
    --in-reply-to=831sy06585.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.