Hacker News new | ask | show | jobs
by unit_testing 5300 days ago
I'd love to take this opportunity to dive into Emacs, but the past few times I've tried, it's felt like my keyboard was fighting against me. For those of you using Emacs on a Macbook (or an Apple keyboard), which key do you use for 'alt'?
10 comments

I use the "Apple" key ...

Put this in your .emacs file

  (setq mac-option-modifier 'super )
  (setq mac-command-modifier 'meta )
I also use the System preferences to map the Caps-Lock key to Ctrl - A lot easier especially since a lot of keyboards tend to move the CTRL key around
The worst are the Thinkpad keyboards that have Fn where the left Ctrl should be. This is the sole reason I started to use Caps Lock for Ctrl and now I'm in love with it.
That's my favorite feature of Thinkpads: that means I cannot damage my pinkie any further :)
I remapped the Apple key for alt on my MBP. It truly is frustrating; alt is not in a very nice position at all. FN is where I would prefer ctrl to be.

When I really need to get writing at home, I plug in a MS N4K and go at it.

See the sibling comment by raju for the specifics, but you can actually bind the Fn key with the `mac-function-modifier' variable.

I'd thought for a long time that Fn was a hardware/OS-only key based on the lack of apps that use it, but it seems Emacs has found a way.

I pretty much only use emacs on a mac. This means I don't care about having a keymap that is the same on a linux box.

So, I use option for 'alt', but here's the great thing. You can use the command key for other stuff! I've got keybindings for my most common actions.

command-j -> ido-find-file

command-d -> anything

etc

I use CarbonEmacs [1] on my Macbook. The default 'meta' is the cmd key, which I prefer, as it's closer to what I'm used to on other keyboards. I also remap (globally) caps-lock to be a second ctrl.

[1] http://homepage.mac.com/zenitani/emacs-e.html

For the record, Carbon Emacs is Emacs 22, which is very old (c. 2007) and deprecated.
I use 'option', also labeled 'alt' on my keyboard. You can set it to act as 'meta' via your preferences. Use iTerm 2.
I use the Apple key as Meta and the Caps Lock key for Ctrl. On a Linux box I use the Alt key as Meta and the Caps Lock Key for Ctrl. With this setup the keys are in the same location for every keyboard and I don't get so confused.
Alternately, go the Steve Yegge way and rebind meta to C-x-C-m and C-c-C-m:

  (global-set-key "\C-x\C-m" 'execute-extended-command)
  (global-set-key "\C-c\C-m" 'execute-extended-command)
These bindings are only for M-x. This is still useful (M-x is really common), but it's not a full replacement for all meta bindings.
Exactly. The problem with keyboards is that the alt key is right under your thumb, right where Ctrl should be. You might take a look at http://xahlee.org/emacs/ergonomic_emacs_keybinding.html , which is a remap of common emacs keybindings to fit underneath the alt key.

Sure, this is an invasive change, but it saved me from RSI.

Esc
option
I use option like the others have said. I am like you, diving into Emacs; in my case purely for the swank/slime lisping environment.

It's been pretty difficult as I am a dyed in the wool VIM user. Someone on HN recommended the Evil plugin (http://gitorious.org/evil/pages/Home) for an approximation of VIM movement and other bindings. It surprisingly works pretty well. It's letting me remain productive while I slowly adapt to the emacs key-bindings over time.

I am using emacs-prelude as well (https://github.com/bbatsov/emacs-prelude) which is a startup scripts kit.

I'm still not sold on emacs yet, but I am giving it time.

I've been using Evil for a couple of months and love it. I switched from Viper+vimpulse and haven't missed a beat. It works really well and was easier to setup. Any VIM user considering Emacs should give it a shot - the best of both worlds, really.
I've been using evil mode and don't really see why you'd even want to move away from the vim bindings. Get the best of both worlds, the nice vim movements and model editing, plus all the nice emacs packages and being able to use elisp instead of vimscript.