UP | HOME

Save current Emacs session without any extra package

Use the built-in desktop-save and desktop-read to save and reload your current Emacs session quickly, note that all frames and buffers will be saved as well.

When you need to save, run M-x desktop-save. And when you need to restore, run M-x desktop-read.

You can bind some shortcut to these command if you want:

(global-set-key (kbd "C-c w s") 'desktop-save)
(global-set-key (kbd "C-c w r") 'desktop-read)

If you want Emacs automatically save your session when you quit and load it when you start again, set desktop-save-mode on:

(desktop-save-mode 1)

As said, all frames will be saved, which I find very helpful, because my workflow needs to spawn many frames. If you don't want frames being saved, set desktop-restore-frames to nil.

Date: 2019-04-04 Thu 00:00

Author: Huy Tran

Created: 2019-04-22 Mon 14:41