I have researched it. Most post said this way:

C-SPC C-n M-w

It works. But in my case. It only copied a block where the cursor moved. Not the whole lines area I want.

For example, the source below:

1 def hi():
2    print("hi")
3 .  print("hi")
4    print("hi")

The operations I did:

  1. At the beginning of line 1, click C-x SPC (Because I'm using macOS so C-SPC not work, the keys are conflict)
  2. Move down using C-n until line 4
  3. Click C-e to the end of the last line ensure to get all the area I want
  4. Finally click M-w to copy them.
  5. Paste them at other area by C-y. The line 1 likes def hi():_____ with visible space

I can copy the content until col 16, but without the area afterward. So if I paste the content somewhere, the layout went bad.

Key conflict

enter image description here

  • Can you explain a little more about the file you had, what you expected to happen, and what actually happened? – zck Jun 19 '19 at 3:03
  • @zck Yes, I edited it. – 02040402 Jun 19 '19 at 3:13
  • @phils I edited the question again. Is it clear now? – 02040402 Jun 19 '19 at 7:44
  • How often do you change the keyboard input source. I would expect most people to bne monolingual and never change their keyboard. – mmmmmm Jun 19 '19 at 12:52

The problem is that C-x SPC does something different from C-SPC - it is bound to rectangle-mark-mode, which causes the behaviour you're seeing: the selection is rectangular, rather than a range of text.

One thing you can do is using C-@ instead of C-SPC - both are bound to set-mark-command by default. Or you could find some other key binding that's convenient for you, and set it in your Emacs init file. For example, use Control-Tab with:

(global-set-key (kbd "C-<tab>") 'set-mark-command)
  • Thank you very much. It's a very clear answer! – 02040402 Jun 19 '19 at 11:22

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.