Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically closing the scratch buffer

Tags:

emacs

What I must write in my .emacs file so that the *scratch* buffer is closed when I open Emacs?

like image 617
0xAX Avatar asked Apr 18 '10 15:04

0xAX


People also ask

What is a scratch buffer?

Scratch buffer or scratch space is a term quite often used for pre-allocated memory (because startup time usally matters less than runtime performace) to be used for all kinds of stuff.

How do I create a scratch buffer in Emacs?

Just re-create the buffer by switching to it: C-x b *scratch* RET . Since Emacs 21.2, if you create a buffer called *scratch* , it's automatically put in Lisp Interaction mode. Why do you need a special function? For me, if I kill *scratch* and then switch back to it, it's set to lisp-interaction mode automatically.


2 Answers

(kill-buffer "*scratch*")
like image 73
SurvivalMachine Avatar answered Sep 22 '22 16:09

SurvivalMachine


Not exactly the answer to your question, but you might like to know that you can choose to have a different buffer open on startup, or change the contents of the *scratch* buffer. For example:

;; Make *scratch* buffer blank.
(setq initial-scratch-message nil)

;; Make the buffer that opens on startup your init file ("~/.emacs" or
;; "~/.emacs.d/init.el").
(setq initial-buffer-choice user-init-file) 

In the first example, the *scratch* buffer will be empty. In the second example, the *scratch* buffer will still exist, but user-init-file will be focused.

like image 42
pheaver Avatar answered Sep 22 '22 16:09

pheaver