17

How can I make Emacs start in text-mode and get rid of the following message?

;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.

3 Answers 3

29

To get rid of the start message just set the initial-scratch-message variable to ""

(setq initial-scratch-message "")

To start the scratch buffer in text mode you will want to initial-major-mode variable

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

For setting of auto-mode when you start a specific major-mode you'll want to add an event to the mode hook

(add-hook 'text-mode-hook 'turn-on-auto-fill)
1
  • Thanks! One related question: I also want auto-fill-mode enabled on startup. I have this in my .emacs: (setq auto-fill-mode t) but the *scratch* buffer still doesn't have auto-fill-mode. How can I enable that automatically on startup?
    – Frank
    Apr 11, 2012 at 16:50
0

Rather than fiddle with the way the scratch buffer works, I'd recommend you open Emacs with a file argument. E.g. if you do "emacs foo.txt" chances are it will already start up in text-mode without you having to do anything special for it.

3
  • 1
    That is not an option for me. I always open emacs using emacs and then start working there with multiple files. Picking one of these files as cmd line arg is just a hack. Also, then people who work on the same machine will see the name of that file when they use ps or similar commands. What if my file is called build-bomb.txt?
    – Frank
    Apr 13, 2012 at 1:28
  • @Frank: That's fine as well: as soon as you do C-x C-f to find a file, again the settings in *scratch* won't matter any more. So my question boils down to: why do you want to use text-mode in the *scratch* buffer?
    – Stefan
    Apr 13, 2012 at 18:47
  • 6
    Because I want to use the scratch space as a text scratch space, to make text notes, not a Lisp scratch space. I'll never write Lisp code, so why should my Emacs start up with a buffer in Lisp-mode?
    – Frank
    Apr 18, 2012 at 1:41
0

You only do M-x text-mode in the scratch buffer. That's all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.