From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Ignore spurious focus events for ‘after-focus-change-function’
Date: Sat, 16 Jan 2021 09:02:00 +0200 [thread overview]
Message-ID: <83h7nh9xg7.fsf@gnu.org> (raw)
In-Reply-To: <CAJ_oJbZb3_7EoOZJJr9nPy+W913ruH+pP-APtLQwYTkvNEY3iw@mail.gmail.com> (message from Andrea Greselin on Fri, 15 Jan 2021 21:26:32 +0100)
> 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.
next prev parent reply other threads:[~2021-01-16 7:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-15 20:26 Ignore spurious focus events for ‘after-focus-change-function’ Andrea Greselin
2021-01-16 7:02 ` Eli Zaretskii [this message]
2021-01-16 9:56 ` Andrea Greselin
2021-01-18 19:09 ` Andrea Greselin
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=83h7nh9xg7.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.