Emacs reflexes: the good, the bad and the ugly

jplindstrom on 2004-08-15T14:00:55

After using Emacs for a while, my fingers have started to betray me.

Fortunately, by coincidence, it's not that bad.

What bugs me the most is the save command. Save is Ctrl-S (or C-s in Emacs speak) pretty much everywhere, and I do it as a reflex as soon as I stop typing anything and start thinking again. (This can be somewhat annoying when I write a long text in a browser form and the Save as... dialog pops up all of a sudden)

In Emacs, Save is C-x C-s, so when I type C-s I accidently invoke the search function. But it's not that bad since I can just go ahead from within the search and do the C-x C-s tap dance without destroying anything. It doesn't matter I just did The Wrong Thing. Mostly though, I have gotten accustomed to actually thinking "Save" and pressing the correct Emacs combo. It's in my fingers now.

Which is nice when in Emacs, but not that handy when I'm not. Because on Windows, C-x means Cut out the current selection. What I often end up doing isn't just a Save, but a Cut-n-Save. And this is where the coincidence comes in: cutting without having anything selected is a no-op, so it doesn't matter either!

Maybe, just maybe, if any of these "wrong" keyboard combos had been destructive or just a little more annoying in any environment, I would have forced myself to actually learn to notice the difference and condition my fingers accordingly. But since I don't really have to, I probably won't ever do that :)

Coming from a Windows/Mac background, I'm used to the highly effective idiom of Shift-moving to select text. Emacs does this with the pc-selection-mode macro (thanks for the pointer ambs!), and the old Shift-Del, C-Ins, and Shift-Ins combos from way back in Windows 3.0 are used for Cut, Copy and Paste.

While they work fine, and still work in Windows today, Microsoft made a smart move adopting the C-x, C-c, and C-v from the Mac user interface for this. That way you can do a left-hand operation without stretching the fingers too much while selecting with the mouse.

I might teach my fingers native Emacs for Copy-Paste, but I'm afraid it may clash with a command sequence somewhere else. This whole thing just made me think of software maintenance...


XEmacs

zatoichi on 2004-08-15T17:53:16

I do the exact same thing. I am so used to the Windows keys that I constantly am starting the search funtion in xemacs.

CUA might be just the thing

htoug on 2004-08-16T08:57:42

from the description in cua.el:
;; This is the CUA-mode package which provides a complete emulation of
;; the standard CUA key bindings (Motif/Windows/Mac GUI) for selecting
;; and manipulating the region where S-<movement> is used to
;; highlight & extend the region.

;; This package allow the C-z, C-x, C-c, and C-v keys to be
;; bound appropriately according to the Motif/Windows GUI, i.e.
;;      C-z     -> undo
;;      C-x     -> cut
;;      C-c     -> copy
;;      C-v     -> paste

I found a way of changing Crtl-Space to Shift for marking text, but my fingers are so used to emacs now that I gave it up - and I can't remember what it was any longer - sorry!

Re:CUA might be just the thing

jplindstrom on 2004-08-17T10:37:56

I guess pretty much everything I could even think of asking for in Emacs, someone else has already done it :)

However, remapping C-x would break like 90% of the keyboard combos in Emacs itself and make my fingers incompatible with all other emacsen in the world, or at least of the one in the office next door.

Remapping Ctrl-x

htoug on 2004-08-17T10:46:28

You are right - emacs is like Perl - someone has already done it! For emacs the challenge is to find where, as there is no CEAN!

Ctrl-X functions "normally", for emacs that is, except when you have selected a region, so no (big) problem there.