Visual navigation through mark rings.


    (require 'back-button)
    (back-button-mode 1)
    press the plus sign in the toolbar to create a mark
    press the arrows in the toolbar to navigate marks
    or use C-x C-Space as usual


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:

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.

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.


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.


back-button is available at github:

and via EmacsWiki:


Compatibility and Requirements

Tested only on GNU Emacs version 24.1

Uses if present: smartrep.el, NavFlash, VisibleMark, UcsUtils

See Also


CategoryEditing CategoryNavigation