OrgAnnotateFile

Lisp:org-annotate-file.el

This is yet another implementation to allow the annotation of a file without modification of the file itself. The annotation is in org syntax so you can use all of the org features you are used to.

To use you might put the following in your .emacs:

(require 'org-annotate-file)
(global-set-key (kbd "C-c C-l") 'org-annotate-file)

To change the location of the annotation file:

(setq org-annotate-file-storage-file "~/annotated.org")

Then when you visit any file and hit C-c C-l you will find yourself in an org buffer on a headline which links to the file you were visiting, e.g:

* ~/org-annotate-file.el

Under here you can put anything you like, save the file and next time you hit C-c C-l you will hit those notes again.

To put a subheading with a text search for the current line set `org-annotate-file-add-search` to non-nil value. Then when you hit C-c C-l (on the above line for example) you will get:

* ~/org-annotate-file.el
** `org-annotate-file-add-search` to non-nil value. Then whe...

Note that both of the above will be links.

OrgAnnotateFile and Bookmark-Mode

You can very easily integrate OrgAnnotateFile with bookmark mode to open a file’s annotations in bookmark mode with the following code:

(defun bookmark-show-org-annotations ()
  "Opens the annotations window for the currently selected bookmark file."
  (interactive)
  (bookmark-bmenu-other-window)
  (org-annotate-file)
  ;; or, if you're using the http://bitbucket.org/nickdaly/org-annotate-file fork,
  ;; (org-annotate-file-show-annotations)
  )

Override bookmark-mode’s standard “show this file’s annotations” command with the following:

(add-hook 'bookmark-bmenu-mode-hook
  (lambda ()
	(local-set-key (kbd "a") 'bookmark-show-org-annotations)))

See also