Emacs: Save/Restore Opened Files, Windows Configuration: desktop-mode
desktop-save-mode. When on, it save and restore all previously opened files in last emacs session, and also previous windows configuration (size, position, …)
Put this in your emacs init file:
;; save/restore opened files and windows config (desktop-save-mode 1) ; 0 for off
Starting Emacs Without Opening Last Session's Files
To start emacs without opening last session's files, start it by:
This is useful because sometimes you have a corrupted desktop file. (you can also delete it)
Desktop File Path Location
By default, the temp file used by emacs to store your “desktop” status is at
The desktop file path is controlled by the variable desktop-dirname and desktop-base-file-name.
describe-variable, type “desktop-”, then press Tab, to see all desktop mode's variables.
customize-group type “desktop”, to set preferences.
〔►see Emacs: M-x customize Tutorial〕
desktop-save-mode Changes in Emacs 24.4
In emacs 24.4: new variable desktop-save.
t, desktop are automatically saved when you quit.
In emacs 24.4: new variable desktop-auto-save-timeout. Default value is
30 (seconds). It specifies the time interval to periodically save “desktop”. Before, it saves only when you quit emacs.
In emacs 24.4: New variable desktop-restore-frames. Default value is t. When t, save and restore the frame and window configuration.
More options for restoring windows, see: desktop-restore-in-current-display, desktop-restore-reuses-frames, desktop-restore-forces-onscreen
describe-variable to see a variable's value and documentation.