Disconnect Cm from RET

In my emacs configuration file, I created a minor mode so that I could re-bind the keys without having to double-check them separately for each main mode.

In doing so, I reassigned Cm to kill-ring-save . However, by default, emacs Cm same as RET . Therefore, when in my .emacs there is the following:

  (define-key my-minor-mode-map (kbd "Cm") 'kill-ring-save) 

When I press the return key, kill-ring-save is executed

How can I fix my configuration file so that I do not encounter these problems?

I am also open to a different approach to creating a key binding that works in all major modes.

Edit: I work in graphical mode

+4
source share
1 answer

This will not work in non-graphical emacs mode. When running in the terminal, return and Cm are not different.

If you are not using terminal mode emacs, just drag <return> and Cm separately.

For instance:

 (cond (window-system ; ensure not running in a terminal (local-set-key (kbd "<return>") 'newline) (local-set-key (kbd "Cm") 'kill-ring-save))) 
+8
source

Source: https://habr.com/ru/post/1369564/


All Articles