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).

This is a 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.

When Desktop Save mode is enabled, the state of Emacs is saved from one session to another. In particular, 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.

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.  In particular, 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
  :group 'desktop
  (if desktop-save-mode
      (desktop-auto-save-enable)
    (desktop-auto-save-disable)))