Settings

Theme

Ask HN: Emacs users on OS X, what's your setup?

73 points by shutter 17 years ago · 65 comments · 1 min read


I'm slowly getting up to speed with Emacs, switching from TextMate. There are a lot of ways to use emacs on Mac, from Aquamacs to Carbon Emacs to the Cocoa port of GNU Emacs. I've dabbled in each a little bit.

I'm most interested to hear your thoughts on keybinding (and which Emacs distribution you use). I like the thought of keeping Mac shortcuts consistent a-la Aquamacs (having CMD-Q still bound to exit, etc), but it seems like the Option key is too poorly-placed to be a useful Meta key.

(I've bound Caps-lock to Ctrl.) It seems like binding CMD->Meta and CTRL as Control would provide the best placement ergonomically, but obviously you then lose the standard Mac keybindings when in Emacs.

What does your Emacs setup look like?

how_gauche 17 years ago

I'm an old hand in Emacs and new to the Macintosh, so I use Cocoa Emacs.app because it's closest to the "standard" distribution, and override the Mac keybindings. I avoid using the mouse (those things are very bad for the wrists), so my .emacs turns the toolbar, menubar, and scrollbars off -- just a plain white screen.

I use a 25" widescreen LCD, and I like to jack up the font size until I get about 200 characters across; this lets me hold two 100x47 buffers side by side, which is how I prefer to work. Most of my interaction with the computer (besides web) goes through Emacs -- eshell, gnus, bbdb, calendar/diary, planner, etc.

jimbokun 17 years ago

I seem to be the only one here who likes how Aquamacs uses both Mac and Emacs key bindings. I find myself using both. There is probably some reason I sometimes use the Emacs kill/yank/etc. vs. when I use Mac cut/copy/paste, but I'm not sure what it is.

I also use Emacs in Windows and Unix at work, but I imagine it is sitting in front of my Mac that triggers the cmd key bindings in my head. Maybe it's just that, with Aquamacs, whatever key binding first pops into my head will probably work, so I don't have to worry about context switching so much.

I also agree that Option is the right key to use for Meta. I don't think I would ever get used to pressing cmd and not having it activate the Mac key bindings. Probably because I have been using Macs in some capacity since 1987.

The other "Mac-like" thing about Aquamacs is how it pre-bundles so many of the useful modes. Going out and loading each mode you want one at a time and tweaking it just so seems so Linux to me. I like how Aquamacs tries to give you something that Just Works for most of what you want it to do, instead of something more bare bones that you are expected to configure out the wazoo. I discovered both SBCL and Aquamacs when I wanted to learn Common Lisp, and Aquamacs coming with SLIME pre-installed made one less thing I had to fuss with.

  • madkangas 17 years ago

    +1 for Aquamacs. I've used Emacs on/off for 15 years and I've grown to detest the need to "feather my nest" every time I move to a new seat. I want a usable default configuration, and Aquamacs works reasonably well for me in this regard.

    Customizations: Capslock == Ctrl, Emacs menubar is hidden, one .emacs entry for ye olde 'newline-and-indent. That's it.

  • michaelneale 17 years ago

    I would be the same as that (I am tending to use emacs more over time, relearning things from yesteryear).

    My only complaint is the startup time for me seems very slow - perhaps I should just have it running after startup ? (I then use spotlight/quicksliver to quickly open up a file in it).

    • bkudria 17 years ago

      Yep - keep it running all the time. Also look into emacsclient and emacs --daemon (with (server-start))

  • tsetse-fly 17 years ago

    How do you use Aquamacs on a MacBook without a right Control key?

    • shutterOP 17 years ago

      With DoubleCommand, you can bind the right "Enter" key to be Control. (On my MBP at least... I assume macbooks are the same)

tjweir 17 years ago

Here are two setup descriptions from Clojure guys: http://paulbarry.com/articles/2008/07/02/getting-started-wit...

http://bc.tech.coop/blog/081205.html

They are skewed to Clojure development, but you may be able to pick out a few tips.

mmc 17 years ago

I long used emacs in X11, but recently switched to Aquamacs out of sheer laziness - not wanting to recompile emacs+gtk for my new intel mac. I've tried all the various ports, and Aquamacs is my favorite 'native' port, but I actually miss the X11+gtk build I used before. There's something to be said for an emacs that feels like emacs :)

I agree that the option key is no good as Meta - Cmd is Meta in my setup.

I absolutely override the Mac keybindings. I like having M-Q as fill-paragraph, and I found that other useful commands were being hijacked by useless OS X Text Services (like M-> for end of buffer got stolen by OmniOutliner)

I have a large 1920x1200 display that I tend to use with one emacs frame maximized, and some arrangement of windows inside that frame - most often I have a full height window on the left, and two half-height windows on the right. Sometimes I use three columns of windows, and other times four equal-sized windows makes sense.

One of those windows is almost always running zsh inside ansi-term (M-x ansi-term). Some prefer shell-mode, but I think ansi-term and zsh are more useful. I don't think shell-mode and zsh cooperate too well.

Most of my work is done in python, and I just started using pymacs and ropemacs, which seem useful. Notes on them are here: http://www.enigmacurry.com/2008/05/09/emacs-as-a-powerful-py...

saikat 17 years ago

Bill Clementson has a nice write up on his setup that has more to do with how not to get hurt using Emacs that I have found very helpful. Not necessarily specific to OS X, but he has a few suggestions that seem helpful for OS X (like making the right apple key your meta key):

http://bc.tech.coop/blog/041024.html

http://bc.tech.coop/blog/041029.html

http://bc.tech.coop/blog/060116.html

http://bc.tech.coop/blog/060131.html

cpr 17 years ago

I use Terminal-based Emacs exclusively. Couldn't stand all the "distractions" (bells and whistles) of Aquamacs. But, more importantly, with this mode I can use Emacs everywhere, including my servers over ssh, with exactly the same setup.

I bind Option to Meta in Terminal.app and that works very well.

  • falsestprophet 17 years ago

    Terminal > Preferences > Settings > Keyboard > select the 'Use option as meta key' checkbox

  • jollyjerry 17 years ago

    I agree with Terminal emacs being available anywhere. I do miss the anti-aliased fonts that are available in Emacs.app, but I have to be able to start separate emacs processes for different projects.

    Also instead of using cmd-c and cmd-v Mac key bindings, I do M-| (shell-command-on-region) to 'pbcopy' to copy the region to the OSX clipboard. It's a godsend.

    • cpr 17 years ago

      But, but, but, if you use anti-aliased fonts in Terminal, you're all set in Emacs (as well as everything else).

  • zzkt 17 years ago

    (defun remove-distractions () (set-frame-parameter nil 'fullscreen 'fullboth))

    • mark_h 17 years ago

      Unfortunately, this doesn't seem to work any more in cocoa emacs.

      • wfarr 17 years ago

        I don't believe it ever worked in Cocoa Emacs. It was a patch applied to the independently distributed Carbon Emacs.

humanzee 17 years ago

Carbon Emacs : http://www.apple.com/downloads/macosx/unix_open_source/carbo...

+ Emacs Starter Kit: http://github.com/technomancy/emacs-starter-kit/tree/master

+ yasnippet: http://code.google.com/p/yasnippet/

+ paredit: http://www.emacswiki.org/emacs/ParEdit

+ Clojure mode: http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Sta...

+ Re-mapped Ctrl to Caps. Carbon Emacs defaults Meta to the Command key, which I kept.

ivey 17 years ago

I pull every now and then from git://repo.or.cz/emacs.git, and build my own with --with-ns. I was using CarbonEmacs, but multi-tty support is amazing. I have my main Emacs frames running, and if I need to pop into a quick session in a terminal, or SSHd in from another machine, it Just Works.

(Except the theme I'm using has very light colored comments, and I can't see them in 8 color terminal. Anyone have a suggestion for a 256 color terminal app?)

I don't use Mac copy-paste, etc, even though I was a Mac user long before I was an Emacs user. Using C-y and M-y reminds me of the kill ring everytime, where using C-v wouldn't. I do have the clipboard synced to the top of the kill ring though...not sure if that was a default.

I use Command as Meta, and have Caps Lock for Control system-wide.

  • kmt 17 years ago

    > (Except the theme I'm using has very light colored comments, and I can't see them in 8 color terminal. Anyone have a suggestion for a 256 color terminal app?)

    We had this discussion just recently: http://news.ycombinator.com/item?id=443769

    BTW, why do you pull from git://repo.or.cz/emacs.git

larrywright 17 years ago

Here's mine: http://github.com/larrywright/emacs/

It's mostly stuff borrowed from other people, but it gives you a good starting point with Ruby/Rails support, Twitter integration, snippets, etc. I use it at home and work (Mac and Windows respectively), and it works well for me.

  • larrywright 17 years ago

    I just realized I only partially answered the question.

    I use the standard emacs keybindings, rather than the more os-specific ones, since that way it's the same regardless of which platform I use. I use Linux, Windows, and OS X on a regular basis, so keeping things uniform works best for me.

    On Windows I use Emacs Win32 of course, and on OS X I use Cocoa Emacs rather than Aquamacs. I played with Aquamacs briefly but it's focus on making Emacs an OS X app doesn't really mesh well with my needs.

1gor 17 years ago

Don't worry too much about standard Mac keybindings.

Emacs shortcuts will soon be wired into your fingertips and you will be efficient on any platform - windows, linux and mac. In fact, you will very soon forget about the platform and focus on your work at hand.

That's the reason old hands prefer to stick with traditional emacs keyboard interface. Dumping some Mac idiosyncrasies is a small price to pay for the freedom and power.

ctp 17 years ago

Cocoa Emacs.app built from CVS - followed instructions from here: http://www.emacswiki.org/emacs/EmacsForMacOS

Scroll down to section 'Build from source' - note the comment to build from the 'nextstep' directory. I just followed the instructions in 'nextstep/INSTALL')

This is working for me, so far... a good way to get a 'vanilla' install.

wfarr 17 years ago

Stay away from Aquamacs. It is for all intents and purposes, Emacs, but with all the useful stuff watered down in an attempt to make it fit in better with Mac OS.

My config is here: http://github.com/wfarr/dotfiles/

tconfrey 17 years ago

One thing I find useful is the Its All Text! add-on for Firefox. It lets me use emacs as an external editor for any browser text area. Its ideal for blog entries, web mail or any filling in text in a small text entry area (like this one on HN!).

In addition to giving me all the power of emacs editing, getting the text inside emacs means I can more easily use templates, save stuff off in text files etc.

You need to start an emacs server in your .emacs: (server-start). I also (add-hook 'text-mode-hook 'flyspell-mode) so that I get spell correction. With my setup I just control-e in any text area and it pops open a new buffer in my emacs session.

  • cpr 17 years ago

    But also note that, if you used Safari, you'd get the full Cocoa (Emacs-like) text subsystem editing facilities in any text field. It's a dream come try for Emacs fanatics. (My Emacs finger habits are now 30+ years old; scary thought.)

spydez 17 years ago

I use Cocoa Emacs.app. The only major keybinding change I've done so far (in 2 or 3 months of using Emacs on OS X) is Caps->Ctrl. Getting to alt/option is a thumb-contortion, so I'll probably try out Cmd->Meta soon. Only thing holding me back is the convenience of Cmd+C/X/V.

Cocoa Emacs /does/ have Mac shortcuts on by default. Not sure if they're all there, but save, cut, copy, and paste are certainly bound to the proper OS X shortcut.

As for Aquamacs, I tried it first, but had major issues trying to get it to accept my .emacs. It tries to save a ton of crap to custom-set-variables, including things I set via setq to keep my .emacs file logically laid out. It also tried to save my entire color-theme to custom-set-faces, which is an idiotic thing to do; the color-theme takes up 1111 lines in a nice elisp file off on it's own - why try to stuff it in custom-set-faces?

Anyways, just a warning - you may have issues if you try to give Aquamacs a largish .emacs file you've built up over the years on other systems. But that's probably not a problem for you since you're coming from TextMate.

I use the same .emacs at work (WinXP) as I do at home on my Mac and Linux machines, and Cocoa Emacs played well with it with minute adjustments, so I went with it.

marcher 17 years ago

I started off with MacPorts' Emacs 22.3 package and just used it on the command line. Eventually I moved to a portfile that tracked Emacs CVS, and finally settled on Aquamacs.

I've tried Cocoa Emacs from CVS, but it has one major problem that makes it unusable for me: no fullscreen support. The latest version of Aquamacs does this perfectly. I have an entire space dedicated to Aquamacs, and I send files to it from Terminal with emacsclient.

I too have capslock bound to control. I don't have any other keyboard modifications. I'm used to option/alt working the same in Emacs and every other OS X application (try alt+left/right/backspace/delete in an input box).

My ~/.emacs doesn't have a lot of OS X-specific settings. My favorite thing about my setup right now is having Pyflakes automatically highlight errors in my Python code as I write it. Flyspell in strings and comments is also great.

If you're interested, my ~/.emacs is here: [link redacted]

kapitti 17 years ago

From Jim Weirich, of Rake fame:

http://github.com/jimweirich/emacs-setup/tree/master

Also, a starter emacs kit for rubyists:

http://github.com/jimweirich/emacs-starter-kit/tree/master

travisjeffery 17 years ago

I'm using the Cocoa Emacs.app cause it's most like the old Emacs, no new keybindings like Aquamacs has.

tlb 17 years ago

I've been using Emacs for 20 years, and fully converted my desktops to Mac last year.

I like Aquamacs OK with option->meta and caps lock -> control like you have. With that setup, it's a bit of a twist to get my pinky finger onto meta, but it's tolerable on my Microsoft Natural keyboard.

The biggest nuisance is that I can't figure out how to bind function keys. I liked having F2 = goto-line (rather M-g g) and F3 = compile.

After 20 years of Emacs, I've actually started to like Cmd-c and Cmd-v rather than C-k and C-y.

Also, the scroll wheel on the Mighty Mouse works pretty well in Aquamacs. Though you do have to clean the scroll wheel (by rolling it around on your pants) every few days.

  • lallysingh 17 years ago

    Aquamacs has a solid fullscreen environment, and you gotta love the mac's text rendering.

    First thing I did was swap to option = alt, command = meta.

    Next was load up CEDET, and enable all the excessive display helpers. I'll eventually pear them down, but for now it's nice. Specifically, the header bar shows the current function/method body I'm in, and there's an overline over every signature.

    Really nice to parse through large source files, especially when they're full of long definitions. Hey, no judging.

jwr 17 years ago

I use CVS builds of GNU Emacs, they work great. Just check the source out from CVS and './configure --with-ns; make install' will produce an Emacs.app for you to drag to Applications.

The only problems I have is a bug where if you resize your window at least once, it will cause annoying flashes during redraw (but I almost never resize my emacs window, so that's not an issue) and that I would like more integration with the OS.

On the latter front, I already started calling NS services from Emacs (ns-service-Things-add-item-as-Note). This is very cool. What I'd like is more of an ability to customize what Emacs does when it is called to open a file.

I remap Caps Lock to Ctrl.

dannywoodz 17 years ago

I use Emacs on Windows, Mac and Linux, so I generally like the normal Emacs keybindings on everything. That way, it's equally alien/consistent on all platforms, and I just start 'thinking in Emacs'. I use Carbon Emacs on the Mac.

I keep my .emacs and a tree of elisp files (things like ecb, magit, slime, etc.) in my git repository, which I update and sync across the machines I use: this gives me a great deal of consistency across platforms.

One alteration I make on all platforms is to remap the caps lock key as a second control key: caps lock is useless, and the number of times you have to reach for control in Emacs makes it worthwhile making it easy.

martenveldthuis 17 years ago

I use GNU Cocoa Emacs built from source. This port does the most common cmd-x,c,v,q etc, which helps me transition. I'm typing on an IBM Model M attached to my Mac, so I've mapped CAPS to Command to maintain that key. I'm fine with the placement of the ctrl and option keys.

My config is at http://www.github.com/marten/emacs.d/ It contains a couple of useful fixes (such as Cocoa apps not getting the PATH var from the shell). It's got plenty comments. I should try turning more stuff into autoloads, I'm finding it on the slow side to start up right now.

dilap 17 years ago

I'm new to OS X (from Windows, mostly, with MinGW), but old to emacs. In my brief investigations, I have found Carbon Emacs to be the most friendly -- mainly because it makes no attempts what-so-ever to fit in with the Mac keystrokes, which suits me fine. Like most other people, I bind caps-lock to control, which I recommend whatever your platform.

Now a brief question of my own: is there any way to map command to meta in the apple terminal???

I know about mapping option to meta, but it just ain't the same, especially when I hit command-W hoping to copy text and accidentally close my whole frickin' terminal.

fendale 17 years ago

I just have Aquamacs with all the default bindings. Then I installed ECB and all the rails goodies, of which I use very few actually! Flymake is the most useful as it highlights syntax errors without even compiling.

  • menloparkbum 17 years ago

    I also use Aquamacs and ECB. However, I just upgraded to Aquamacs 1.6, which broke my ECB.

  • mmc 17 years ago

    I completely forgot about ECB! I don't use it with Python (for no good reason), but it was really great for C++ projects. Love ECB.

rickd 17 years ago

I use emacs in a terminal window for probably 75% of my editing, and textmate for the other 25- I have Aquamacs but couldn't get into the flow with it for some reason. I keep all the default keys for ctrl/etc, and it does help a bit that they newest macs have changed the enter key that used to be to the right of spacebar to alt.

While it's not really emacs, I generally do most of my development in Eclipse- but I change the keybindings to Emacs mode (window\preferences\general\keys). Makes eclipse almost nice to use.

  • oyving 17 years ago

    I tried setting IntelliJ IDEA to Emacs key bindings, but I had to switch back to the default bindings. With the Emacs-like key bindings my fingers automatically expected a lot of things to work that IDEA plainly did not support (like kill ring).

    My preference when I am not using Emacs is to make a clean break so my finger macros don't run wild, often unintentionally pressing key bindings that do other things than I expect.

alexott 17 years ago

There are small differencies between my Emacs setup for Mac OS X & for Linux. You can find my configuration at http://xtalk.msk.su/~ott/common/emacs/_emacs.html, and macosx-specific configurations at http://xtalk.msk.su/~ott/common/emacs/rc/emacs-rc-local-flas...

bulanga 17 years ago

I use the native OSX emacs in the terminal with the fonts increased a fair bit. It loads really fast (~ 1 second) I tried Aquamacs but didn't like the fact that it was significantly slower when starting. I'm a new emacs user so I don't really see the need for all the bells and whistles the larger packages tend to offer. If I need anything I just install it from emacswiki.org. Also I found dotfiles.com quite useful for customising my setup.

adoyle 17 years ago

I run a vncserver (from MacPorts) on my MacBook. Then inside there I do all my coding with Emacs, generally two frames side-by side. I access it via Chicken of the VNC. I set up the same vncserver setup on all the machines I do work on, and can access each one from any other without losing context. I rarely find the need to cut/paste from the OS X desktop into/out of my vnc windows, but it can be done.

jimm 17 years ago

Emacs.app GNU Emacs 22.2.1 (i386-apple-darwin9.4.0, Carbon Version 1.6.0)

All my init files are check in to a repository at https://github.com/jimm/elisp/tree

See http://www.io.com/~jimm/emacs_tips.html#my-dot-emacs for how I've set up the repository for different machines.

toffer 17 years ago

Question for everyone who binds the Caps Lock key to CTRL:

If you use the Caps Lock key as CTRL, then it feels pretty awkward for me to type some key combinations (like ctrl-x or ctrl-c) and still keep my fingers on the "home row".

Do you just get used to this? Do you type ctrl-x with your pinky and ring finger? Or, do you shift your hand away from the home row and type ctrl-x with your pinky and middle finger?

  • anoved 17 years ago

    I use the Caps Lock key as a Control key, and indeed I type Ctrl-X with my left pinky and middle finger. (I realize that I touch-type "X" with my middle finger anyway. Is this unusual?)

  • jaaron 17 years ago

    I hadn't noticed till now, but I actually shift my whole hand, using pinky and index finger. Hmm, maybe I should get out of that habit.

msg 17 years ago

Just like you say, Carbon Emacs + Caps->Control + Cmd->Meta. I dislike using Option as Meta, as you say.

This keyboard and setup is exactly the setup I have for Gnu Emacs on Solaris 8 that I have to use every day at work, and if I ever do serious work on Windows, I'll be able to remap Alt and Caps without trouble. The consistency of key placement is definitely helpful.

zitterbewegung 17 years ago

Carbon emacs package (latest) Aquamacs is unstable at least the last time I used it. Anything.el makes emacs feel like quicksilver (which is AMAZING!!!). I use redshank (hacked version for scheme) + quack.el + paredit.el for my main environment. I have been trying to use darcs and the wiki page for notes but I haven't gotten into it.

bretthoerner 17 years ago

Nightly from here: http://atomized.org/wp-content/cocoa-emacs-nightly/

Config: http://github.com/bretthoerner/emacs-dotfiles/tree/master

I maintain a very OS X-y feel, among other things.

tsetse-fly 17 years ago

I use Carbon Emacs because Cocoa Emacs has a black square in the center of the frame for the visual bell. Also, there's no visual separator between windows when you have your scroll bar/fringes turned off. Aquamacs is too exotic.

  • martenveldthuis 17 years ago

    I used to get that up until a few weeks ago too. Try recompiling from the latest head, it's fixed for me.

olegshaldybin 17 years ago

I use Cocoa Emacs.app. Here's my emacs config, carefully crafted for Rails development:

http://github.com/olegshaldybin/emacs-config/tree/master

icey 17 years ago

Kirubakaran has his emacs posted on github:

http://github.com/ki/my-dot-emacs/blob/master/dot-emacs.txt

It looked quite good to me.

paddy_m 17 years ago

carbon-emacs. It's my first emacs ( I never used emacs on unix or NT). Carbon-Emacs seemed to keep more with emacs' UI guidelines compared to aquamacs. Note I think I'm running carbon emacs, I run the one with the purple logo.

I have the option key (windows key on this keyboard) mapped to Hyper. I use Hyper to navigate around emacs. H-(n|p|b|f) move up, down, left, or right one window in a frame

H-(N|P|B|F) change the size of the current window height/width

other hyper bindings open apps that I use regularly (shell, anything, sql)

malkia 17 years ago

I'm emacs newbie, and I do use Aquamacs, with separately downloaded SLIME, and custom .emacs (borrowed from many people - mainly from comp.lang.lisp)

mariorz 17 years ago

Aquamacs, fn key is meta, panic sans 10 font, <3 fullscreen-mode.

access_denied 17 years ago

- Caps-lock == Ctrl - plist hacked so the whole system (at least cocoa-apps) behave emacs-like (Apple is meta) - carbon emacs, because (fullscreen, extensions work, like to have the default GNU set-up as a starting point, and there was 1 thing Cocoa Emacs did not right but I forgot what it was) - I use color themes a lot, I plan to have each major mode auto-choosing one; most of my .emacs pets are not implemented yet, in a way the real work tends to be more fascinating - org-mode as "productivity app" and backbone for DTP

  • access_denied 17 years ago

    Sorry the formating. Here is it again:

    Caps-lock == Ctrl

    plist hacked so the whole system (at least cocoa-apps) behave emacs-like (Apple is meta)

    carbon emacs (not the one running under the CLI, the .app), because:

    (fullscreen, extensions work, like to have the default GNU set-up as a starting point, and there was 1 thing Cocoa Emacs did not right but I forgot what it was)

    I use color themes a lot, I plan to have each major mode auto-choosing one; most of my .emacs pets are not implemented yet, in a way the real work tends to be more fascinating

    org-mode as "productivity app" and backbone for DTP

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection