Emacs's Bookmarks is similar to browser's bookmark. It lets you easily open frequently needed files.
Add a Item to Bookmark
bookmark-set【Ctrl+x r m】
- Add current buffer to bookmark. It will prompt you for a name. Bookmark can be a file or a directory.
List Bookmark Items
list-bookmarks【Ctrl+x r l】
- Open the bookmark list.
Open a Item in Bookmark
bookmark-jump【Ctrl+x r b】
- Open a file in bookmark. Emacs will prompt for a name. You can type a asterisk
*for wildcard. For example, “*today” will match “todo today”.
Remove/Rename a Bookmark Item
When in the bookmark file:
- Type d to mark the current item for remove.
- Type x to remove all D marked ones.
- Type r to rename current item's title.
- Type s to save the change.
Save Bookmark File
bookmark-save to save the bookmark file. (Press s while in bookmark file)
Bookmarks are automatically saved when emacs quit. (Emacs 24.4 (released 2014-10))
You can control bookmark auto save behavior by bookmark-save-flag.
;; everytime bookmark is changed, automatically save it (setq bookmark-save-flag 1)
Set Emacs to Open Bookmark File on Start
To have emacs open bookmark file on startup, add this to the end of your elisp init file:
(setq inhibit-splash-screen t) (require 'bookmark) (list-bookmarks) (switch-to-buffer "*Bookmark List*")
Bookmark File Location
In emacs 24.x, bookmark file is at
In emacs 23.x, bookmark file is at
The default bookmark file path is stored in the variable bookmark-default-file. Alt+x
describe-variable 【Ctrl+h v】 to see its value.