Skip to main content

Objed spotlight: Move to first or last instance

I got asked to write a tutorial for objed, similar to the built-in help-with-tutorial. The main reason I haven’t done this yet, is that key bindings and behavior still change from time to time. I plan to write such a tutorial a soon as objed reaches 1.0. In the meantime I want to publish a couple of posts, for the early adopters and maybe other curious people. Each of these posts will be a short description of one specific feature.

This post assumes that you already understand the basic concepts of objed. If that’s not the case please read the introduction first.

As the title suggests this post is about moving to the first or last instance of an object. In recent versions you can do this using < or > respectively.

The simplest use case is to move to the first or last line of the current buffer. When the line object is active, < or > will take you to the first or last non-empty line. For buffers containing Emacs Lisp code I often find it useful to jump to the first line of the actual code and skip any possible headers and comments. One way to do this with objed, is by switching to the defun object, for example by pressing c d and jump to the first one using <.

Another use case is to jump to the definition of a function or some variable. After you have chosen the identifier object using ., < will take you to the first occurrence of this symbol, which usually is the definition.

If you ever want to go back to some place you where before, use u. It lets you pop to previous objects from the history stack.

That’s it for the current spotlight, I hope you got something out of it.

See you in parendise!

Comments on Reddit