This page is a tutorial on emacs's bookmark feature. Emacs's Bookmarks is similar to browser's bookmark. Emacs bookmark lets you easily open frequently needed files.
Open the file you want to add. Then, call bookmark-set 【Ctrl+x r m】 . It will prompt you for a name.
To open bookmark, call bookmark-bmenu-list 【Ctrl+x r l】. This displays your bookmarks. From there, you can open your files, by just pressing Enter ↵, click on it, or press o to open it in a split window.
When your bookmark file is open , call bookmark-save 【s】 to save it. If you don't save it, newly added bookmarks will be for the current session only, and won't show up when you restart emacs.
When in the bookmark file, type D to remove a file listing, or type r to rename its bookmark title.
Bookmark commands are right under the menu 〖Edit ▸ Bookmarks〗. If you forgot the commands or shortcuts, look at the menu. The menu is a great way to remember many emacs's commands.
Also, the bookmark commands all starts with “bookmark-”. The only one you really need to remember is bookmark-bmenu-list. Once you have the bookmark open, you can call describe-mode 【F1 m】 to see its commands and shortcuts.
To have emacs open bookmarks on startup, add this to the end of your elisp init file:
(setq inhibit-splash-screen t) (require 'bookmark) (bookmark-bmenu-list) (switch-to-buffer "*Bookmark List*")
In emacs 24.x, bookmark file is at 〔~/.emacs.d/bookmarks〕.
In emacs 23.x, it's at 〔~/.emacs.bmk〕.
The default location is controlled by the variable bookmark-default-file. Call describe-variable 【F1 v】 to see its value.
In emacs 23.2, many preference files are moved to the 〔~/.emacs.d/〕 directory. 〔☛ Emacs 23.2 Features〕 However, bookmark didn't make it. You can set it yourself, like this:
(setq bookmark-default-file (concat user-emacs-directory "bookmarks"))
The syntax to load a bookmark file is this:
(bookmark-load bookmark-default-file t)
See: Emacs: Open File Fast: recentf-mode
See also: Emacs Lisp: Hotkeys to Open File Fast
blog comments powered by Disqus