Emacs: desktop-save-mode without the automatic restore 3 ▲ Srijan Choudhary, all posts 108 days ago · Tech · hide · Fediverse post Emacs has a built-in way to save and restore sessions: the desktop.el library. As the Emacs manual says, putting this in the init file enables automatic save and restore of sessions: (desktop-save-mode 1) But, I wanted a different behavior: Automatically save the session But don't restore it automatically I wanted to only use the session feature to restore sessions that I closed by mistake, or where I forgot to finish something before quitting Emacs. By default, I wanted a fresh session every time. But this also means that some session history has to be maintained; otherwise, a fresh session will start to write to the desktop file and then I will not be able to recover the old session. By default, the way to do this is to not set desktop-save-mode, but manually call desktop-save when needed, and then call desktop-read when needed. But, if I forget to save, I cannot restore. This elisp is what I came up with to make it work the way I want: (defvar my/desktop-snapshot-keep 5 "How many… Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town