Next: Selections and Regions, Previous: Elemental Movement, Up: Movement [Index]
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
.
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))
Key Binding | Purpose |
---|---|
C-x r m | Set a bookmark |
C-x r l | List bookmarks |
C-x r b | Jump to a bookmark |
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 Binding | Purpose |
---|---|
C-x r n | Store number in register |
C-x r s | Store region in register |
C-x r SPC | Store point in register |
C-x r + | Increment number in register |
C-x r j | Jumpt to register |
C-x r i | Insert content in register |
C-x r w | Store window configuration in register |
C-x r f | Store frameset in register |
Next: Selections and Regions, Previous: Elemental Movement, Up: Movement [Index]