GNU bug report logs - #63620
30.0.50; [Feature Request] run hooks on sleep/wake

Previous Next

Package: emacs;

Reported by: Andrew Cohen <acohen <at> ust.hk>

Date: Sat, 20 May 2023 23:25:02 UTC

Severity: wishlist

Tags: patch

Found in version 30.0.50

Full log


View this message in rfc822 format

From: Andrew Cohen <acohen <at> ust.hk>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 63620 <at> debbugs.gnu.org, michael.albinus <at> gmx.de, monnier <at> iro.umontreal.ca
Subject: bug#63620: 30.0.50; [Feature Request] run hooks on sleep/wake
Date: Wed, 05 Feb 2025 21:27:13 +0800
>>>>> "AC" == Andrew Cohen <acohen <at> ust.hk> writes:

[...]

    AC> So how exactly do I add a new sleep-event to the C source? I
    AC> tried copying how its done for dbus-event in keyboard.c and
    AC> termhooks.h (I'm only trying to create such an event in lisp so
    AC> I didn't worry about generating such an event in C). Is this
    AC> right? And do I always have to install the handler in the global
    AC> keymap (just to test this I tried pushing an existing dbus-event
    AC> onto unread-command-events, and also get "dbus-event is
    AC> undefined" unless I install a handler on the global keymap. So
    AC> it seems that I do. I also notice that other special events,
    AC> like delete-frame, have handlers installed in both the global
    AC> keymap and the special-event-map).

And maybe answering my own questions:

According the the elisp manual special events "cannot be unread with
‘unread-command-events’". Not sure exactly what this means (and I
haven't yet read the code to figure it out) but it certainly appears
that special events can't trigger a function bound in special-event-map
by pushing an event onto unread-command-events. But that's probably OK,
since we can /also/ bind the handler to the special event in the global
keymap, as is done for several of the existing special events
(delete-frame, make-frame-visible, iconify-frame). Then we can trigger
the event directly in C by generating the special event, or
synthetically in Lisp by pushing onto unread-command-events. 

I'll assume that this is OK unless I hear otherwise and make changes to
the package accordingly.

Best,
Andy
-- 
Andrew Cohen




This bug report was last modified 131 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.