Emacs: Bookmark

By Xah Lee. Date: . Last updated: .

Emacs Bookmark feature lets you easily open frequently needed files.

emacs bookmark 2022-10-04
emacs bookmark 2022-10-04

Add a Bookmark

bookmark-setCtrl+x r m
Add current file or dir to bookmark.

List Bookmarks

list-bookmarksCtrl+x r l
Open the bookmark list.

Open a Bookmark

bookmark-jumpCtrl+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

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.

[see Emacs: Show Variable Value, List Variables]

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]

[see Emacs Version History]

Emacs, File and Buffer


Emacs Tutorial

Quick Start

Font

Split Window

File

Buffer

Copy/Paste

Find Replace

Unicode

Whitespace

Rectangle Edit

Line Wrap

Shell

View Special File

Editing Brackets

Org Mode

HTML

Emacs Efficiency

Misc