Xah Lee, 2010-01-12, …, 2011-05-22
This page is a tutorial on emacs's bookmark feature. It lets you easily open files that you use frequently in one central location.
You have lots files you work with daily but they are scattered in different places. Often, it's a pain to navigate to them. Bookmarks let you easily open your frequently needed files from one location. It is very similar to web browser's bookmark concept.
Emacs's Bookmark feature.
Open the file you want to add. Then, call “bookmark-set” . It will prompt you for a name.
To open bookmark, type 【Ctrl+x r l】 (bookmark-bmenu-list). 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 , press 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.
You can also save your bookmark file without first opening the bookmark file, by calling “bookmark-save”.
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.
The only shortcut i remember for bookmark is 【Ctrl+x r l】 (bookmark-bmenu-list), which brings up my bookmarks. I open my bookmark perhaps once a hour.
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” 【Ctrl+h m】 to see its commands and shortcuts.
For lisp coders: bookmark's raw file is at 〔~/.emacs.bmk〕 by default. It is controlled by the variable “bookmark-default-file”.
In emacs 23.2, many preference files are moved to the 〔~/.emacs.d/〕 directory. (See: Emacs 23.2 Features.) However, bookmark didn't make it. So, you can set it yourself, like this:
(setq bookmark-default-file (concat user-emacs-directory "emacs.bmk"))blog comments powered by Disqus