Ads by Google

Wednesday, June 18, 2008

Changing the default mode of the *Scratch* buffer

The default *Scratch* buffer in Emacs starts in fundamental mode which might not be useful for lots of people who either don't know or want to work on elisp.


If text mode makes sense for you as the default, the following addition to the .emacs file should fix it.

(setq initial-major-mode 'text-mode)

Note that you don't lose much if you're trying out a few lisp forms as they can be eval'ed anywhere by hitting C-x C-e that would have the same effect as doing it in lisp mode.

3 comments:

Anonymous said...

Hi,

Your post got me on the right track, but it turned out that for me, the correct variable is:

default-major-mode

Now to find how to set default minor modes...

Best,
Chris

Anonymous said...

Correction: of course, you were right about the *scratch* buffer -I was looking to default a major mode for any new buffer I create via C-x b.

Anonymous said...

Hi,

Since this post comes up near top of search results when I search for a related topic, I thought I'd add an update:

I was able to change this setting and more through the customization feature Emacs - type M-x customize-group, then initialization, and various scratch buffer variables can be edited safely.

Thanks