Emacs Rectangle Editing quick help

Enter picture mode (ESC-x picture-mode)

Marking rectangle

  • Go to top left corner, press CTRL-Space.
  • Go to bottom right, press CTRL-x-x (This selects the rectangle)

Working on rectangle

  • Press CTRL-x-r-k to kill the rectangle (and make it available as 'last-killed-rectangle')
  • Press CTRL-x-r-d to delete the rectangle
  • Press CTRL-x-r-y to yank 'last-killed-rectangle' with its top right at the mark.
  • Press ESC-x-clear-rectangle to fill the rectangle with spaces.

Finally quit the picture mode with CTRL-c-c

3 thoughts on “Emacs Rectangle Editing quick help

  1. I think that using picture mode is not necessary.
    You could simply select the text as usual and then use the rectangle commands.


  2. Vaibhav: I tried on gnu emacs and xemacs, in both, I was able to quit picture mode by CTRL-c-c. Maybe your environment has unbounded the key combination or bound it to something else. Try full commands instead of keystrokes: i.e. ESC-x-kill-rectangle ESC-x-delete-rectangle , ESC-x-yank-rectangle and ESC-x-clear-rectangle.

    Luca: Without picture mode, you cannot select a rectangle, only multiple lines. (Update it seems you can still use the full commands, but you lose the keybindings)

Leave a Reply