< (cancel-timer 'midnight-timer)
> (cancel-timer midnight-timer)
Midnight mode is a package by SamSteingold? that comes with Emacs for running configured actions at every “midnight”.
By default, the
‘midnight-hook’ is configured to just run the CleanBufferList command.
‘M-x customize-group RET midnight RET’ to configure and easily turn on Midnight mode.
To use Midnight mode, it needs to be included with
It also needs to be enabled with the function
‘midnight-delay-set’ which also defines “midnight”.
(midnight-delay-set 'midnight-delay "4:30am")
Some people use the number of seconds after midnight:
(midnight-delay-set 'midnight-delay 16200) ;; (eq (* 4.5 60 60) "4:30am")
To add other actions to be run at midnight, add to the hook
(add-hook 'midnight-hook (lambda (with-current-buffer "*cvs*" (call-interactively 'cvs-update)))) (add-hook 'midnight-hook 'calendar)
You can disable midnight mode with
If you want to have “midnight” occur multiple times a day, you can change the
‘midnight-period’ from 24 hours to something else.
(setq midnight-period 7200) ;; (eq (* 2 60 60) "2 hours")
As of 2009-10-02, DeskTop mode does not preserve the value of
‘buffer-display-time’ for buffers, so the buffer’s “age” is effectively restarted. This means that buffers restored by a Desktop sessions are considered “new” by CleanBufferList, even though they may be considered “old”.