April 14, 2005

Emacs essentials

I'll be adding to this entry at times. It's a place to store a grab-bag of useful keyboard shortcuts for emacs.

C-h v - describe a variable
C-h f - describe a function
C-h k - decscribe a key binding

With C-h v and C-h f you can press tab to auto-complete and get a nice long list of the variable or function names. This is quite useful when poking around emacs with a view to learning more of its functionality.

More about rectangles

C-x r k
Kill the text of the region-rectangle, saving its contents as the "last killed rectangle" (kill-rectangle).
C-x r d
Delete the text of the region-rectangle (delete-rectangle).
C-x r y
Yank the last killed rectangle with its upper left corner at point (yank-rectangle).
C-x r o
Insert blank space to fill the space of the region-rectangle (open-rectangle). This pushes the previous contents of the region-rectangle rightward.
M-x clear-rectangle
Clear the region-rectangle by replacing its contents with spaces.
M-x delete-whitespace-rectangle
Delete whitespace in each of the lines on the specified rectangle, starting from the left edge column of the rectangle.
C-x r t RET string RET
Insert string on each line of the region-rectangle (string-rectangle).