This is the block of text that I intend to copy as rectangle (without the line numbers).

   4. ALM_KRmet_RPMP_J_H


  • I keep the cursor in the first line (after the 1.)
  • Press C-x SPC - This enables rectangle-mark-mode
  • I move down along the same column to the last line
  • When I reach the end of the text in the last row, the cursor wouldn't move further to the end of the text in the first row.

When I copy or cut, it leaves the un-highlighted portion (or unselected portion) of the text in the previous lines and copies / cuts only that is selected.


What should I do, if I intend to copy the entire block of text (with the smallest length text in the last row)
Is there a straight forward way to achieve this? Sublime text is able to do it without any issues.

  • Do you see the same thing when you start Emacs using emacs -Q (no init file)? If not, bisect your init file to see what's causing it. – Drew Feb 28 '17 at 15:29
  • @Prasanna: I can't reproduce this (Emacs 25.1.). I'm using C-e and then C-fto move the cursor in the last line.... – Dieter.Wilhelm Feb 28 '17 at 16:03
  • As Stefan mentions, this is fixed in Emacs 25. However note that in this particular case you can trivially use the end of the first line as one of your corners. Otherwise you would insert some spaces temporarily (or use the trick of temporarily enabling artist-mode to let you move the cursor past the ends of lines without inserting spaces). – phils Feb 28 '17 at 21:32

My crystal ball tells me you're using Emacs-24.5, which indeed had this limitation. This has been fixed in Emacs-25 where rectangle-mark-mode has been improved so you can move the cursor past the "end" of a line (and where you can use C-x C-x to go to another corner of the rectangle as well).


I usually do this by moving point to the end of the last line in the block, just as you have described, but then I insert spaces at the end of the line until point is in the last column that I want to cut. Then C-x r k cuts the entire rectangle; spaces will be added to the ends of any lines that are shorter than the width of the block.

  • 1
    And note that a M-\ after the copy command will delete all the trailing spaces in a single step. Or you may prefer to simply undo them (which is most likely also a single step). – phils Feb 28 '17 at 21:37

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.