Next: , Up: Defuns   [Index]


J.1.2.1 Moving by Defuns

These commands move point or set up the region based on top-level major definitions, also called “defuns”.

beginning-of-defun

C-M-a

Move to beginning of current or preceding defun.

With a negative argument −N moves forward N times to the next beginning of a defun.

end-of-defun

C-M-e

Move to end of current or following defun.

With a negative argument moves back to an end of a defun.

mark-defun

C-M-h

Put region around whole current or following defun.

This is the easiest way to get ready to kill the defun in order to move it to a different place in the file. If the defun is directly preceded by comments (with no intervening blank lines), they are marked, too.