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: Michael Albinus <michael.albinus <at> gmx.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: acohen <at> ust.hk, 63620 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: bug#63620: 30.0.50; [Feature Request] run hooks on sleep/wake
Date: Thu, 06 Feb 2025 12:56:41 +0100
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

Hi Eli,

>>                                  why would those not be ale to run the
>> hook?  If it's because it's in a separate UI thread, they can push to
>> `pending_funcalls`, or in the worst case they can add an event into the
>> event queue and then use `special-event-map` to run an ad-hoc function
>> which runs the hook.
>>
>> Of course, we could similarly make the D-bus code manually do
>> (lookup-key special-event-map [sleep-event])
>
> Thanks, so which of these solutions would you recommend as the
> cleanest and the most convenient/extensible one?
>
> Michael, do you have any opinions or comments about these
> possibilities, from the D-Bus support POV?

I'm against to touch the D-Bus code because of this. Unneeded
dependency.

I've assembled a POC patch (appended), which adds the sleep-event
special event to special-event-map, and which adds a new function
insert-special-event, all on C level. With this, I'm able to eval in the
*scratch* buffer

--8<---------------cut here---------------start------------->8---
(defun sleep-handle-event (event)
  (declare (completion ignore))
  (interactive "e")
  (message "Event arrived: %S" event))

(insert-special-event '(sleep-event t))
--8<---------------cut here---------------end--------------->8---

insert-special-event is not restricted to the sleep-event event, but
shall support all special events, finally.

Comments?

Best regards, Michael.

[Message part 2 (text/x-patch, attachment)]

This bug report was last modified 130 days ago.

Previous Next


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