This is a read-only archive!

Emacs: undying hatred

I spent a good six hours today using Emacs. It's by far one of the most infuriating pieces of software I've ever used.

Just to get this little question out of the way, can anyone tell me why when I hit backspace 10 times to delete a 10-letter word in Emacs, it adds 10 undo actions to my undo history? Can that ever possibly be what someone wants? This is the action of MS Visual Studio, for God's sake. You KNOW there's something wrong when you're doing the same thing as Microsoft. Is this a consequence of not being a modal editor? Vim would combine all the text deletion all into one undo action, no matter what keys you pressed to delete the text.

I know the real Emacs answer is that instead of using the primitive Backspace key I should really type CTRL-ALT-SHIFT-F12 ESC-TRIPLEBACKFLIP-] while simultaneously typing CTRL-ALT-CAPSLOCK-WINDOWSKEY-OTHERCTRL-_ M * C TAB TAB D on another keyboard with my feet to invoke the sexp-maybe-kill-eval-backwards-and-reindent command, but sometimes that big backspace key is kind of convenient.

But that's not my real problem today. My real problem is message Emacs windows. When I C-c to compile/load a Lisp form sitting in one of my text file buffers, Emacs will do one of three things seemingly at random:

  1. Spew output into my REPL, including ERRORS, WARNINGS and STYLE WARNINGS. This is acceptable.
  2. Open a separate debugger window, if the Lisp I just loaded threw an error, to let me pick a restart. This is reasonable.
  3. Open a window called *compiler notes* that includes ERRORS, WARNINGS and STYLE WARNINGS. Pretty much the same thing that gets dumped into my REPL. Why?

The location of where one of those two random message windows appears is either below or above my text file's window. I can't figure out a deterministic way to predict whether it'll be above or below my text file, at any given moment.

However if I have two windows open at once, Emacs will pick one of MY windows and reuse it to display its messages at me. So then I have to C-x o, and bang on C-x b BUFFERNAME TAB to find my buffer again. When doing C-x b to get my buffer back, Emacs will always have a default buffer to switch to if I just hit Enter. About 15% of the time, it's the buffer I want. The other 85% of the time it's a random buffer that I don't want.

On that topic, Emacs is also too stupid to figure out that if I type replTAB for my buffer name, I want the buffer named *slime-repl sbcl*. Instead I have to type *slime-replTAB, which means my hands get to search for asterisks and hyphens; the frequency with which I have to do this probably explains the searing pain in my hands and wrists right now. Vim on the other hand lets me :b and type ANY part of a filename, and TAB cycles through all filenames that match. When you hit TAB in Emacs, instead it launches yet another obnoxious message window showing me the tab completions.

If I hit q in any of these random message windows, it closes the message window. Sometimes. Sometimes it doesn't work and I don't know why. Most of the time these message windows steal focus from my text file, which means I can't even ignore them. But sometimes, it doesn't steal focus, and so I end up typing a bunch of q's into my text file.

Sometimes when I hit q it just whines that the buffer I'm trying to hit q in is read-only and does nothing. On the other hand, in my REPL window, parts that probably should in my opinion be read-only, aren't. I can type over top of previously-output compiler warnings and messages. And then things start getting all screwed up unless I'm very careful to undo it.

When I do manage to close all these message windows, sometimes I end up with two windows left open, and sometimes I end up with just one. So then I get to bang on C-x 2 C-x b BUFFERNAME TAB C-x o to get my second window back. Which will again be usurped by Emacs the next time it decides to barf compiler warnings at me.

Eventually I tried opening four or five windows, one to display everything Emacs could possibly think of nagging me with. But this doesn't work. Emacs cycles through ALL of my open windows to display its messages at me. First it'll use the top window, then the one under it, then the next one, then the next one.

So I tried to resize all the windows to a small size to get them out of my way. But funny enough, Emacs sucks at something as simple as resizing windows using the mouse. If you have four windows open, stacked vertically, and you drag the border of the bottom one with your mouse upward, as soon as it hits the border of the window above it, it stops. So to resize four windows, first you manually resize the top one, then the one under that, then the one under that, and finally the one under that. Vim on the other hand lets you grab any border and drag it to your heart's content, and it bangs the other window borders out of its way.

I just noticed there's also yet another buffer that's actually called *messages*, but it never auto-appears so I don't want to think about it.

I must be doing something wrong, because there's no way any sane person could live with this behavior for more than a few hours of coding. This is ridiculous.

December 15, 2007 @ 6:38 PM PST
Cateogory: Programming
Tags: Emacs, Vim, Rant


Quoth Hollow on December 15, 2007 @ 8:31 PM PST

if you use the "DEL" key in vim, it will also produce one undo-step per character deleted (given that you delete in normal mode, insert mode always works "correctly")

Quoth jwickers on December 15, 2007 @ 8:44 PM PST

In the other end, i HATE when i paste something in VIM then notice that i screwed up, because when i hit the undo i will undo my paste but also the random X last typed characters ...

Quoth ruben on December 15, 2007 @ 9:31 PM PST

If it's such a frustrating experience, then why do you use Emacs?

The undo-per-typed-backspace is in my opinion correct behaviour. Why should it merge those into one action? If you wanted to backspace over the whole word at once, you should have use Meta-Backspace.

About "Emacs too stupid to figure out the buffer when I type..."... A computer or program is only as smart as you make it: you can use "iswitch" for that. Personally i use the following enhancements for buffer switching:

;; ----------- ;; - iswitch - ;; -----------

(require 'edmacro) (iswitchb-mode 1) (defun iswitchb-local-keys () (mapc (lambda (K) (let* ((key (car K)) (fun (cdr K))) (define-key iswitchb-mode-map (edmacro-parse-keys key) fun))) '(("" . iswitchb-next-match) ("" . iswitchb-prev-match) ("" . ignore ) ("" . ignore )))) (add-hook 'iswitchb-define-mode-map-hook 'iswitchb-local-keys) (setq iswitchb-default-method 'samewindow)

;; ------------ ;; - uniquify - ;; ------------

(require 'uniquify) (setq uniquify-buffer-name-style 'forward)

And instead of using C-x o, I use C-TAB, which I find faster and easier, but this only works in a GUI-window.

(global-set-key [C-tab] 'other-window)

The code I wrote here, should be placed in your ~/.emacs file. I hope this makes your emacs experiences a little bit nicer. :)

Quoth ruben on December 15, 2007 @ 9:37 PM PST

I think that the escaping between pre-tags isn't working.. it should have read:

'(("" . iswitchb-next-match) ("" . iswitchb-prev-match) ("" . ignore ) ("" . ignore ))))

this means you can use the left and right arrow keys to switch to another buffer once you hit C-x b, and possibly typed a couple of letters from the buffer's name.

Quoth ruben on December 15, 2007 @ 9:39 PM PST

Right... '(("[smaller-than-sign]right[bigger-than-sign]" . iswitchb-next-match) ("[...]left[...]" . iswitchb-prev-match) ("[...]up[...]" . ignore ) ("[...]down[...]" . ignore ))))

Quoth vedang on December 15, 2007 @ 11:03 PM PST

lol... that was a genuinely funny post! I use emacs mainly for c/c++ coding and source code browsing, and I have never had a problem with it. Once you take the time to figure out the hot-keys, using emacs is a breeze. I am of the opinion that the provided hotkeys are the fastest way of doing that particular task, far easier on the fingers than any of the other editors available... I'm sorry you seem to have such a horrid time with it.

Quoth lhr on December 16, 2007 @ 9:23 AM PST

Then why are you still putting up with the crap that is Emacs?!! vi FTW!!!

Quoth Brian on December 16, 2007 @ 11:07 AM PST

I use Vim for everything except Lisp. You pretty much have to use Emacs if you want to code Lisp.

CHristopher Giroir
Quoth CHristopher Giroir on December 16, 2007 @ 11:39 AM PST

That page includes ido.el which will make buffer selection work how you want. You can always hit ctrl-f to find buffers normally (get out of ido mode) but with ido mode you can type part of a buffer and it auto limits the list of buffers. Makes file finding and buffer switching very nice.

With the windows issues I don't know what to say. There are many emacs packages to manage windows better. I don't have experience with any but they do things like you'd find in a normal linux wm. You can set rules on windows names to have them appear in certain spots and other such tricks. You can save layouts so that one keybinding will bring back windows you have tagged or whatever. I haven't used any of them so I can't help more then mention that they exist.

With the backspace issue, the only thing I could say is that you can use the delete word or delete sentence/line commands instead of single character delete commands. I like the fact that I can go back through every command I took, but to each his own. There are modes that let you browse the undo history and revert back, and of course you can prefix undo in order to undo many commands at once.

Quoth Brian on December 16, 2007 @ 1:08 PM PST

Thanks for that link, it's even better than iswitch.

Ivar Refsdal
Quoth Ivar Refsdal on December 27, 2007 @ 1:30 AM PST

You might want to have a go with CUSP:

A Lisp environment for Eclipse. I haven't used it a lot to be honest, but Emacs is a bit strange indeed.

Ivar Refsdal
Quoth Ivar Refsdal on December 27, 2007 @ 1:32 AM PST

Oh yeah GREAT post by the way! Made me laugh a lot. :-)

Keep it up.