Tuesday, December 13, 2011

Modify your .emacs to start with a clean *scratch* buffer

Ah, one of life's minor nuisances finally solved:

;; Remove the annoying text that populates the 
;; *scratch* buffer on start-up
(setq initial-scratch-message nil)

Calvin and Hobbes dancing

Yep. When all else fails, RTFM. Chapter 39, Section 1.1, to be precise: "Summary: Sequence of Actions at Startup".

This was one of those problems that bugged me every time, but since it didn't present that often, only took a few seconds to clear (albeit each time), and seemed like the sort of thing that begins a snipe hunt, I'd always postponed looking for a way to address it. You'd think I'd know better by now.

Screenshot of Google results showing what I was looking for as the very first hit

Welp, to the list of never-fail advice that can be summed up in four letters, add JFGI.

I realize the intersection of the set of people who use Emacs and the set of people who don't already know how to do this is near nil null, but thanks for reading, anyway.

• Dancing pic swiped from Loz in Translation. Original artwork by the great Bill Watterson, of course. Used in tribute, but without permission.

• Thanks also to Max Design for CSS styling tips on the <abbr>tag.


Anonymous said...

Just another reason why life without my .emacs file would be not worth living.

So, uhh, thanks... ?

Brendan said...

I'm enabling, aren't I? I'm so sorry.

E3D3 said...

I prefer to put some interesting keybindings I want to learn in the 'initial-scratch-message' with set-variable and/or edit the text in .emacs afterwards.

Brendan said...

That's a good idea, E.

The way I usually start Emacs, though, is by clicking a shortcut that opens up my main notes file and a file called scratch.pad. My original intention was to have the latter blank almost always, but it has turned out more typically to be a place where I dump something I was working on, if I had to leave my computer abruptly, or a reminder of some sort. So, I kind of have what you do in that sense.

The thing that bugs me about a non-empty *scratch* buffer, consequently, is that when I want to use it, it's because my scratch.pad file isn't blank, and I want a blank buffer because I've copied a block of text from some other application and I want to paste it, do a quick bit of text transformation (suitable for a quick macro, say), and then kill the whole buffer back into the Clipboard for re-pasting. Having to deal with anything besides a clean and empty buffer causes a cache miss, as they say.

Alan Aversa said...

Thank you!

Brendan Keefe said...

You're welcome!