Next: , Previous: , Up: Movement   [Index]


6.6 Bookmarks and Registers

Bookmarks in Manual §13.8

Bookmarks record positions you can jump to. They have long names, and they persist automatically from one Emacs session to the next. The prototypical use of bookmarks is to record where you were reading in various files.

Bookmarks in Emacs work identically to the ones in your web browser but with the notable exception of supporting a wider variety of sources. That makes Emacs’s bookmarking system flexible enough for you to bookmark:

Bookmarks are a very efficient way of jumping to frequently-used files or directories; it is also useful if there are sections of Emacs’s manual that you want to return to frequently. And because of the unified nature of Emacs — buffers — the three are seamlessly stored and recalled from the same list of bookmarks.

Bookmarks are saved to a bookmark file in $HOME/.emacs.d/ called bookmarks.

Bookmark File

The variable bookmark-default-file determines where Emacs stores your bookmarks.

The file is plain text (elisp ‘s-expressions’, actually) meaning it is possible edit it manually (if you absolutely must) or merge the files if you regularly add or remove bookmarks from multiple machines.

Here is a sample entry:

("mastering-emacs.org"
 (filename . "~/Dev/Emacs/MasteringEmacs/MasteringEmacs.org")
 (front-context-string . "# -*- mode: org;")
 (rear-context-string)
 (position . 1))

Bookmark Commands

Key BindingPurpose
C-x r mSet a bookmark
C-x r lList bookmarks
C-x r bJump to a bookmark

Table 6.2: Bookmark Commands

Register Commands

Registers, however, are different; they are the flip side of the coin — where bookmarks are permanent, registers are transient. A register is a single-character store-and-recall mechanism for several types of data, including:

A register is a single character only. When you want to store or recall something, you are asked for a single character to query.

Key BindingPurpose
C-x r nStore number in register
C-x r sStore region in register
C-x r SPCStore point in register
C-x r +Increment number in register
C-x r jJumpt to register
C-x r iInsert content in register
C-x r wStore window configuration in register
C-x r fStore frameset in register

Table 6.3: Register Commands


Next: Selections and Regions, Previous: Elemental Movement, Up: Movement   [Index]