Holding Your Place with Bookmarks

Once you start working with multiple files, remembering just where you last were in each one becomes harder. Bookmarks, therefore, provide a convenient way of marking your place in a file, a place you can easily return to. You might, for example, be working with a file that has a long pathname. Rather than retype the pathname each time you start Emacs, you could just jump to a bookmark you’ve named current project by having Emacs find the file and put the cursor wherever you set the bookmark.

Bookmarks make the process of finding your place in any file easier. Particularly if you are working on a project several directories down from your home directory or in a totally different filesystem, putting bookmarks in the file makes it easy to get back there. In Chapter 7, we’ll discuss how to find files on remote systems using ange-ftp mode. You can bookmark these files as well, getting back to your favorite FTP archives in one simple bookmark jump.

If you access the World Wide Web from within Emacs (also described in Chapter 7), note that you can’t use Emacs bookmarks and W3’s hotlist entries interchangeably. Particularly since some popular browsers call their hotlist entries bookmarks, it’s important to be clear on this point.

When you create a bookmark, Emacs creates a bookmark file in your home directory, called .emacs.bmk. It saves any new bookmarks in this file automatically when you exit Emacs.

Bookmarks are stored by user. So if you and others access ...

Get Learning GNU Emacs, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.