I'm learning Emacs. On my Macbook, I have in keyboard settings:

  • Capslock and Ctrl key swapped
  • Option and Command key swapped

Emacs commands like ctrl-r, ctrl-s work fine for me (obviously I use them in the shell).

However my left hand is starting to hurt from too many M-x commands, so I want to:

  • disable left option and left command keys (to force me to stop using them)
  • enable right command or option for meta

I have put the following in my ~/.emacs.d/init.el. I started the tutorial, when I enter command-v or option-v to scroll backwards, text gets pasted into Emacs.

How do I fix my configuration?

(setq ns-option-modifier      'none                                                 
      ns-right-command-modifier 'meta                                               
      ns-right-option-modifier 'super                                               

; notes:                                                                         
; ns-alternate-modifier                                                             
; ns-command-modifier                                                               
; ns-control-modifier                                                               
; ns-function-modifier                                                              
; ns-option-modifier (just a different name for ns-alternate-modifier)              
; ns-right-alternate-modifier                                                       
; ns-right-command-modifier                                                         
; ns-right-control-modifier                                                         
; ns-right-option-modifier                                                          
; 'control, 'meta, 'alt, 'super, 'hyper or 'none
  • Can we eliminate swapping keys at the system level, and can we eliminate the possibility that you are using Emacs in the terminal, so that this question becomes more manageable? Then once that basic question is answered, you can start swapping keys to your heart's delight ... If you are using Emacs in the terminal, then the question takes on a different tone. – lawlist Nov 24 '17 at 5:46
  • OK I'll have a play. I'm running the GUI version, not in a terminal. – Sonia Hamilton Nov 24 '17 at 13:34
  • (setq ns-alternate-modifier 'none ns-right-alternate-modifier 'meta ns-command-modifier 'none ns-right-command-modifier 'super ns-control-modifier 'control ns-right-control-modifier 'left ns-function-modifier 'none) – lawlist Nov 24 '17 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.