Subject: bug#63620: 30.0.50; [Feature Request] run hooks on sleep/wake

From: Eli Zaretskii <[email-masked]>
Date: Wed, 05 Feb 2025 22:21:55 +0200

> From: Stefan Monnier <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked],
>   [email-masked]
> Date: Wed, 05 Feb 2025 13:21:41 -0500
> 
> >> According the the elisp manual special events "cannot be unread with
> >> ‘unread-command-events’".
> > Oh, right!  So pushing to `unread-command-events` will only work if the
> > binding is made in a normal map.  That's not the end of the world, but
> > it's not ideal.  E.g. it doesn't really make sense to have the behavior
> > depend on the mode of the current buffer, and it seems undesirable to
> > fail to run the binding if you happened to type `C-x` just
> > before sleeping.
> 
> Maybe a hook is not such a bad idea after all.

But then how would platforms where these events come from the
window-system call that hook?  We'd need two different mechanisms for
the same feature, and two different ways of calling user-defined
functions when the event comes in.  Or what am I missing?