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

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

Re: Ignore spurious focus events for ‘after-focus-change-function’


From: Eli Zaretskii
Subject: Re: Ignore spurious focus events for ‘after-focus-change-function’
Date: Sat, 16 Jan 2021 09:02:00 +0200

> From: Andrea Greselin <greselin.andrea@gmail.com>
> Date: Fri, 15 Jan 2021 21:26:32 +0100
> 
> My question is, how do I "'debounce' any user-visible updates arising
> from focus changes"? I made a couple of attempts, with
> 
>   (defun focus-test ()
>     (sit-for 0)
>     (message "ffs: %s" (frame-focus-state)))
> 
> and
> 
>   (defun payload (_window)
>     (message "ffs: %s" (frame-focus-state))
>     (remove-hook 'pre-redisplay-functions #'payload))
>   (defun focus-test ()
>     (add-hook 'pre-redisplay-functions #'payload))
>   (add-function :after after-focus-change-function #'focus-test)
> 
> but it didn't work.

What do you want to accomplish, and how did it not work?

In any case, I very much doubt that "deferring work until redisplay"
meant that you should _trigger_ redisplay by calling sit-for.  It
probably meant running your code from some hook called by redisplay,
or something similar.



reply via email to

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