all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* foucs-in-hook uses the last tty no the current.
@ 2016-11-24  4:29 Shiyao Ma
  2016-11-24 19:35 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Shiyao Ma @ 2016-11-24  4:29 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

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.

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


Can anyone reproduce the above defect behavior?  Or am I get something wrong?



Regards.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: foucs-in-hook uses the last tty no the current.
  2016-11-24  4:29 foucs-in-hook uses the last tty no the current Shiyao Ma
@ 2016-11-24 19:35 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2016-11-24 19:35 UTC (permalink / raw)
  To: help-gnu-emacs

> 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?



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-24 19:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-24  4:29 foucs-in-hook uses the last tty no the current Shiyao Ma
2016-11-24 19:35 ` Eli Zaretskii

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.