Top Ten Mac OS X Tips for Unix Geeks
Subject:   Emacs: Meta-Control, how to do it in Terminal?
Date:   2003-02-14 05:26:37
From:   anonymous2
There are some Emacs keybord shortcuts, such as ESC C-c for exit-recursive-edit, that seem impossible to do in Terminal from the Mac keyboard. I use ctrl-option for the meta or ESC key, but just pressing these keys and releasing them doesn't do anything, so pressing ctrl-C afterwards is just ctrl-C, not ESC C-c. How to handle this?
Full Threads Oldest First

Showing messages 1 through 6 of 6.

  • Emacs: Meta-Control, how to do it in Terminal?
    2005-12-29 05:58:31  Trondtr [View]

    This is the bug that most of all makes me long for os9, but apart from this crucial omission, osX is great.

    In os9, i pressed ctrl-x etc for emacs C-x, and I pressed (simultaneously) ctrl-alt-x for emacs M-x. Only for some commands you have to press ESC and then the key. In osX, this possibility is blocked. In terminal settings (Keyboard), I can choose to have alt key set as meta key, but that road is blocked, for obvious reasons: Being a linguist, I need the alt key to various non-ascii letters, this was what made me a mac user in the mid eighties. In os9, there was a further option: "alt option as meta". So, how can I get my meta back?

    • Emacs: Meta-Control, how to do it in Terminal?
      2006-11-23 21:27:14  fluxion [View]

      A very kind person wrote this:

      I found a way to switch which key Mac OS X recognizes as meta. First, uncheck the “Use the system keyboard layout” option in X11 preferences. Then, create the file ~/.Xmodmap and insert the following six lines:

      clear Mod1
      clear Mod2
      keycode 63 = Mode_switch
      keycode 66 = Meta_L
      add Mod1 = Meta_L
      add Mod2 = Mode_switch

      It clears the keymappings for alt and escape and then reassigns them to the reverse of what they were before. Restart X11 and it should pick up the changes.

      • Emacs: Meta-Control, how to do it in Terminal?
        2007-09-02 15:03:00  Antonio666 [View]

        I don't think that the question was about anything under X11... It's about, which is not an X11 application.

        I also have been very frustrating by its inability to send the Control+Meta combination. As far as I can tell, there isn't a *single* terminal emulator that runs under OSX capable of sending it. My everyday work requires me to use a console emacs through an ssh connection, so being able to type it is very important. (The alternative is to a highly unergonomic need to press ESC every other keystroke!).

        If anyone figures out a fix, I'd *love* to hear it!



        [In the meantime, I'll try that X11 trick. It might be the next best thing...]

        • Emacs: Meta-Control, how to do it in Terminal?
          2007-10-05 02:19:56  aguest [View]

          You can try pressing "Esc" then Control-anotherkey, it's cumbersome but should work.

          If you look with Google you should find some config examples where are redefine a lot (all?) of terminal keys combinations (and the equivalent binding inside Emacs), but i don't recall if Meta-Control could be flawlessly integrated...
          • Emacs: Meta-Control, how to do it in Terminal?
            2008-06-18 19:47:35  denalilumma [View]

            Hi There,

            You need to configure the mac 'terminal' application so the 'alt / option' key sends 'meta'. In order to do this, go to:

            Terminal > Preferences > Settings > Keyboard

            and select the 'Use option as meta key' checkbox at the bottom of the window.

            I hope that helps,

            • Emacs: Meta-Control, how to do it in Terminal?
              2009-01-26 17:49:12  chompx [View]

              Dude. You rock. Thx.