help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question: meta key works in terminal but in emacs


From: Perry Smith
Subject: Re: Question: meta key works in terminal but in emacs
Date: Sat, 11 Apr 2020 19:34:32 -0500

> On Apr 11, 2020, at 6:47 PM, Zhe Li <zacli@pdx.edu> wrote:
> 
> Hi there,
> 
> I recently installed emacs-mac-port and spacemacs with brew casket. I want
> to set the option key to meta. I did so on terminal preference and now the
> option key works as meta on terminal. But the option key doesn't work in
> emacs. When I type option+v it comes out as check marks. So the option key
> in emacs is still option/alt key. My system is macOS 10.13. Any idea why
> that is the case?

I don’t know those two ports.  I use EmacsForMacOS:
https://emacsformacosx.com <https://emacsformacosx.com/>

I use to build my own emacs.  As I recall, I tried the brew but didn’t like it 
but
that is just a vague memory.

I *think* everything that follows still applies but obviously I’m not sure.

You have three places to muck with things and you kinda have to mess
with them to find out what works best for you.

First is Apple => System Preferences => Keyboard.  Lower right is
“modifier keys”.  (But don’t change them yet! :-). Notice at the top is
a pull down for each keyboard that you have.  For me, I have my native
Mac laptop keyboard as well as a wireless non-Apple keyboard.

Second, as you mention, Terminal => Preferences => Keyboard is a
checkbox for “Use Option as Meta key”.

The magic that you might be missing is inside Emacs is a whole set
of variables such as ns-control-modifier which has an alias of 
mac-control-modifier.  There are others…

If you do M-x customize-group “ns” you will see the whole set of them.

Note that I am using emacs as a Mac windows client and not inside Terminal.
I much prefer the GUI mode even though I’m not really a GUI person.

One thing I would suggest is to use (in Terminal) `od -cx` … then type some
keys such as option+F and hit return and see what the keyboard is actually
sending.  The reason I mention the GUI mode is in that mode, emacs is
receiving key events and not a sequence of characters.  Some options,
like the options in Terminal, won’t have any effect on emacs in GUI mode.

My system is at 10.15 but I’m 99% sure all of the things above were in 10.13.

Good luck!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]