Emacs: Bookmark
Emacs Bookmark feature lets you easily open frequently needed files.

Add a Bookmark
bookmark-set
【Ctrl+x r m】- Add current file or dir to bookmark.
List Bookmarks
list-bookmarks
【Ctrl+x r l】- Open the bookmark list.
Open a Bookmark
bookmark-jump
【Ctrl+x r b】- Open a bookmark.
Tip: turn on
fido-vertical-mode
for flex matching. [see Emacs: icomplete mode, fido mode]
Delet, Rename a Bookmarks
First,
Alt+x list-bookmarks
, then
- Type d to mark the current item for deletion.
- Type x to delete all D marked ones.
- Type r to rename current bookmark's title.
- Type s to save the change.
Save Bookmark File
- Alt+x
bookmark-save
- save the bookmark file. (Press s while in bookmark file)
Auto-Save Bookmark
Bookmark file is automatically saved when emacs quit, since Emacs 24.4 (2014)
- bookmark-save-flag
-
variable. the value specify whether to auto-save the bookmark file.
- nil → means don't auto save.
- t → means save when emacs quit.
- number → 1 means save after 1 change. 2 means save after 2 changes. etc.
Since Emacs 24.4 (2014), it's the default value is t.
put this in your Emacs Init File:
;; save bookmark on change (setq bookmark-save-flag 1)
Open Bookmark File on Emacs Start
put this in your Emacs Init File:
(setq inhibit-splash-screen t) (require 'bookmark) (list-bookmarks) (switch-to-buffer "*Bookmark List*")
Bookmark File Location
- bookmark-default-file
- variable. Value is Bookmark file path. [see Emacs: Show Variable Value]
- In emacs 24 (2012), bookmark file by default is at
~/.emacs.d/bookmarks
. - In emacs 23 (2009), bookmark file by default is at
~/.emacs.bmk
.
[see Emacs Version History]