Function: display-time-mode
display-time-mode is an autoloaded, interactive and byte-compiled
function defined in time.el.gz.
Signature
(display-time-mode &optional ARG)
Documentation
Toggle display of time, load level, and mail flag in mode lines.
This is a minor mode. If called interactively, toggle the
Display-Time 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 \=display-time-mode)'.
The mode's hook is called both when the mode is enabled and when it is disabled.
When Display Time mode is enabled, it updates every minute (you
can control the number of seconds between updates by customizing
display-time-interval). If display-time-day-and-date is
non-nil, the current day and date are displayed as well. This
runs the normal hook display-time-hook after each update.
Probably introduced at or before Emacs version 28.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/time.el.gz
;;;###autoload
(define-minor-mode display-time-mode
"Toggle display of time, load level, and mail flag in mode lines.
When Display Time mode is enabled, it updates every minute (you
can control the number of seconds between updates by customizing
`display-time-interval'). If `display-time-day-and-date' is
non-nil, the current day and date are displayed as well. This
runs the normal hook `display-time-hook' after each update."
:global t :group 'display-time
(and display-time-timer (cancel-timer display-time-timer))
(setq display-time-timer nil)
(setq display-time-string "")
(or global-mode-string (setq global-mode-string '("")))
(setq display-time-load-average display-time-default-load-average)
(if display-time-mode
(progn
(or (memq 'display-time-string global-mode-string)
(setq global-mode-string
(append global-mode-string '(display-time-string))))
;; Set up the time timer.
(setq display-time-timer
(run-at-time t display-time-interval
'display-time-event-handler))
;; Make the time appear right away.
(display-time-update)
;; When you get new mail, clear "Mail" from the mode line.
(add-hook 'rmail-after-get-new-mail-hook
'display-time-event-handler))
(remove-hook 'rmail-after-get-new-mail-hook
'display-time-event-handler)))