Make Emacs 22 Work Properly

I upgraded from emacs 21 to emacs 22 about 6 months ago. I was looking for some of the better features of emacs 22, and for some bug fixes. Alas, I ended up being bitten by some other bugs. These bugs were annoying, but not quite bad enough to make me revert to emacs 21. That or I’m a masochist. But I repeat myself.

I am now happy to report that I’ve found the solution to these tedious issues, and share them with you now in the hopes of saving you the hours of frustration I’ve had to go through.

Splash Screen Nagging

For some reason, emacs 22 has different startup behaviour. In emacs 21, if you didn’t specify a file, emacs would load up with a splash screen telling you all about how awesome RMS is for inventing emacs all those years ago, pointing you to the online help, etc. That’s fine for a novice, or the first 3 times you use the program. When you’ve been using it for years, seeing the splash screen means you’ve typoed something and not loaded the file you wanted to edit, so you immediately C-X C-C and try again. At least, I do.

Emacs 22 has, for some unfathomable reason, decided that the splash screen should display every single time you load the program. This is suboptimal for so many reasons I’m not going to bother explaining it.

Add this to your .emacs startup file to stop the madness:

(setq inhibit-startup-message t)

Now the big hairy git will get out of your way so you can create some code of your own. It may not be as awesome as emacs, but with practice, who knows?

Thanks to Scott Hilleard for this tip.

Fixing Auto-Indent in Python Mode

emacs 22 broke the auto-indent behaviour in Python mode. Since I code almost exclusively in Python these days, this was a major pain in the ass. In emacs 21, hitting enter would create a new line, and automatically indent the line to the right place to line up under the line of code above. Neat.

In emacs 22, you just get a newline. You have to hit tab to get the indent to happen. Apparently the old behaviour is bound to C-J by default in emacs 22 instead. Of course it is! How silly of me. It’s almost as intuitive as C-X C-C to quit, instead of, oh I dunno, :q.

To get the old, sane, behaviour back, add this to .emacs:

(add-hook 'python-mode-hook '(lambda () (define-key python-mode-map "\C-m" 'newline-and-indent)))

Found on the Emacs Wiki.

I hope that helps someone.

Bookmark the permalink.

Comments are closed.