help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: foucs-in-hook uses the last tty no the current.


From: Eli Zaretskii
Subject: Re: foucs-in-hook uses the last tty no the current.
Date: Thu, 24 Nov 2016 21:35:38 +0200

> Date: Wed, 23 Nov 2016 20:29:51 -0800 (PST)
> From: Shiyao Ma <address@hidden>
> 
> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]