Skip to content
Visual navigation through mark rings in Emacs
Find file
Pull request Compare This branch is 129 commits behind rolandwalker:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Visual navigation through mark rings in Emacs.


Back-button provides an alternative method for navigation by analogy with the "back" button in a web browser.

Every Emacs command which pushes the mark leaves behind an invisible record of the location of the point at that moment. Back-button moves the point back and forth over all the positions where some command pushed the mark.

This is essentially a replacement for pop-global-mark, and the default keybindings (when the minor mode is activated) override that command. The differences with pop-global-mark are:

  • Visual index showing how far you have traveled in the mark ring.

  • Easy way to move both forward and backward in the ring.

  • Pushes a mark on the first of a series of invocations, so you can always return to where you issued the command.

  • Skips duplicate positions, so that the interactive command always moves the point if possible.

Commands and keybindings are also included to give identical semantics for navigating the local (per-buffer) mark-ring. This consistency in navigation comes at the cost of pushing the mark twice, so experienced Emacs users may prefer to unbind these commands and/or set back-button-never-push-mark in customize.

When the visible-marks package is installed, marks will be made visible in the current buffer during navigation.


This library depends upon other commands pushing the mark to provide useful waypoints for navigation. This is a common convention, but not universal.

The function back-button-push-mark-local-and-global may be useful to call from Lisp. It is essentially a replacement for push-mark which unconditionally pushes onto the global mark ring, functionality which is not possible using vanilla push-mark.

Theoretically, back-button-push-mark-local-and-global could cause issues with Lisp code which depends on the convention that global-mark-ring not contain consecutive marks in the same buffer. However, no such issues have been observed.

Default key bindings

C-x C-<SPC> go back in global-mark-ring, respects prefix arg
C-x C-<left> go back in global-mark-ring
C-x C-<right> go forward in global-mark-ring

C-x <SPC> go back in (buffer-local) mark-ring, respects prefix arg
C-x <left> go back in (buffer-local) mark-ring
C-x <right> go forward in (buffer-local) mark-ring

When the smartrep package is installed, the C-x prefix need not be used for consecutive back-button commands.

Something went wrong with that request. Please try again.