0

I have CUA mode enabled, but sometimes when I hit C-c, emacs simply does not copy anything because it starts to think Iam typing some C-C something command. I tried:

(global-set-key (kbd "C-c") 'cua-copy-region)

Emacs simply ignores this setting. How to force C-c to do JUST cua-copy-region? Really, its starting to get on my nerves...

3

Considering conventions and the fact that it will be pretty much impossible to change what C-c and C-x are supposed to mean in Emacs, the answer is that you won't be able to do that. Both have their significant meanings, they're assumed to be there, and modes are supposed to be able to safely assume that these are prefix keys.

Since using Emacs without these prefix keys is pretty much impossible, and you might need to use keys starting with these prefixes with region active, there has to be a way to explicitly use these keys as their intended prefixes.

If you take a look at the docstring for cua-mode, you'll find this relevant part:

CUA mode is a global minor mode. When enabled, typed text replaces the active selection, and you can use C-z, C-x, C-c, and C-v to undo, cut, copy, and paste in addition to the normal Emacs bindings. The C-x and C-c keys only do cut and copy when the region is active, so in most cases, they do not conflict with the normal function of these prefix keys.

If you really need to perform a command which starts with one of the prefix keys even when the region is active, you have three options:

  • press the prefix key twice very quickly (within 0.2 seconds),
  • press the prefix key and the following key within 0.2 seconds, or
  • use the SHIFT key with the prefix key, i.e. C-S-x or C-S-c.

If you're pressing keys fast, or pressing these prefixes without an active region, the intended functionality of cua-mode kicks in.

  • This is insane, in 2019, Emacs is not able to consistently copy stuff after hitting C-c. After magit update, no copying using CUA can be done in magit status buffer. I really regret I invested so much time in Emacs. Its shit. – dev1223 Jul 5 at 19:11

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.