Autosave / autoload content of scratch buffer in Emacs

6

2

I would like to assign a file (~/tmp/scratch) to the *scratch* buffer in Emacs.

When I open Emacs I would like ~/tmp/scratch to be opened (preferably in the buffer named *scratch*) and when Emacs is closed the content should be saved to ~/tmp/scratch.

aioobe

Posted 2012-04-16T07:18:42.133

Reputation: 374

Answers

8

See this article : How to Make Emacs' Scratch Buffer Persistent Across Sessions.

This article contains the code to put in the .emacs or .emacs.d/init.el file, which will declare the file containing the scratch buffer, load the buffer on startup and save on shutdown.

The code is a bit too voluminous to reproduce here. You should also read the comments to the article.

harrymc

Posted 2012-04-16T07:18:42.133

Reputation: 306 093