2

I have tried using Cua mode (via adding (cua-mode t) to my ~/.emacs file) but it doesn't seem to set the copy keybinding to Ctrl-c. See for example this screenshot showing my Edit menu:

enter image description here

I have tried adding this line to my ~/.emacs file:

(global-set-key (kbd "C-c") 'kill-ring-save)

but still C-c doesn't copy selected text in an Emacs buffer (and the Edit menu looks the same as in the above screenshot). If you are wondering whether some other line in my ~/.emacs file is overriding this one, feel free to see for yourself. Here is my ~/.emacs file.

  • Try C-h k C-c to see what C-c is bound to. – xuhdev Dec 8 '16 at 10:54
  • Here is a screenshot showing what it does. It doesn't seem to recognize it as a keybinding by itself. – BH2017 Dec 8 '16 at 10:57
  • Yes, because global-set-key always set keys with the prefix C-x. Try C-h k C-x C-c – xuhdev Dec 8 '16 at 10:59
  • It doesn't seem to recognize that sequence of keybindings either, after C-x it just sees C-c (and forgets preceding key strokes). Here is my screenshot. – BH2017 Dec 8 '16 at 11:02
  • 3
    You seem to have multiple questions that all ask about how to get CUA mode key bindings to work. Please consider deleting all but one. There is no need for a question about C-c, another question about C-x, another about C-a, another about C-z, another about... – Drew Dec 8 '16 at 16:30
3

I have tried using Cua mode (via adding (cua-mode t) to my ~/.emacs file) but it doesn't seem to set the copy keybinding to Ctrl-c.

It does, but only when you highlight text, see CUA Bindings f1rmcuaRET

The command M-x cua-mode sets up key bindings that are compatible with the Common User Access (CUA) system used in many other applications.

When CUA mode is enabled, the keys C-x, C-c, C-v, and C-z invoke commands that cut (kill), copy, paste (yank), and undo respectively. The C-x and C-c keys perform cut and copy only if the region is active. Otherwise, they still act as prefix keys, so that standard Emacs commands like C-x C-c still work. Note that this means the variable mark-even-if-inactive has no effect for C-x and C-c (see Using Region).

For technical reasons, f1cC-c when text is highlighted says C-c runs the command cua--prefix-override-handler rather than kill-ring-save or cua-copy-region, and similarly the menu won't reflect the CUA bindings.

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.