Browse Source

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.
David Holm 11 years ago
parent
commit
ea5e6e0dda
1 changed files with 4 additions and 4 deletions
  1. 4 4
      contrib/lisp/org-annotate-file.el

+ 4 - 4
contrib/lisp/org-annotate-file.el

@@ -88,10 +88,10 @@ Trim whitespace at beginning and end of STRING and replace any
   (interactive)
   (interactive)
   (unless (buffer-file-name)
   (unless (buffer-file-name)
     (error "This buffer has no associated file!"))
     (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
 The cursor will be placed at the relevant section.  If BUFFER is
   specified the annotation will be referencing it, otherwise the
   specified the annotation will be referencing it, otherwise the
   current buffer is used."
   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
          (search-link (org-make-link-string
                        (concat "file:" filename "::" line)
                        (concat "file:" filename "::" line)
                                (org-annotate-file-ellipsify-desc 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)
       (unless (eq major-mode 'org-mode)
         (org-mode))
         (org-mode))
       (goto-char (point-min))
       (goto-char (point-min))