I’d like to do something like fill-region, except that I want to select a rectangle region and wrap only the text inside it, and have it stay within the rectangle bounds. Is there a way to do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Edit: Ah, I knew I’d encountered this ability before.
The rectangle editing abilities in
cuaprovide this feature.So first enable
cua-selection-mode. That’s the good stuff in CUA without the copy/cut/paste key changes, so you might want it on permanently:And then C-RET to mark a corner, move point to the opposite corner, and C-q as normal to fill. C-RET again to exit the rectangle mode.
CUA’s rectangle editing is pretty awesome. Read about it in the commentary of M-x
find-libraryRETcua-baseRET. Look for the “CUA rectangle support” heading.Original answer: