Function: desktop-save-mode
desktop-save-mode is an autoloaded, interactive and byte-compiled
function defined in desktop.el.gz.
Signature
(desktop-save-mode &optional ARG)
Documentation
Toggle desktop saving (Desktop Save mode).
When Desktop Save mode is enabled, the state of Emacs is saved from one session to another. The saved Emacs "desktop configuration" includes the buffers, their file names, major modes, buffer positions, window and frame configuration, and some important global variables.
To enable this feature for future sessions, customize desktop-save-mode(var)/desktop-save-mode(fun)
to t, or add this line in your init file:
(desktop-save-mode 1)
When this mode is enabled, Emacs will save the desktop when it exits
(this may prompt you, see the option desktop-save(var)/desktop-save(fun)). The next time
Emacs starts, if this mode is active it will restore the desktop.
To manually save the desktop at any time, use the command M-x desktop-save (desktop-save).
To load it, use M-x desktop-read (desktop-read).
Once a desktop file exists, Emacs will auto-save it according to the
option desktop-auto-save-timeout.
To see all the options you can set, browse the desktop customization group.
For further details, see info node (emacs)Saving Emacs Sessions.
This is a global minor mode. If called interactively, toggle the
Desktop-Save 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 \=desktop-save-mode)'.
The mode's hook is called both when the mode is enabled and when it is disabled.
Probably introduced at or before Emacs version 22.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/desktop.el.gz
;;;###autoload
(define-minor-mode desktop-save-mode
"Toggle desktop saving (Desktop Save mode).
When Desktop Save mode is enabled, the state of Emacs is saved from one
session to another. The saved Emacs \"desktop configuration\" includes the
buffers, their file names, major modes, buffer positions, window and frame
configuration, and some important global variables.
To enable this feature for future sessions, customize `desktop-save-mode'
to t, or add this line in your init file:
(desktop-save-mode 1)
When this mode is enabled, Emacs will save the desktop when it exits
\(this may prompt you, see the option `desktop-save'). The next time
Emacs starts, if this mode is active it will restore the desktop.
To manually save the desktop at any time, use the command \\[desktop-save].
To load it, use \\[desktop-read].
Once a desktop file exists, Emacs will auto-save it according to the
option `desktop-auto-save-timeout'.
To see all the options you can set, browse the `desktop' customization group.
For further details, see info node `(emacs)Saving Emacs Sessions'."
:global t
(if desktop-save-mode
(desktop-auto-save-enable)
(desktop-auto-save-disable)))