1

I am using Emacs version 29.3 on macOS 14.4.1. I have installed it with home-brew from casks. It installs emacs with window system in addition to the terminal one.

I have the classic META key problem.

I need to have a META without using ESC. Since I am not used to releasing a modifier key. In case of using ESC as META one should release it, not bad but unusual at least for me.

I would prefer to configure it so that my left Option key as the META key and the right Option key as OS default ALT both in Emacs in terminal emulator and in window system (GUI) so that I can type the symbols for example # with Option-3, for example.

Here is the current situation:

  1. If I set the Use Option key as META key in the Terminal.app Settings, both Option keys become META, and goodbye symbols typeable with Option key, I cannot type symbols typeable with Option key. That is the problem of the Terminal.app.

  2. More over, in Emacs in window system, both Option keys behave as META key without any such configuration, out of the box, so no symbols chars typeable. If I add the configuration*, it works as I prefer.

  3. In Emacs in Terminal, even with a configuration* to change this, both Option keys are still Option keys but not META. (I mean even if I configure* Emacs (in ~/.emacs.d/init.el or via M-x customize groups for ns) left Option still does not work as META. (maybe all ns prefixes about the Apple GUI, not for Terminal apps, as it seems referring to the NeXTSTEP OS))

*configuration ~/.emacs.d/init.el:

(custom-set-variables
 '(ns-alternate-modifier 'meta)
 '(ns-right-alternate-modifier 'none))

All the suggestions seem to be explicitly or implicitly refer to the Emacs with window system (GUI) and does not work on Emacs with no window system, in a terminal.

How to achieve this effect? (Preferably via a more standard and non quirky way, or without involving a third party program, and through Emacs configuration and customization.)

Maybe inputting those special characters are meant to be different than using Option keys in Emacs, historically. I have no info on that context yet.

Once and for all there could be a simple solution for this issue. Still the current state is non consistent, and so, confusing, it could at least be consistent and based on explicit config.

3
  • Does this link answer your question? emacs.stackexchange.com/questions/8068/…
    – lawlist
    Commented Apr 13 at 16:05
  • Terminal Option key setting apparently not :). For the other reply I will try and turn back to you. But still I want to make sure there is no other way without those iTerm2 stuff setup.
    – sçuçu
    Commented Apr 13 at 17:48
  • The config given in question does not work indeed. I realize it is not that big a problem that ESC is META. It seems it has some historical context to be similar as well.
    – sçuçu
    Commented Apr 14 at 19:29

1 Answer 1

1

When inside of a terminal emulator Emacs has no control over what key does what. Remember that the terminal emulator is emulating a real hardware terminal that sent characters over a serial connection much like a Teletype machine did. It converts everything you type into characters and sends the characters to the program running in the emulator. Nothing you configure inside of Emacs can change how your terminal emulator works. If the terminal emulator you are currently using doesn’t work the way you want, maybe you need to find a different one that does.

3
  • So that is why people are using iTerm2 or some other terminal emulator. So how does vim people do it. In that respect I wonder how other things work in Emacs, as it is full of key bindings in usage. (curiosity meant literally)
    – sçuçu
    Commented Apr 13 at 17:47
  • 1
    Yes, this one of the reasons I use iTerm2. It has a lot more features than regular Terminal.app, including being able to set left option key and right option key separately.
    – amitp
    Commented Apr 14 at 21:56
  • I did the same and switched to iTerm2, though it was not really necessary as I can still use Emacs in Terminal and use ESC as META, no problem there.
    – sçuçu
    Commented Apr 18 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.