Function: midnight-mode

midnight-mode is an autoloaded, interactive and byte-compiled function defined in midnight.el.gz.

Signature

(midnight-mode &optional ARG)

Documentation

Non-nil means run midnight-hook at midnight.

This is a global minor mode. If called interactively, toggle the Midnight mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate (default-value \=midnight-mode)'.

The mode's hook is called both when the mode is enabled and when it is disabled.

View in manual

Probably introduced at or before Emacs version 20.3.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/midnight.el.gz
;;;###autoload
(define-minor-mode midnight-mode
  "Non-nil means run `midnight-hook' at midnight."
  :global t
  :initialize #'custom-initialize-default
  ;; Disable first, since the ':initialize' function above already
  ;; starts the timer when the mode is turned on for the first time,
  ;; via setting 'midnight-delay', which calls 'midnight-delay-set',
  ;; which starts the timer.
  (when (timerp midnight-timer) (cancel-timer midnight-timer))
  (if midnight-mode (timer-activate midnight-timer)))