Книга: Learning GNU Emacs, 3rd Edition

4.7.5 Annotating Bookmarks

4.7.5 Annotating Bookmarks

You can add annotations to your bookmarks. These annotations can provide any type of information you want: details about the file in question, what you are doing with it, documentation for someone else on your project to review when looking at your files, or really anything you want.

Annotations are most easily added from the bookmark list itself. Open the bookmark list using C-x r l, then move to the line of the bookmark you want to annotate. Type e, the command to edit an annotation.

From the bookmark list, type: e


Emacs opens a *Bookmark Annotation Compose* window.

Emacs provides some guidance in this buffer about what to do. It says that all lines that start with a comment mark (#) will be deleted and that you press C-c C-c to save and exit the annotations buffer.

The annotation includes lines that are commented out and won't become part of the annotation, but if you'd like to keep the Author and Date lines (logical portions of an annotation), just uncomment those lines by deleting the initial #. You then add any annotation you would like and press C-c C-c to exit the window.

Annotations exhibit a couple of behaviors that are at least annoying if not bugs. First, Emacs defines a # as the default fill prefix. You must either change that (see Chapter 6 for details) or delete the initial # if Emacs inserts it. Second, and more critically, Emacs doesn't automatically save annotations when you exit Emacs. If you set a bookmark, Emacs saves the bookmarks file automatically (and in fact without asking). If you set an annotation but do not add or move a bookmark during the session, you must save the bookmarks file manually by typing M-x bookmark-save.

After you add an annotation, Emacs puts an asterisk (*) before the bookmark name as a visual indication that the bookmark has been annotated. To display an annotation for the current bookmark, press a. To display all annotations, press A.

When you jump to a bookmark or move to a bookmarked file from the bookmark list, annotations are automatically displayed in another window (but don't edit them in this window; you must use the procedure described earlier). If you open the bookmarked file some other way (using C-x C-f, for example), annotations are not displayed.

Оглавление книги


Генерация: 0.107. Запросов К БД/Cache: 0 / 0
поделиться
Вверх Вниз