Variable: system-sleep-event-functions

system-sleep-event-functions is a customizable variable defined in system-sleep.el.gz.

Value

nil

Documentation

Abnormal hook invoked on system sleep events.

Each function is called with one argument EVENT, a sleep event. EVENT state can be retrieved via \+(sleep-event-state EVENT). It will be one of the symbols \+pre-sleep or \+post-wake.

Handling \+pre-sleep events should be done as fast as possible, do as little as possible and avoid user prompts. Systems often grant a very short pre-sleep processing interval, typically ranging between 2 and 5 seconds. The system may sleep even if your processing is not complete. For example, your function could close active connections or serial ports.

Handling \+post-wake events offers more leeway. Your function could reestablish connections.

Note: Your code, or the functions it calls, should not raise any signals or all hooks will be halted preventing other hook functions from cleaning up or waking up. You can wrap your code in a condition-case block.

This variable was added, or its default value changed, in Emacs 31.1.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/system-sleep.el.gz
;;;###autoload (autoload 'sleep-event-state "system-sleep.el")

;;;###autoload
(defcustom system-sleep-event-functions nil
  "Abnormal hook invoked on system sleep events.
Each function is called with one argument EVENT, a sleep event.  EVENT
state can be retrieved via \\+`(sleep-event-state EVENT)'.  It will be
one of the symbols \\+`pre-sleep' or \\+`post-wake'.

Handling \\+`pre-sleep' events should be done as fast as possible, do as
little as possible and avoid user prompts.  Systems often grant a very
short pre-sleep processing interval, typically ranging between 2 and 5
seconds.  The system may sleep even if your processing is not complete.
For example, your function could close active connections or serial
ports.

Handling \\+`post-wake' events offers more leeway.  Your function could
reestablish connections.

Note: Your code, or the functions it calls, should not raise any signals
or all hooks will be halted preventing other hook functions from
cleaning up or waking up.  You can wrap your code in a `condition-case'
block."
  :type 'hook
  :version "31.1")