I'm trying to disable the command key when running emacs from the terminal. Whenever I mistakenly press CMD-V instead of ALT-V, the text from my Mac clipboard gets copied into the buffer. From related questions, I've tried adding setq mac-command-modifier 'none or 'meta and setq ns-command-modifier 'none to my .emacs file. There is no effect. How can I disable the command key in emacs? If I can't disable it, can I rebind CMD-V to do nothing?

  • I don't use Emacs in the terminal, but this works in the GUI version to effectively disable Command+v by causing it to do nothing except execute the function ignore: (global-set-key [?\s-v] 'ignore) – lawlist Mar 30 '18 at 21:17
  • Thanks for the suggestion, but adding this to my .emacs did nothing. – Dave Kielpinski Mar 31 '18 at 0:29

Isn't it just your terminal program pasting the text into the terminal? I'm not sure emacs can stop it.

If you are using iterm, one option is to create a separate profile for emacs, then under "Keys" bind command-V to ignore. You obviously would only want to run emacs under this profile to maintain normal pasting in other terminals.

| improve this answer | |

Your Answer

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

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