I do not want an answer about something like Imenu or tags - features that suppose you know some keywords about the method/function name to move to.

What I want is just general commands which jump forward to next or jumps backward to previous method, e.g. in ruby-mode or emacs-lisp-mode.


Use C-M-a (beginning-of-defun) to move backward before each "defun" (top-level sexp).

Use C-M-e (end-of-defun) to move forward after each "defun".

To move across several by repeating, just hold down Control, Alt (Meta), and a or e.

To move forward/backward N defuns, use a numeric prefix arg. E.g. C-u 1 0 C-M-e moves forward 10 defuns.

(There are several pairs of commands that end in a or e, for moving to the beginning or end of things. The most commonly used are probably C-a and C-e.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.