When you mark regions to move or delete, they always cover the full width of the screen. Editing by region is fine for most of the work that you do in Emacs. But what if you wanted to edit a table? Since regions cover the full width of the screen, they can’t handle this case. Emacs offers another way to define areas to delete, copy, and move around: using rectangles. Rectangles are just what they sound like: rectangular areas that you define and manipulate using special rectangle editing commands. Editing with rectangles is useful whenever you want to move or delete vertical columns of information; for instance, moving a column of a table, of adding or deleting comments accompanying code.
For example, let’s say you want to edit the following table, moving the “Working Hours” column to the right side. There’s no way to do this using regions, but it’s easy to do if you learn some rectangle editing commands.
You define a rectangle the same way you define a region; the commands you use after marking the area tell Emacs whether you want to work with a region or a rectangle.
To define a rectangle, move the cursor to the upper-left corner and set the mark by pressing C-@ or C-SPACE, then move the cursor to the lower-right corner of the rectangle. Once you’re at the lower-right corner of the rectangle, move one character farther. Why move one character ...