News for hackers. Stuff that matters.
Re:Ask YC: Why is emacs a great editor? by mechanical_fish on Tuesday September 23, 2008 @09:22PM (#313039)
Have you read O'Reilly's Learning Emacs? I strongly recommend it. It's a useful tour guide.

Failing that, have you read the tutorial?

Have you read Steve Yegge's "Effective Emacs"?

If none of that can help or inspire you then I probably don't have much chance. But I'll offer you some coaching anyway. Imagine Vince Lombardi reading this to you:

Stop using the mouse. If you're using emacs and you're touching the mouse, you're doing it wrong.

Stop fretting about the GUI. Why does your editor need a GUI? Emacs is a text editor, a program that is all about text. It's text all the way down. If it had more chrome, that would be wasting pixels that could be devoted to text. (Seriously: As Yegge will tell you, the true emacs user turns off the pull-down menus to make more room for text.)

Stop worrying about "intuitive". Yes, until you get to know the moves, emacs is nonintuitive, kind of like the piano. No matter how expensive and well-designed a piano I buy, I won't be able to just sit down and play some Chopin. (Well, technically you can buy player pianos that will do just that, but what would a concert pianist call such an instrument? A toy.) You're learning an open-source text editor that's quite possibly older than you. You will live with this software for months, years, or decades. You don't need features that make it easy to learn emacs in five minutes. You need the features that make it worthwhile to use emacs after thirty years.

And, yes, you haven't spent enough time. In particular, it's not just a matter of plugging away in emacs for weeks or months; it's unlike any other software you've ever used, and until you're oriented you won't find it easy to pick up things just by playing with it. You have to study it a little. Try some of the references. Try the Emacs Wiki.

Re:Ask YC: Why is emacs a great editor? by mixmax on Tuesday September 23, 2008 @09:54PM (#313067)
I just read Steve Yegge's "Effective Emacs", thanks for the link. It was very enlightening on many levels and told me several things that were written between the lines, namely:

- Initial user experience is (very) secondary to long-term efficiency

- if you aren't in this for the long term don't bother - the article actually suggestes swapping the caps lock key and the ctrl key to have it better positioned for emacs use...

- unplug your mouse, the keyboard is faster once you learn how to do it well.

It seems to me that Emacs is a friend for life, but only if you have the patience for a year or two of courting and learning its tweaks and quirks.

I'll buy O'Reillys book and see how it goes.

Re:Ask YC: Why is emacs a great editor? by ragnemalm on Wednesday September 24, 2008 @03:58AM (#313291)
Many are a fan of using the Caps Lock key as Control. While better than the insane standard positioning, it's still not optimal: it's not symmetrical between your hands (you're not going to remap Return as another Control) and it still makes for a lot of awkward pinky use. (Imagine playing a piano piece all with your 3rd, 4th and 5th fingers.)

The optimal solution I've come up with is to use the two keys adjacent to the space bar (typically Alt, but actually Command on the Apple keyboard I generally use) as Control, since that's easily the most important modifier key, so it should be the easiest to access. This makes C-w, C-s, C-r, C-a, C-e, C-p, C-o, C-j, C-l and so on very, very comfortable compared to the corner positioning. As far as I know, this is the way many keyboards were before the extended IBM PC keyboard came up with its insane control key positioning. (My comfort with these keys may also be linked to my use of Macs and ubiquitous command-key shortcuts before I switched to Ubuntu. Ironically, Emacs is much more comfortable now in Ubuntu than it ever was on my Mac, because I can use the most readily accessible modifier key as God intended, rather than the third-tier relegated modifier that Control is on the Mac.)

The two keys adjacent to the new Control keys (ie. 2 away from the spacebar) then become the Alt keys. Whatever is left over (the original ctrl keys, plus Caps Lock and any silly Windows keys left over) can be bound to Super, which is useful for window manager shortcuts so that they don't clobber emacs/bash/screen bindings.

These changes are trivially easy to put in a simple .Xmodmap file to load whenever you log in, and copy to all the other computers you have to use regularly. If you're using Windows, I guess you may have to fiddle with the registry, but it would be worth it.

Re:Ask YC: Why is emacs a great editor? by spinonethird on Wednesday September 24, 2008 @10:36AM (#313522)
Another solution is to keep the Ctrl keys where they are (note the plural), but hit them with the side of your hands: you just need to roll you hand a little bit to the outside. It takes a little practice to do this reliably, but it cures pinky pain (at least for me).

Use the hand that is not hitting the key: for C-s use your right hand for the Ctrl, and left for s. C-n the other way round. For Meta, make sure that both alt keys work, and use your thumbs: M-x right thumb and left fourth finger.

- You can't do this for C-M combinations, but they are few and far between.

- You have to have a keyboard where the keys "stick out" a little. So it does not work on laptops.

The only real issue I had was that moving around is a little slow and awkward: When going back and forth from C-f/b to C-p/n your hands are moving a lot. So I remapped C-f to C-; and C-b to C-j (and similarly for M-f & M-b) and now I can press Ctrl/Meta with my left hand and move around with my right one: bliss.

Re:Ask YC: Why is emacs a great editor? by ragnemalm on Wednesday September 24, 2008 @08:34PM (#314288)
I can see that this might work with some keyboards, but I think the Apple one is too low-profile.

Also, if you're not using C-M-... shortcuts, you're missing out:

C-M-{s,r} isearch-{forward/backward}-regexp (indispensable)

C-M-% query-replace-regexp (indispensable)

C-M-\ indent-region (indispensable for when M-q would mess up your line breaks)

C-M-x eval-defun (for running changes to your .emacs without restarting)

C-M-q indent-pp-sexp (pretty-print and reindent sexp at point)

C-M-{f,b,u,d,a,e,k,t} forward/back/up/down/beginning/end/kill/transpose sexps

C-M-{n,p} {forward/backward}-list

C-M-v scroll-other-window

And so on. C-h k (describe-key) is your friend.

Re:Ask YC: Why is emacs a great editor? by maw on Wednesday September 24, 2008 @09:31AM (#313456)
My solution is to not stick pedantically to the home row but wherever and however my hands and wrists feel comfortable. When my hands are at rest but on top of the keyboard, that works out to about AEFV N[IK]L'. It's a position not dissimilar to what you get on a split keyboard, but with the advantage that you can actually type this way. The middle columns of keys (TGB and YHN) are typable with both hands. Alt is left thumb only (I use the other Alt as an AltGr key; right thumb only). Control is left pinky only, but pressed with the first knuckle, not the tip of the finger.
Re:Ask YC: Why is emacs a great editor? by zygan on Wednesday September 24, 2008 @06:23AM (#313362)
this is one of the first things I do when i get on a new machine. It is also the first time i've seen anyone else do it. My thumbs are much stronger than my pinkys and are much easier to be using lots.
Re:Ask YC: Why is emacs a great editor? by rbanffy on Wednesday September 24, 2008 @10:46AM (#313534)
That´s interesting. I wonder if a new USB keyboard with the Knight or Space Cadet lay-outs would sell on ThinkGeek.

I would be the first one to buy.

Re:Ask YC: Why is emacs a great editor? by ihartley on Wednesday September 24, 2008 @02:35PM (#313868)
or if you're on a mac you can just use your .emacs file:

(custom-set-variables '(mac-command-modifier (quote control)) '(mac-option-modifier (quote meta)) )

And now your command key is a control and your option key is a meta.

Re:Ask YC: Why is emacs a great editor? by ragnemalm on Wednesday September 24, 2008 @08:23PM (#314275)
Sounds like the best thing to do for a mac (although it wouldn't fix the problem in tty mode). On other operating systems, it's nice to make the change globally, since all other programs seem to use control pretty regularly too.
Re:Ask YC: Why is emacs a great editor? by SwellJoe on Wednesday September 24, 2008 @03:09AM (#313262)
the article actually suggestes swapping the caps lock key and the ctrl key to have it better positioned for emacs use...

UNIX/Linux users have considered this mandatory forever, regardless of editor choice. PC keyboards are simply wrong.

Re:Ask YC: Why is emacs a great editor? by newt0311 on Wednesday September 24, 2008 @04:36AM (#313314)
No kidding. The Caps Lock key should never have existed on PC keyboards and the Tab key should be altered so that it is a "Cmd" key which switches fields in web-browsers, word completes as needed, indents code, and does everything it does now except for inserting an actual ascii tab character.
Re:Ask YC: Why is emacs a great editor? by mechanical_fish on Tuesday September 23, 2008 @09:57PM (#313070)
It isn't as bad as all that. A few weeks will suffice once you have proper guidance.

But there's certainly years of material left after that, if you want it. After eight years off and on I still haven't touched a sizeable number of emacs features.

Re:Ask YC: Why is emacs a great editor? by davidw on Wednesday September 24, 2008 @02:36AM (#313240)
> But there's certainly years of material left after that, if you want it. After eight years off and on I still haven't touched a sizeable number of emacs features.

Precisely. You can get productive with emacs after a relatively short period of time, but you will have a lifetime of learning afterwards. After 10 years, I'm still discovering new things.

Re:Ask YC: Why is emacs a great editor? by jbert on Wednesday September 24, 2008 @06:35AM (#313369)
> the article actually suggestes swapping the caps lock key and the ctrl key to have it better positioned for emacs use...

I'd argue that this is ergonmically essential for long-term emacs use, otherwise you run the risk of 'emacs claw'.

Took me less than a week to get used to it. If you regularly use other people's machines then it's not a good idea (but then, neither is emacs unless you are carrying around your .emacs file, since you'll miss all your personal keybindings).

Re:Ask YC: Why is emacs a great editor? by maw on Wednesday September 24, 2008 @09:35AM (#313461)
I have plenty of nonstandard keybindings (a bad idea, but I didn't know it it 10-11 years ago when I decided upon them, and now I'm too accustomed to them), but what I'd miss more is the various functions I've written that save so manual effort.
Re:Ask YC: Why is emacs a great editor? by MrRage on Tuesday September 23, 2008 @09:49PM (#313061)
I agree with what you said about about intuitive UIs. Intuitive just means familiar. After enough time, emacs (or vi, or any text edit) will be come familiar, i.e. you won't have to consciously think about using the editor. At that point it becomes intuitive.
Re:Ask YC: Why is emacs a great editor? by shiro on Tuesday September 23, 2008 @11:42PM (#313153)
Agreed. Emacs is intuitive in a different way than those flashy GUI apps.

One thing I really love in Emacs is that every text is basically displayed in a buffer, regardless of it being editing text, external program output, file listing, menu items or completion candidates. It means you can use common editing commands (incremental search, region selection, copy&paste, etc) uniformly to navigate those information. It's all text, so you should be able to do so. Then I turn to a supposedly intuitive GUI app that shows a menu with 100 items and I'm just lost since I cannot regexp-search through those items.

Re:Ask YC: Why is emacs a great editor? by silentbicycle on Wednesday September 24, 2008 @11:40AM (#313617)
Just a nitpick: The O'Reilly book title is actually _Learning GNU Emacs_. (http://oreilly.com/catalog/9780596006488/)