5 ms·
Ask YC: Why is emacs a great editor?
I recently installed emacs since a lot of people (yes - yc users) seem to think it is the best code editor around. I read that it has a steep learning curve, but that it would be worth the effort. I accepted that and started using it as my primary editor to get my hands dirty. After 2 weeks of use I'm still not productive in it. I can think of the following reasons for this:
- I use my mouse a lot, and it seems that emacs is made primarily for keyboard input. I don't use keyboard shortcuts much.
- A nice looking GUI and well designed intuitive interfaces matter to me. Emacs is extremely lacking in this respect.
- I simply haven't spent enough time with it - the learning curve is steeper than initially expected.
What do you think? Am I missing something obvious, should I carry on in the belief that this is a divine tool that just takes time to master, or is emacs simply not for me?
- gz 18y agoI remember when, having coded in emacs for a few years, I used it for the first time to do a 3-way merge on thousands of lines of code. The amount of time and effort I saved astounded me. The point here is twofold: 1) emacs is very well integrated with extremely powerful tools (in this case diff, merge) 2) emacs is deep; even as an advanced user you can keep improving your efficiency (albeit at a lower rate) Having said that, I have a question: once I had become fairly comfortable with emacs I switched back to vi. I felt there was a positive correlation between learning new keystrokes/tricks while coding and the quality of code I produce. Has anyone else observed that? If yes, why do you think this is so?
- Hutzpah 18y agoI am no coder, I use Emacs as my 'DTP package. But I can relate something rom graphic design. Why a graphician should be able to draw stuff with pen and paper rather than only work at the computer? Because the connection between thought and hand is faster with pen and paper. Hence, broadband output and feedback loop. Not just faster but enhaced quality: so fast that feedback loop becomes subconscious, direct, flow. Maybe in programming with vi /emacs the same thing occurs.
- silentbicycle 18y agoYes, particularly with good development modes (e.g. SLIME for common lisp, Tuareg for OCaml), the feedback loop between the language runtime and the editor is immediate.
- mechanical_fish 18y agoHave 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.
- MrRage 18y agoI 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.
- shiro 18y agoAgreed. 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.
- kylec 18y agoAs a followup question, what is the best resource to most efficiently learn the basics of Emacs?
- powellb 18y agoA swift kick to the head. After that, mapping CAPS-LOCK to be CONTROL. After that, the previously mentioned O'Reilly book.
- tatofoo 18y agoThis is the second time I've read this: > mapping CAPS-LOCK to be CONTROL. Why? At least in my laptop CAPS-LOCK is easier me to press than CONTROL if I want CAPS, maybe there is another reason for it?
- shadytrees 18y agoIf you keep stretching your pinky to the left Control key (which is used a lot in Emacs), you can actually damage your hand especially with heavy Emacs love. Mapping the Caps Lock to Control is useful because it removes the stretching and, besides, Caps Lock is used infrequently enough to not warrant its being on the home row. (It also makes Ctrl shortcuts in other applications easier.)
- johnm 18y agoThat makes sense if you're using Emacs on a laptop. However, when you're at your desk, the most awesome Emacs upgrade is to buy a Kinesis Ergo "Contoured" keyboard (http://www.kinesis-ergo.com/ http://www.kinesis-ergo.com/). It moves all of the control/alt/Apple/Meta keys from all of the random locations to your thumbs and so once you get used to it, it's way, way better than anything else. The only downside is that it only comes in one size so if you have large hands / long fingers it might be too cramped. For the skeptics, once you get used to it, it's actually quite easy to go back and forth between the laptop keyboard and the Kinesis. I.e., very little mental dissonance.
- anamax 18y ago> A nice looking GUI and You're editing text. What "graphical"s are you expecting? (You should be seeing syntax and selection highlighting.) > well designed intuitive interfaces matter to me. What's the difference between "intuitive" and "familiar"? Yes, the keyboard commands are not what you're used to. If you want the keyboard commands that you're used to, you can program them. That's generally a bad idea, but emacs is full of rope.
- mechanical_fish 18y agoIf you want the keyboard commands that you're used to, you can program them. That's generally a bad idea... Let me underline this sentence. Some people (particularly the ones who think that copy and paste were invented by God on the eighth day of creation) get it into their heads that they should redesign the emacs interface on their first day. This is particularly tempting because the ability to remap keys all over the place is one of emacs' best features. Resist the temptation to do this at first. The emacs ecosystem actually makes a great deal of sense once you settle into its way of thinking. It's sometimes hard to believe, but very smart programmers have spent decades working out where to put things in emacs. If you insist on ignoring their efforts, and instead try to pretend that emacs is a lot like the Mac OS, you will never even learn the basics, like the glories of the kill ring and the mark ring, or the important distinctions between a file and a buffer.
- andypayne 18y agoI generally agree with you about trying to redesign the interface. However, if you exercise some discipline, it can be a worthwhile way to sequence a gradual adoption of Emacs. This is especially true for users of other programming-style text editors, such as Vi(m). Using Viper or similar can be a good way to ease into Emacs. It's even structured that way -- you can progress through the levels to gradually transition from Vim's way of doing things to the Emacs way. I did this myself. As I said, it does require the discipline to periodically learn more and more features to progress. Aquamacs offers a similar transition for Mac OS X users.
- anamax 18y ago
- abstractbill 18y agoAt this point I've spent about ten years learning Emacs. I'm sure there's still plenty I could learn that would make me even more productive - Emacs is big. When I was in my early twenties, I decided enough of my heroes at the time raved about Emacs that I should just trust them and not care how long it took to learn or how hard it was. This turned out to be a good decision.
- mixmax 18y agoThis is pretty much the reason I decided to give it more than the normal five minutes of attention that shareware gets before a decision is made. A great number of people that are way smarter than me think it's the best thing since sliced bread. And by definition they can't be all that stupid :-)
- travisjeffery 18y agoI'd recommend reading "Writing Gnus Emacs Extensions" why is it the best, obviously because it's one if not the most extensible piece of software ever made. And it chose one of the best languages to implement it's extensibility.
- wheels 18y agoAll of the things that you list here are what Emacs is not. Above all, Emacs is an investment -- not a two week investment, but one that you'll need a year before it's really an extension of the way you code. Here are some other additional notes: - You can get it on every platform. I personally use XEmacs (though I'd recommend GNU Emacs for people starting now) and it's exactly the same on Mac, Windows and Linux. - Many of the old Emacs die-hards learned Emacs in a time when Emacs had just as good a GUI as anything else. So a lot of our rhetoric comes from an era when everything was driven by keyboard shortcuts. I do, however, believe that learning how to use your editor from the keyboard alone does improve long-term efficiency.
- anotherjesse 18y agoI spent a couple hours every day doing the basics (first learning buffers, then file stuff, then on and on...) within a week I had decided to switch from VIM. (I used only emacs while on vacation for any editing I needed to do) My suggestion - stop reading all the tutorials and just do it. Keep a list next to your computer with 5 things you need to know how to do - with the key strokes next to them. Once you become comfortable create a new list that is what you need to learn now. Don't over extend (ooh, git integration, org-mode, ...) - you'll get there (and probably within a few weeks) - but focus on the basics first. Once those become muscle memory you can figure out the advanced stuff.
- silentbicycle 18y agoAlso, first things first, Control-H followed by t brings up a tutorial. Work through that, it covers all the basics.
- silentbicycle 18y agoAnd after than (as jrockway noted elsewhere), press Control-H i to get to the Info pages menu, which is the hypertext documentation inside Emacs. What you're looking for is almost certainly in the main Emacs section or the Emacs FAQ. Info has its own manual, but most of what you need to know to start is that Enter visits a hyperlink (which are probably purple and/or bold), 'u' goes up one level, 'n' and 'p' go forward/backwards one node, and 's' searches. (To get a more detailed keyboard shortcut list, type "Control-h m" inside of the info buffer.)
- globalrev 18y agoWhen I saw the light: http://news.ycombinator.com/item?id=233172 http://news.ycombinator.com/item?id=233172
- rgiar 18y agoIn a word, emacs is responsive -- you realize this as you slowly become familiar with the basic components: buffers and files, the point and region, keymaps, ediff, ffap, running shells inside emacs, tramp, etc. and then, yes, finally emacs lisp. Using these basic tools, you can mix, match and customize until it does what you need for today's project, no matter what language or OS,however many files, script languages, build tools, etc. At some point it becomes clear that emacs is actually a programming environment for text editing with emacs lisp in the position of universal configuration, scripting and compute language. If you can think of something you want to do with text,files or code (albeit limited to an ascii interface) you can either find it in the extension community or you can quickly bend emacs to do what you want. My learning curve was approximately two years to feel very competent, five or so to feel like a power user, and then 8 or so to feel make it do most anything.
- bprater 18y agoYOU know what would be really useful? To have an expert Emacs user do a screencast of himself doing standard programming stuff. I think that would make it really obvious how these types of editors are.
- wheels 18y agoWell, you'd need to have some way to do quick keyboard tracking with the screencast. Just seeing all of the text get highlighted and re-indented wouldn't do a lot. I'm not sure how much more it would help if you could see that "[ctrl-x], [ctrl-h], [esc], x, indent-region" was typed...
- capablanca 18y agoThere's actually an extension by Michael Weber that might be helpfull for recording screecasts: http://www.foldr.org/~michaelw/emacs/ http://www.foldr.org/~michaelw/emacs/
- mixmax 18y agoI thought the exact same thing. Would be really interesting to see how emacs is used by someone skillful. Anyone with a webcam up for the job ? :-)
- silentbicycle 18y agoWatching the screencast for SLIME (a common lisp mode) was what convinced me to switch to Emacs. (It may very well convince you to avoid it, but it'll be an honest impression of what Emacs looks like with a power user.) Link in the comments from here: http://news.ycombinator.com/item?id=230990 http://news.ycombinator.com/item?id=230990
- imgabe 18y agoI learned a lot from this screencast when I was first starting to use emacs. It is geared specifically towards lisp programming with SLIME, but you do get a good look at an emacs expert doing some programming, as well as a look at his .emacs file which is always very helpful. http://bc.tech.coop/blog/050728.html http://bc.tech.coop/blog/050728.html There's another film by the same person about using UncommonWeb (a lisp web framework) that has more emacs goodness. Note the UCW tutorial is probably somewhat out of date as the framework has changed a bit since then. http://bc.tech.coop/blog/050727.html http://bc.tech.coop/blog/050727.html
- Flemlord 18y ago> Why is emacs a great editor? It isn't--don't believe the hype. On the other hand, I couldn't write a line of code without IntelliSense. Does anybody know anything about Emacs.Net that Microsoft is working on? http://www.knowing.net/PermaLink,guid,31fdc849-db2a-4f7d-bf96-44df005a06b4.aspx http://www.knowing.net/PermaLink,guid,31fdc849-db2a-4f7d-bf9...
- pdrummond 18y agoI am a die hard vim user who has been learning Clojure recently and I have learned a little Emacs along the way because everyone in the Lisp community bangs on about it. The funny thing is, every time I go to write some Clojure code - I want to open a Vim session, but I am always strangely drawn to Emacs for some reason. Recently, I decided to figure out what it was about Emacs that made me want to use it so much over Vim. I soon realised it was all about being able to load a REPL process in a window and interact with it on the fly. I can run Emacs, open a Clojure source file, write a function then hit C-M-x to send the function to the REPL to be evaluated. Also relevant is that Clojure support in Emacs was available shortly after Clojure's release to the public late in 200. This is a very specific case (lisp-style interactive development) but it's why I personally think Emacs is great and for me it has nothing to do with Emacs text editing features! I will always prefer Vim for pure text editing power.
- Tichy 18y agoHm, so the functionality you describe is not possible with vim? I was planning to switch to vim in the future. I have used Emacs before, but I never became really good at it. However, the functionality you describe really seems quite important.
- pdrummond 18y agoI know of various attempts to get this sort of functionality in Vim but I've never been able to get it to work very well. The bottom line IMO is that Vim is not designed for this sort of thing while Emacs is.
- ivey 18y agoI installed Emacs to install SLIME so I could play around with Lisp. The REPL-in-a-buffer is so phenomenally powerful that I immediately missed it in TextMate when coding in Ruby. Thus began my descent into Emacs madness, and my new favorite function, ruby-send-region-and-go I was a vi guy for a very long time, and I mocked the Emacs guys for "eight megs and constantly swapping" and "Emacs claw" ... until I switched to TextMate on the Mac, and realized how Emacs-inspired it is. It was actually very easy to go from TextMate to Emacs. Along the way, I got more productive in my shell. Did you know that M-left moves back a word on the command line? I didn't, and I've been using bash for 10 years. Oh, and it works in all readline-enabled apps.
- ricky_clarkson 18y agoI'd suggest using your mouse less - you can increase your speed more with the keyboard than you can with the mouse. There are a number of looks that emacs can have, from emacs -nw (runs in your terminal emulator) to emacs with GTK. And there are colour themes within each. M-x color-theme-select
- whacked_new 18y agoThe learning curve is no joke. 2 weeks is nothing. Don't get ambitious and treat it like your favorite editor just yet. Decide on a small task with complexity (and hence requires you to jump back and forth and rename stuff), like a 20-line script. Make plenty of use of the basic keystrokes (C-f forward, C-b backward, C-p prev line, C-n next line, C-s search, C-r reverse search). That's 6 combinations, and it's enough to witness the kind of speed you have in navigating the text. Then use it for a real editing job. Shouldn't take long before it becomes second nature. Then, it shouldn't take long before you wished that every text entry window used the same keystrokes. Oh yeah, type return to complete the search.
- yason 18y agoI would say that someone who is effective at Emacs works just the opposite way: - No mouse; - No GUI; most people hide even the menu bar; - They have spent and do continue to spend a lot of time in Emacs. Someone suggested a video recording of an Emacs session. That sounds like a good idea!
- blogsworth 18y agoYou're not missing anything.
- saurabh 18y agoI think you are looking for an editor which feels modern but has the power of emacs,vim or textmate. If you are on Windows, you can try http://www.e-texteditor.com/ http://www.e-texteditor.com/. If on OSX, http://macromates.com/ http://macromates.com/ Even i used to go round this question. I tried emacs, then vim , then textmate, then e-texteditor. Finally i felt Vim to be comfortable for me. You need to try all of those before settling on one.
- Ben65 18y agoPeople love emacs because you can customize it to your liking. That's why it's touted as such a divine tool, and that's why it's worth it to keep trying to learn it.
- dgreensp 18y agoI don't think emacs has a steep learning curve for being a really efficient editor, the way (say) vi does. If you can get through the day in emacs without touching the mouse, you're basically there, and the rest is just discovering all the features and ways to customize it. Force yourself to move the insertion point with the arrow keys, for starters. Then learn a few shortcuts so you don't go insane. C-a for beginning of line, C-e for end. M-f and M-b for forward/backwards by a whole word. C-v and M-v will scroll you up and down through the document and move the insertion point so that it stays on the screen. Emacs doesn't need a lot of UI. It isn't an IDE, for one thing (though it can be used as one). Customization is done by putting incantations in your .emacs file. Managing buffers and panes only requires a handful of commands; learn the keys for them, or re-assign them if they're awkward.
- silentbicycle 18y agoIf you prefer to use the mouse, rather than keyboard shortcuts, you might be happier with something like Acme/Wily (http://www.cse.yorku.ca/~oz/wily/ http://www.cse.yorku.ca/~oz/wily/). It's not available for all platforms, though. Emacs is intrinsically a keyboard-driven editor, and mostly just tries to keep the GUI out of the way. Your experience is more meaningful than anybody's dogma about whether keyboard-centric or mouse-centric development is more productive for you, but mostly using the mouse will make it hard to take advantage of what makes Emacs special. (If you, or other readers, want to really learn Emacs, you should probably give it at least a month. Once you're comfortable with the basics, gradually learning elisp will greatly increase how useful it is for you.)
- Hutzpah 18y agoEmacs has an intuitive interface - the keyboard shortcuts. Discover them.
- coliveira 18y agoIf you are trying to program in lisp, then Emacs is probably the best option, since it follows the lisp way of doing things. For normal editing tasks, however, I prefer vim.
- msg 18y agoI've been using for months. It took a while, and the O'Reilly book, Yegge's post, and EmacsWiki were all extremely helpful (in that chronological order). You might also consider just reading the manual too (although you might want to hold off until you have more experience). Another resource that will be really helpful somewhere in there is to just type C-h C-h. You'll see a listing of various kinds of help. I use these a lot, especially to explore something new: C-h k (type any keyboard shortcut) "what does this shortcut do?" C-h b "list all keyboard shortcuts from all modes in the current buffer" C-h f (type a function name) "what does this function/command do?" C-h v (type a variable name) "what does this variable do, and what is its value?" C-h a (type a regexp) "list all commands matching the regexp" M-x apropos (type a regexp) "list commands, functions, variables, etc. matching the regexp"
- dimitar 18y agoHow about Easymacs? I dislike the standard shortcuts not because they are difficult to remember, but because they cause me pain in my hands and I've never had anything of this sort before. I've tried remapping the caps lock key, but it didn't help much. Now I find that using Emacs is much more enjoyable. I don't think torturing yourself is justified. I can spot only one drawback: you have to take your fingers of the home row (learn touch typing, my rodent-using friends) a bit more.