6

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
  • 284
  • 1
  • 18

1 Answers1

9

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
  • 498,455