0

I'm confused about some CUA mode implicit behaviour that I got after upgrading Emacs, specifically:

  • Marking a region automatically copies it, without having to type C-c
  • Deleting a region automatically kills it, without having to type C-x

I find this confusing because I often want to kill a region with C-x, do a backspace on a second region to delete it and then paste with C-v to replace with the original region.

I find however that once I delete the second region, it replaces the first one in the kill ring and I get it pasted right back again after C-v.

EDIT: Here's an example of what is currently happening. Suppose I have a buffer with these two lines

This number is 1
This number is 2

I want to swap the characters 1 and 2 between the two lines. I try to take these steps:

Put a region around '1' and cut it with C-x. The character duly disappears:

This number is 
This number is 2

Put a region around '2' and type backspace to delete:

This number is
This number is

Put the cursor at the end of the second line and type C-v in the hope that it will paste the '1' character. What I get instead is:

This number is
This number is 2

So, deleting the region around '2' implicitly put it in the kill ring, as if I had typed C-x.

A similar thing happens just by setting the region, which CUA is implicitly copying as if I had typed C-c. If I then move the cursor somewhere else and type C-v, I get the region pasted back.

Is this normal behaviour? I would prefer to do the cutting and copying explicitly, without CUA doing it behind my back.

3
  • 1
    Welcome to Emacs.SE! Could you please edit your post to clarify what your question is?
    – Dan
    Dec 14, 2016 at 16:38
  • What @Dan said. Consider providing a step-by-step recipe, which shows what happens, and say what you expected/wanted to happen instead.
    – Drew
    Dec 14, 2016 at 16:52
  • When you need to clarify a post, please edit the original question rather than post an answer.
    – Dan
    Dec 14, 2016 at 20:11

2 Answers 2

1

I found the culprit. I had this customisation in my .emacs that I had forgotten about:

(select-enable-primary t)

I don't understand how this would interfere with CUA but I removed this customisation without any observable adverse effects so far.

0

I do not see what you report, when starting Emacs using emacs -Q (no init file).

Do you? If not, then recursively bisect your init file to find out what part of it is interfering. You can comment out a region of text using command comment-region. Comment out 1/2, then 3/4, 7/8,... until you locate the problem.

(A step-by-step recipe to reproduce a problem should include anything you've done to modify the default Emacs behavior, i.e., what you get using only emacs -Q.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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