I paste this text, copied from IBM's social responsibility, into an Emacs buffer where the frame is 80 characters, or is small enough to cause a line-wrap:

02 Education and skills  

We are reinventing education for the era of AI and helping to prepare young people around the world for the jobs of tomorrow.

I select lines 1-4 until the middle of the last sentence. I do C-x r t for string rectangle. The first three lines vanish! Here is a screenshot before the string rectangle command:

Screenshot before string rectangle

And a screenshot after string rectangle (C-x r t):

Screenshot after string rectangle

This also happens when launching with emacs -Q to skip customizations. It also happens when the last line is longer than the current fill. It does not happen when the frame is wide enough or when the last sentence is reflowed to fit on two lines.

Am I doing something wrong or is this a bug worth reporting?

1 Answer 1


Wrapping is purely visual. The rectangle is based on the real lines, not the visual lines. Switch off the wrapping (probably with M-x toggle-truncate-lines), and the reason for the behaviour will be more obvious.

Note that you can use the various fill commands to create genuine line breaks in the text.

  • Yes, I have been using M-q to refill the text. I switched off line wrapping and I think that now I understand the behavior of string-rectangle. I thought it only served to add characters, but it deletes all the characters in each line from the column index of the mark to the column index of point, and then adds more characters at those indices in each line. That's much more powerful than I thought! I read the manual and it makes sense now.
    – emonigma
    May 29, 2019 at 7:25

Your Answer

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

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