To switch between tasks on an unaltered MacOS Mojave (OS X 10.14.6), one uses command-tab, which is convenient when done with the thumb finger. Now, in order to turn on the meta key inside Terminal (to allow e.g. skipping words with the cursor inside bash backward and forward emacs-style), I can tick the 'use Option as Meta key' in Terminal.app preferences.
This setup leaves me with option as meta key inside emacs, which is not ergonomic, as the key is physically too much on the left and my thumb finger needs to bend to get there.
I would like to:
- leave the command-tab system-wide key unaltered, in order to be able to exit the emacs context into another task
- still have the command key to be the meta key in emacs (so that, e.g., meta-f and meta-b hop over words)
- all of this while working inside terminal emacs, not emacs with GUI variant
Some things I tried:
- swapping the command and option buttons in System Preferences/Keyboard/Modifier keys. This results in a need to press option-tab for the task manager
- setting the
mac-command-modifier
variable, as explained here, however my emacs 26.3, installed viabrew install emacs
, doesn't seem to know about this variable (ctrl- h-v doesn't recognize it at all and changing the variable doesn't have any effect)
Can this be done? In other words, is there a way to have the command key be meta
in emacs and yet have command-tab still switch between tasks system-wide?
ns-alternate-modifier
;ns-right-alternate-modifier
;ns-command-modifier
;ns-right-command-modifier
;ns-control-modifier
;ns-right-control-modifier
;ns-function-modifier
. They are defined in the C source code librarynsterm.m
.brew install emacs
a couple hours ago. Ctrl-h-v ns- and then tab doesn't yield anything. However I think I got what I wanted using iTerm2 and it's ability to remap the command key, I'll post answer about that.--with-ns
. I don't usebrew
though, so you may need to Google the Apple/Mac recipe. When building Emacs for Mac, the C source code librarynsterm.m
is used and so is thens-win.el
Lisp library during the build process. The latter Lisp library mentioned sets up thedefvaralias
that you mention in your question above.