Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .