Function: system-sleep--sleep-event-handler

system-sleep--sleep-event-handler is an interactive and byte-compiled function defined in system-sleep.el.gz.

Signature

(system-sleep--sleep-event-handler EVENT)

Documentation

Handle <sleep-event> special events and avoid races.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/system-sleep.el.gz
(defun system-sleep--sleep-event-handler (event)
  "Handle <sleep-event> special events and avoid races."
  (declare (completion ignore))
  (interactive "e")
  ;; Queue incoming event.
  (setq system-sleep--event-queue
        (append system-sleep--event-queue (list event)))
  ;; If an event is already in progress, return right away.
  ;; Otherwise, process queued events.
  (while (and (not system-sleep--event-in-progress)
              system-sleep--event-queue)
    (let ((current-event (pop system-sleep--event-queue)))
      (setq system-sleep--event-in-progress current-event)
      (unwind-protect
          (progn
            (run-hook-with-args 'system-sleep-event-functions
                                current-event)
            (run-hook-with-args 'system-sleep--event-after-hook-functions
                                current-event))
        (setq system-sleep--event-in-progress nil)))))