Pass storage-file as a parameter to org-annotate-file-show-section

* contrib/lisp/org-annotate-file.el (org-annotate-file,
org-annotate-file-show-storage-section): Permit a used to control
where to store the annotation when using
`org-annotate-file-show-section`.

By making the storage file a parameter the user can create their own
custom implementations of org-annotate-file and decide where to store
the annotation.

Personally I'm trying to use org-annotate-file to do code reviews and
I have set up my Emacs to write annotations into a file at the current
project root.  This makes it easier for me to email my comments to
whoever wrote the code I just reviewed as I can now keep multiple
reviews separate.
This commit is contained in:
David Holm 2014-03-15 18:53:37 +01:00 committed by Bastien Guerry
parent 0f52f12a47
commit ea5e6e0dda
1 changed files with 4 additions and 4 deletions

View File

@ -88,10 +88,10 @@ Trim whitespace at beginning and end of STRING and replace any
(interactive)
(unless (buffer-file-name)
(error "This buffer has no associated file!"))
(org-annotate-file-show-section))
(org-annotate-file-show-section org-annotate-file-storage-file))
(defun org-annotate-file-show-section (&optional buffer)
"Visit the buffer named `org-annotate-file-storage-file'.
(defun org-annotate-file-show-section (storage-file &optional buffer)
"Visit the buffer named STORAGE-FILE.
The cursor will be placed at the relevant section. If BUFFER is
specified the annotation will be referencing it, otherwise the
current buffer is used."
@ -101,7 +101,7 @@ The cursor will be placed at the relevant section. If BUFFER is
(search-link (org-make-link-string
(concat "file:" filename "::" line)
(org-annotate-file-ellipsify-desc line))))
(with-current-buffer (find-file org-annotate-file-storage-file)
(with-current-buffer (find-file storage-file)
(unless (eq major-mode 'org-mode)
(org-mode))
(goto-char (point-min))