Emacs? Emacs. 77 comments

posted Saturday, December 6, 2008 by topfunky

And with my handheld portable all-purpose lightweight doohickey I fuse thoughts and try not to be too picky. —Buck65

I’m personally offended that you enjoy the software you work with ;)—al3x

Update: Full 60-minute screencast now available at PeepCode!

A few weeks ago I decided to try out Emacs. I wasn’t especially dissatisfied with TextMate but felt that I had neglected to educate myself about a major part of computer science history. Somewhat like a DJ who has never heard Grandmaster Flash (who purportedly invented much of the hardware used to create music with multiple turntables). I felt that I needed to try out one of the classic text editors still used by many today.

My history with text editors over the last 10 years goes something like:

  • BBEdit
  • vim (for about 6 months)
  • Smultron
  • TextMate

Screencast

I’ve assembled a short screencast of my initial impressions:

Initial Impressions

The Good Stuff

Here’s a short list of what I’m enjoying about it so far:

  • Efficiently keyboard driven. No need to use the mouse at all.
  • Window splits for viewing multiple files (and shells) at once.
  • Powerful editing.
  • The ease with which one can work with dozens of files without getting confused.
  • Super customizable.
  • Easy to keep settings, snippets, plugins, etc. synchronized between desktop and laptop with Git.
  • Quality plugins from the community.
  • The aha moment when parts of code make more sense given the fact that Emacs was used by Matz, Ryan Davis, Nathan Weizenbaum, etc. to author them.
  • That unidentifiable elitist feeling you get from using a tool that’s too difficult or awkward for most people.

The Awkward Bits

  • No GUI for preferences.
  • Mac OS X integration is just barely good enough to get by. For example, I can’t get “Hide Others” to work except by using the mouse.
  • It’s assumed that you’ll do most work from within Emacs itself rather than piping text to it.
  • Crashes when trying to switch color themes. This may be a problem with the color theme plugin I’m using.
  • It’s difficult to think about content and files instead of icons and buttons.

Getting Started

Installing, learning, and configuring Emacs is unfortunately not easy. I’m working on a PeepCode screencast with Phil Hagelberg that I hope to finish within the next few weeks. In the meantime, here are some resources I used to get started on Mac OS X:

Useful Plugins

  • yasnippet.el—TextMate-style tab trigger snippets with mirroring, defaults, etc.
  • textmate.el—Provides tremendously useful keyboard shortcuts for TextMate switchers. I’ve modified it to work with my setup.
  • magit—Git integration.

See Also

And a word from our sponsor

New hot-selling PeepCode Screencast authored by Lars Pind.

77 comments

Leave a response

  • Emac looks good to me. I should test it out if there is a trial version!

  • Welcome to emacsburg Geoff! Yes, if it’s crashing with the theme, it’s probably the theme. For mac users, I recommend CarbonEmacs. It’s much more stable than aqua.

    Magit is fantastic and for those github users, gist.el is another must have, allowing you to create gists, both public and private from the current buffer or selection.

    Looking forward to seeing what you guys cook up for a screencast.

  • I second 20seven’s comment, try CarbonEmacs if you’re on OS X and make sure you get gist.el Also, make sure you check out Rinari for Rails related development, if you properly configure it you’ll have way too much fun :)

  • I recommend aquamacs, it integrates very nicely with OS X. For customization, while it’s not pretty, M-x customize usually gets the job done for me.

  • I don’t have anything against Carbon, but I use Aquamacs and have never had a crash or problem. Try them both!

  • Daniel Luz

    Nice intro! After a couple months of vim and a few weeks in TextMate, I’m considering Emacs too. In fact, yesterday was my first day with it (reading “A guided tour of Emacs”), after about a week delaying that.

    I was trying Aquamacs so far, but I’ll give Carbon a try. I particularly like how it’s closer to vanilla Emacs, since I use other platforms regularly.

  • Erikk

    Judging from the name, E-Macs, it is a native Mac app. Neverthless, I am intrigued by your description. I wonder if it has been ported to Windows or the Linux, and if there is an inexpensive lite version for me to try.

  • Andy L.

    Erikk, you’re kidding, right? ;)

  • Geoffrey Grosenbach

    After trying out all the different versions this evening, I’m liking Carbon Emacs best. It displays UTF-8 characters properly, works with the keybindings Chris defined in textmate.el, and I couldn’t get it to crash.

  • When learning emacs I found the aqua-emacs default of new buffers in new windows really frustrating. It wasn’t until I switched to emacs on my linux laptop that I fell in love with emacs.

  • user

    Have you tried anything.el package?

    http://www.emacswiki.org/emacs/Anything

    It’s the Quicksilver of Emacs. Pretty convenient for accessing anything you want.

  • 23er

    I just have to laugh…. “is there a trial version of emacs” its opensource and free since ages!

    “e-macs seems to be nativ mac software” its native UNIX software, again there since ages back when mac wasnt even dreamed of. There are ports to windows of course. Free as well.

  • Recently have been having a lot of weird occurrences and strange coincidences all pointing towards Emacs and or VI.

    This post pushed me over the edge! Emacs, here I come. Thanks so much Geoffrey.

    I will keep my thoughts on the switch here, http://tinyurl.com/5w92kj

  • Aquamacs tries very much to fit into OS X, rather than attempting to fit into Emacs.

    A lot of us purists and elitists (;p) in #emacs will recommend Carbon Emacs or compiling your own. If you’re interested in the latter (I assume you have XCode installed), I have a script that I use to compile it for me. If you’re interested in making use of it, it should take little-to-no customization to get it working for you: http://gist.github.com/30943 .

  • Aquamacs tries very much to fit into OS X, rather than attempting to fit into Emacs.

    A lot of us purists and elitists (;p) in #emacs will recommend Carbon Emacs or compiling your own. If you’re interested in the latter (I assume you have XCode installed), I have a script that I use to compile it for me. If you’re interested in making use of it, it should take little-to-no customization to get it working for yo.

  • Yo!, I have been learning emacs from long time, Its lot to learn from and the oldest piece of software giving birth to better computing, Yeah! :-)

  • Mark

    No GUI for preferences.

    Huh? Does this not qualify for some reason?

    http://i35.tinypic.com/213p7ja.jpg

    Anyway, thanks for doing this screencast. I myself tend to prefer Vim, except in situations where Emacs’s infinite extensibility truly shines (e.g., AUCTeX). But I mostly agree with your analysis of the strengths of GNU Emacs.

  • No GUI for preferences.

    Remember: configuration is code.

    Will: the problem with Aquamacs is that it doesn’t try to be compatible with other versions. Since it’s not permitted for me to virtualize OS X, this means I can’t test with it, so I can’t support for the Peepcode or the Starter Kit. I’ll definitely accept patches for the Starter Kit though.

    User: I’ve heard good things about anything. I will definitely give it a try and may cover it in the screencast; thanks.

    I’m glad to see how folks are getting excited about this. Will try to get it finished soon!

  • Mark

    23er

    There are ports to windows of course. Free as well.

    I was rather disappointed at how poorly the combination of Emacs and Aspell performs on Windows in flyspell mode, especially in contrast to Vim’s integrated spell checking functionality. Other parts of Emacs just don’t “feel right” in Windows, either; Vim seems to do quite a lot better at this.

    On the other hand, I spend 95% of my computing time in Unix environments, and flyspell is just peachy there.

  • I pushed through the Emacs CVS (23.x) quirks and got everything working perfectly on my Mac, finally switching from Carbon Emacs.

    With CVS Emacs on Mac, most people want Cmd to act as Meta, which stops many of the common Mac keybindings from working. However, you can explicitly remap them to the ns-* functions:

    
        (global-set-key (kbd "M-`") 'ns-next-frame)
        (global-set-key (kbd "M-h") 'ns-do-hide-emacs)
        (global-set-key (kbd "M-ˍ") 'ns-do-hide-others)  ;; what describe-key reports
        (global-set-key (kbd "M-c") 'ns-copy-including-secondary)
        (global-set-key (kbd "M-v") 'ns-paste-secondary))
    

    Note that the character in the ns-do-hide-others binding is not the regular underscore. In the Preferences dialog (Emacs menu), leave Alt/Opt Key set to “None”, and Command Key set to “Meta”.

    My full emacs config is here. You’ll also find code in the init.el there that makes UTF-8 work in both Emacs 22 & 23, and allows regular OS X entry of special characters using Option, which didn’t work for me by default in Emacs CVS.

    Hope that helps.

  • Petar Radosevic

    Whats also great with Carbon Emacs is the fullscreen mode. You should try it..

    Greg Newman explains how here..

    You could also browse github for emacs dotemacs repo’s. There are a lot of little gems there..

    Good luck and have fun!

  • I think one thing that should be made clear is like Chris says, try both. Aqua seems to work great for some people as does Carbon. It shouldn’t turn into a flavor war. Use whatever works for you. I recommended Carbon simply because it’s been stable for me and as a python developer these days, pymacs crashes aqua when i try to use it.

    In addition to the full screen article I that Petar pointed to, I also wrote one on Dired as an overview. http://rubyurl.com/4esS

    I also second the recommendation about Anything. You can tap into apple’s spotlight with it and it will search emails from mail.app as well as files and if you’re a ctags kinda guy it will index those.

  • I had some crashes with color-themes too.

    I fixed it by removing the line

    (color-theme-initialize)

    in your topfunky-misc.el

    In color-theme README they are saying you can use

    (require ‘color-theme) (color-theme-gnome2)

    to load your color theme at startup. There is no mention of (color-theme-initialize) anywhere.

    I hope this helps

  • Phil,

    “the problem with Aquamacs is that it doesn’t try to be compatible with other versions. Since it’s not permitted for me to virtualize OS X, this means I can’t test with it”

    Aquamacs will not write to your .emacs or interfere with any other installed software. It maintains its own “custom-file” (“customizations.el”). You can try it by starting it from the downloaded DMG.

  • John

    I’m really curious about these “aha” moments you had, when code started making more sense viewed with emacs-colored glassed. Can you give an example or two for the uninitiated?

  • Johan L

    You can pipe text into a running Emacs server.

    See here: http://www.shellarchive.co.uk/content/emacs_tips.html#sec15

  • Andy L.

    I really don’t get it—if you guys are now even using Emacs (instead of TextMate), what’s keeping you on OSX?

    Have you tried the latest Ubuntu? Even 3G net access now works beautifully.

    On Ubuntu Linux (and lots of other distributions), all GNU and UNIX stuff is really easy to install.

    E.g., for GNU Emacs: sudo aptitude install emacs

    :)

  • Emacs: not native Unix!

    “its native UNIX software”

    Sigh. It’s kind of too bad people don’t know history. As always, the winners write the history, and in computers, today’s winners are Unix, Windows, and the Mac, so a lot of people seem to assume these are the only worlds there are (or ever have been). Emacs was originally ITS/TECO software. We used to call the Unix port of Emacs “Gosmacs”, after the guy who ported it (who went on to write another little software system called “Java”).

    If there’s any doubt, go ahead and name some other Unix programs which are big, monolithic, and extensible using (and written in) Lisp—I’ve been using Unix systems for decades, and I can’t think of any (well, maybe Sawfish?). Unix systems are “small, do one thing, do it well, tie together with processes”. Lisp systems are “big, do everything, extend with in-process hooks”. They almost couldn’t be more different.

    The classic “native Unix” editor you might be thinking of is vi.

  • David: I mean that code written for GNU Emacs does not always work the same way on Aquamacs. Without the capability of virtualizing OS X, there’s no way for me to ensure that the code I write will work on Aquamacs, so I can’t support it.

    Andy: Sure; I haven’t used OS X seriously since 2003. I couldn’t survive without a decent package manager these days.

    Last Commenter/Historian: GNU Emacs doesn’t share any code with Gosmacs since Gosling’s version didn’t include a real Lisp interpreter, just MockLisp. It doesn’t share any code with the TECO version either; it’s only vaguely in the same “family”.

  • Garren

    Don’t forget to mention that your starter kit requires the (very nice) inconsolata font.

    http://levien.com/type/myfonts/inconsolata.html

  • Andy L.

    Yeah, Phil, I wasn’t talking about you, but about most of the commentators in this post. And about 90% or something of Rails developers…

    There was even this guy (I shall name no names ;)) on a Ruby conference… he asked who many were using Macs, and I guess not everyone raised their hand, so he replied that, if they were smart, they’d use a Mac… Well, I’ll just say this: I suppose he was assuming the others used Windows, ‘cause that’s the only way such a comment makes sense. ;)

    But, no, I was definitely not talking about you, Phil, I know how much you’ve been contributing to Emacs and its Ruby support, and soon a PeepCode screencast!... You tha man, Phil, you tha man! Thank you.

    The reason why so many developers have switched to the Mac, instead of Linux is, to me, a mystery. But, well, I guess that will be the next step… ;)

    And, if not, oh well, to each his own. ;)

    Anyway, the most important thing is that we focus on cross-platform tools, and remain united as the community of rubies - uh, sorry, that came out wrong - the Ruby community. ;)

    Peace to everyone.

  • Andy L.

    And thank you Geoffrey (topfunky) for supporting Emacs! Looking forward to the full screencast.

    And also eagerly awaiting the one on Merb. Ah, and the jQuery one—when, when? (Patience… I know, I know. ;))

    Again, thank you very much Geoffrey! I’ll surely renew my Unlimited subscription next year.

  • malkomalko

    I must say. I read this blog post yesterday, never thought of trying emacs, and after 5 hours of going through the emacs tutorial, I’ve fallen in love.

    Lisp is really easy to read to declare your own shortcuts, and the list of extensions that people left in these comments were astounding. The full screen CarbonEmacs shortcut is a dream, as well as the cheat, gist, anything, rinari, and the starter kit that you’ve adapted. I can really see how having multiple views inline can really save the day.

    Question: Is there currently a way to save view sets. For instance if I always wanted an eterm in the bottom right pane for autotest? And does anyone know how to use your .irbrc file for any of the terms through emacs?

    Cheers!

  • Andy L: TextMate isn’t the only reason developers use OS X. I’ve never been a TextMate user and am a happy OS X user.

  • WhoTheUnluckyStiff

    You’ll find information about editor’s learning curves there : http://bc.tech.coop/blog/images/curves.jpg

  • Andy L.

    Chris, I’m curious, what OS X features/tools do you find so good that you prefer to develop in it instead of say, Ubuntu Linux?

    I know that some OS X apps are great, but for me, it’s way better to have the same OS for both developing and deploying my web apps, and not to have to deal with all the incompatibilities…

    Please do let me know, Chris, I’m curious. And thanks for all the awesome Ruby stuff you’ve been doing! :)

  • Andy L.

    WhoTheUnluckyStiff: Ha ha! :D Good one!

  • malkomalko

    Another question that I can’t find anywhere else. Using any of the ruby/rails .el packages, has anyone configured the indentation so that if you are creating a method over multiple lines, that when you hit enter it indents (x) amount of spaces instead of aligning the text?

  • ndimiduk

    I recommend http://emacs-app.sourceforge.net/ for Emacs on OSX—A very nice UI conversion to Cocoa/OpenStep

  • Hey Mr TopFunky (if that is your real name!),

    I wrote up a column editing screencast whose content you may like to include in your upcoming screencast.

    http://stateofflux.com/2008/6/14/column-editing-with-emacs

    Mark

  • Emacs is good for us.

  • Mark, you have a bad link

  • @20seven – I just moved my blog from mephisto to wordpress so you must have had increadibly unlucking timing. All the links still work.

    Take another look now if you are still interested.

  • Bad timing it was. Nice screencast!

  • Peter Barszczewski

    Sorry I’m late to the party. I enjoyed your screencast, but there are two small additions I would add. First, the most important thing to realize about emacs is that it is a running virtual (lisp) machine that can be modified on the fly. If you want to modify your running emacs, you typically type your lisp code into the scratch buffer, do C-x C-e, and you’re good to go.

    Second, many of us use Macs for development (Carbon for emacs purists, Aquamacs for Mac purists) and Linux for servers. When installing emacs onto a server you want the package “emacs-nox” (i.e. emacs with no X support). To install on Ubuntu, you do a “sudo aptitude install emacs-nox”.

    Great work guys, I look forward to the final product.

  • Christian Romney

    Andy L.: Photoshop, Illustrator, Lightroom, Final Cut Pro, Quick Books.

  • jesse

    Steve Yegge has some great articles on emacs. A couple of key bindings I’ve adopted from his suggestion are:

    (global-set-key ”\C-x\C-m” ‘execute-extended-command) (global-set-key ”\C-c\C-m” ‘execute-extended-command) (global-set-key ”\C-w” ‘backward-kill-word) (global-set-key ”\C-x\C-k” ‘kill-region) (global-set-key ”\C-c\C-k” ‘kill-region) (global-set-key ”\C-j” ‘eval-print-last-sexp)

    It may seem strange to double up those two, and indeed, I always use the C-x variants. I guess it’s in case your fingers get sloppy. But mapping execute-extended-command to C-xC-m is a great tip. Much easier to type quickly. And I’ve become rather fond of C-w for backward kill word as well!

    Taken from: Effective Emacs

  • I love how you got a word from your sponsor at the bottom I only wish I had a sponsor for my blog! What i like about it is the transparency where as other blogs sometimes you wonder if that was a paid post or a real one.

  • Mahinder Savitri

    Excellent! Can’t wait for the full edition.

  • I tried it out and I can definitely see the advantages of Emacs, but I’m going to have to go back to TextMate for things like columnar editing and “Edit Each Line in Selection”.

  • Thanks for sharing!

  • My emacs (built per this post) doesn’t seem to pick up ~/.emacs.d/init.el. It does pick up my ~/.emacs fine, though. What am I missing?

  • Andy L.

    Christian Romney: There are several Linux alternatives to the OS X apps you mention—you can find a lot of them here: http://linuxappfinder.com/alternatives

    and here: http://www.osalt.com/

    I know that, for some of those OS X apps, even the best alternatives aren’t as good… but I think we’ll get there :)

    Also, you can always ask in the official Ubuntu Forums—pretty good place for questions and answers: http://ubuntuforums.org/

    I think you’ll be surprised by the number (and quality) of the solutions available for a Linux switch. I know I was, back when I switched in 2006. :)

  • Andy L.

    Oops… first link got cut:

    http://linuxappfinder.com/alternatives

    Ok. Hope it helps.

  • I’ve been reading through the comments; I enjoyed the jpg link shared by Whotheunluckystiff! LOL! Thanks for sharing that link with us!

  • When is the peepcode vid is coming?

  • Interesting. But I can’t help wondering what the alpha plus plus geeks are giving a first look…

  • Andy L.

    In all the Christmas spirit.. and after the great news that Rails and Merb are merging…—Allow me to offer this as a Christmas gift…

    Some recommended applications for developers wishing to use Ubuntu (or another Linux flavor): Terminal / Console: rxvt-unicode (and) GNU Screen Quicksilver Alternative: Gnome Do (or) Launchy File Manager (with integrated shell): Midnight Commander Outliner / Note-taking App: NoteCase IRC Client: WeeChat FTP Client: FileZilla RSS Feed Reader: RSSOwl

    All of these are very powerful apps. Take the time to learn them. You’ll be rewarded.

  • Andy L.

    Arghh.. the formatting got messed up…

    Ok, here it goes again…

    Some recommended applications for developers wishing to use Ubuntu (or some other Linux distribution):

    Terminal / Console: rxvt-unicode (and) GNU Screen

    Quicksilver Alternative: Gnome Do (or) Launchy

    File Manager (with integrated shell): Midnight Commander

    Outliner / Note-taking App: NoteCase

    FTP Client: FileZilla

    RSS Feed Reader: RSSOwl

    IRC Client: WeeChat

  • Just bought the screencast (w00t!) and am getting all set up with the starter kit. For some reason, though, my .rb files aren’t going into Ruby major mode and if I try to ‘M-x ruby-mode’ directly, I get this error:

    Cannot open load file: pcmpl-rake

    I’m using a fresh download of carbon emacs and the latest from your git repo and I don’t have anything extra in the vendor directory yet… any ideas?

  • Whoops, I got impatient… you explain it perfectly during the last 3 minutes.

  • Andy L:

    Don’t get me wrong, I (heart) Linux. Run it on all my servers. Before I got my Mac, I used Ubuntu as my desktop exclusively for a couple of years. But as you said, the free alternatives to those particular apps don’t quite cut the mustard—yet. I know a lot of people swear by the GIMP, but for an old hand at Photoshop there’s just no comparison. Also, for small business accounting Quick Books used to be another huge reason. Of course, now I use Quick Books online (although it requires IE – ugh) but I can live with Windoze in a VM.

  • Emacs seems nice. Thanks for sharing your views.

  • About more modules for Git integration you can read at my site

  • Juan

    prueba ps

  • ola pringaos!

  • Ruby is must nowaday for a web developper. We have had mch difficulties to find an adequat developper who can handle with ruby.

  • rgr

    fdfd

  • MPU

    Waht do you think: is that possible to integrate Rails in a CMS systems like drupal?

  • Emacs is absolutely my first choice for a console-based text editor, and has been since I first used Unix back in the 1990s (I can’t stand vi). But it is not at all my first choice when a GUI is available—I don’t like the X version, and I don’t think Aquamacs is any better than using Emacs in a terminal window. For Rails development, I am currently using and recommending jEdit—it works far better than anything else I’ve tried (see my blog for more info on my jEdit setup).

    Then again, I used to work with a guy who did all his editing in 6 vi buffers in a Mac OS Terminal window, with a color scheme that would have given me a headache after 30 seconds. He apparently really liked that setup, though. De gustibus non est disputandum…!

  • Emac would be thus a great operating system if only the editor was not thus a dreadful dung.

  • Emac would be thus a great operating system if only the editor was not thus a dreadful dung.

  • I think emac is really to complicated and doesn´t correspond to a man on the streets needs.

  • @Segafredo: I wonder, what exactly is a “man on the streets”? Anyone calling himself a coder should be intelligent enough to learn how to use emacs productively.

    I once thought just as you do, but now, after a couple eons of fright, I took the plunge and dived in. It’s wonderful, once you master it. Bye bye, TextMate!

  • @ Chris: Man on the street is like telling “Mister everybody” or in french: “Monsieur tout le monde”. Maybe Segafredo meant that emac is only adapted to people with good knowledges.

  • fooledbyprimes

    The fun part is sitting on the plane using emacs just to show off to the people in the row behind you who are watching your every slicked-out trick (through the gap between seats).

  • As with everything in life, one must take some bad along with the good. Reese Payton

Your Comment

Nuby on Rails

Geoffrey Grosenbach / Ruby / Code / Graphics / Design / Rails / Merb / Javascript / CSS

Manufactured with

Subscribe

Subscribe (RSS)