Function: with-system-sleep-block

with-system-sleep-block is an autoloaded macro defined in system-sleep.el.gz.

Signature

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

Documentation

Execute the forms in BODY while blocking system sleep.

The optional arguments WHY and ALLOW-DISPLAY-SLEEP have the same meaning as in system-sleep-block-sleep, which see. The block is unblocked when BODY completes.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/system-sleep.el.gz
;;;###autoload
(defmacro with-system-sleep-block (&optional why allow-display-sleep &rest body)
  "Execute the forms in BODY while blocking system sleep.
The optional arguments WHY and ALLOW-DISPLAY-SLEEP have the same meaning
as in `system-sleep-block-sleep', which see.
The block is unblocked when BODY completes."
  (declare (indent 1) (debug t))
  (let ((token (make-symbol "--sleep-token--")))
    `(let ((,token (system-sleep-block-sleep ,why ,allow-display-sleep)))
       (unwind-protect
           (progn
             ,@body)
         (system-sleep-unblock-sleep ,token)))))