6098 comments
2357 subscribers
6260 on Twitter
Subscribe! Feed reader E-mail

Emacs: Caps lock as M-x

Inspired by Lennart Borgman’s recent post on help.gnu.emacs about binding Caps Lock to M-x on Microsoft Windows, I set my system up with the Linux equivalent.

To make Caps Lock a shortcut for M-x, add the following lines to your ~/.emacs:

(if (eq window-system 'x)
    (shell-command "xmodmap -e 'clear Lock' -e 'keycode 66 = F13'"))
(global-set-key [f13] 'execute-extended-command)
Short URL: http://sachachua.com/blog/p/5034
  • http://wm-eddie.info Eduardo Gonzalez

    Caps Lock is definitely better as a control key. Your pinky finger will thank you for it. Luckily on my Japanese iBook they put the Control key where the Caps Lock key should be already.

    I wonder if it would be possible to make hitting Alt twice be M-x without interfering with the other M- bindings.

  • http://atomized.org Ian Eure

    I agree, Caps is much better as Control. I rarely press M-x, due to it’s inefficiency relative to other Emacs bindings. You use control mxh more than M-x. And caps is right on the home row, next to all those keys you use it with.

    What you might do is rebind M-x to a function key.

  • http://www.disruptech.com Paul Gaskin

    I went ahead and added that key-binding to my .emacs and it seems like an ergonomically useful addition.

  • http://www.sethmason.com seth

    Yeah, count me as another one that thinks caps lock is better served as a Control key.

    I’ve got M-x bound to C-x C-m (and C-c C-m because I’m spastic) which are a lot easier to type than M-x IMHO.

  • http://guerrillatech.wordpress.com p.daniels

    This is a really neat idea. Unfortunately, it doesn’t seem to be working for me. I assume it’s either because I run “emacs -nw” inside a urxvt session, or because I’ve already got caps lock modded to be Super in my .Xmodmap (my Model M doesn’t have a Super key).

    Spooky. My captcha is “Daniels.”

    best wishes,
    p.daniels

  • http://sachachua.com Sacha Chua

    p.daniels: It’s your Xmodmap, then. =)

On This Day...

  • 2012: Weekly review: Week ending August 3, 2012 — Lots of tech changes! Getting the hang of using my tablet. Upgraded to a new cellphone with a data plan. [...]
  • 2011: Drupal and JQuery 1.5: Fixing the JSON encoding of ampersands — Drupal 6′s drupal_json method encodes ampersands incorrectly for JQuery 1.5, causing the rather cryptic error: Uncaught Syntax error, unrecognized expression: [...]
  • 2010: Success and blogging — What’s success when you’re writing a personal blog–not a niche blog which you want to make money from through [...]
  • 2008: Finding something worth talking about — "I don’t know what I’d talk about," people often tell me when I encourage them to think of topics for [...]
  • 2008: Emacs and Gnus: zomg, new chapter out the door! — So I _finally_ pulled everything together and got my Gnus chapter out the door. Hooray, hooray, hooray! Reading Mail with Gnus [...]
  • 2008: OpenOffice.org: Replacing dingbats — I _really_ should have blogged this when I first wrote it. That would’ve saved me time writing it again! Sub ReplaceDingbats(optional [...]
  • 2007: No plans yet — My birthday’s coming up next week and I still don’t have any plans. Somehow, that realization makes me feel lonely. Is this [...]
  • 2006: Month in review — Check out my May, June, July, and August indices, too. =)
  • 2006: CookOrDie: Danger, Will Robinson! — Uh oh. I now know how to bake brownies from scratch, and I can make them as moist and chocolatey as I [...]
  • 2006: Social Tech Brewing: It’s all about choices — (I think about this a fair bit even as a 22-year-old because I want to know my values, and reflecting on [...]
  • 2006: Social Tech Brewing: Women in Technology — Today’s Social Tech Brewing event about Women in Technology gave me much to think about. I’ll blog a bit more about [...]
  • 2005: Chicken adobo results — I microwaved the chicken adobo for another minute and a half just to feel slightly better about it, and fried it [...]
  • 2005: On intelligence and wisdom — On mensaphilopen, Alistair Israel said: The smart ones realize that this it isn’t worth living in this country, and seek their fortune [...]
  • 2005: Finally! Internet! — I had been grumbling about it for all of five minutes as I fiddled about with various settings, finding it completely [...]
  • 2003: FOAF — Friend-of-a-friend descriptions are up at http://sacha.free.net.ph/notebook/foaf.rdf
  • 2003: Invitations — - Berris, Dean Michael – sent - Carreon, Mario – sent - lastname, Aimee – sent c/o Mario - Cimafranca, Dominique – sent - [...]
  • 2003: Women and technical courses — http://www-personal.si.umich.edu/~rfrost/courses/Women+Tech/readings/Margolis.html Link from JM Ibanez
  • 2003: Java — Calen is referring to the “Rethinking the Java Curriculum” article: http://www.onjava.com/pub/a/onjava/2002/08/21/javaxp.html With some interesting follow-up commentary here: http://fishbowl.pastiche.org/archives/000454.html
  • 2003: Enye (n with tilde) — - http://marc.free.net.ph:80/message/19991216.121601.49226c7e.html - http://marc.free.net.ph:80/message/20011213.093356.e7625d7b.html - http://marc.free.net.ph:80/message/20011213.180210.24306ae0.html - http://marc.free.net.ph:80/message/20011214.010850.5f9e91ed.html

Get the highlights as a PDF!

Stories from my Twenties: Highlights from a Decade of Blogging

Free sample!