Function: system-sleep-block-sleep

system-sleep-block-sleep is an autoloaded and byte-compiled function defined in system-sleep.el.gz.

Signature

(system-sleep-block-sleep &optional WHY ALLOW-DISPLAY-SLEEP)

Documentation

Inhibit system idle sleep.

Optional WHY is a string that identifies a sleep block to system utility commands that inspect system-wide blocks. WHY defaults to "Emacs".

Optional ALLOW-DISPLAY-SLEEP, when non-nil, allows the display to sleep or a screen saver to run while the system idle sleep is blocked. The default is to keep the display active.

Return a sleep blocking token. You must retain this value and provide it to system-sleep-unblock-sleep to unblock its associated block.

Return nil if system sleep cannot be inhibited.

Note: All active blocks are released when the Emacs process dies. Despite this, you should unblock your blocks when your processing is complete. See with-system-sleep-block for an easy way to do that.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/system-sleep.el.gz
;;;###autoload
(defun system-sleep-block-sleep (&optional why allow-display-sleep)
  "Inhibit system idle sleep.
Optional WHY is a string that identifies a sleep block to system utility
commands that inspect system-wide blocks.  WHY defaults to \"Emacs\".

Optional ALLOW-DISPLAY-SLEEP, when non-nil, allows the display to sleep
or a screen saver to run while the system idle sleep is blocked.  The
default is to keep the display active.

Return a sleep blocking token.  You must retain this value and provide
it to `system-sleep-unblock-sleep' to unblock its associated block.

Return nil if system sleep cannot be inhibited.

Note: All active blocks are released when the Emacs process dies.
Despite this, you should unblock your blocks when your processing is
complete.  See `with-system-sleep-block' for an easy way to do that."
  (when system-sleep--back-end
    (system-sleep--block-sleep (or why "Emacs") allow-display-sleep)))