Commits

Nick Daly  committed 6d04bb9

Add entries to the end of the list instead of the beginning.

  • Participants
  • Parent commits a8c4021

Comments (0)

Files changed (1)

File org-annotate-file.el

   "non-nil means always expand the full tree when you visit
 `org-annotate-file-storage-file'.")
 
+(defvar org-annotate-file-append-to-end t
+  "If non-nil add each second-level link to the end of the file.")
+
 (defun org-annotate-file-prettyfy-desc (string)
   "Strip starting and ending whitespace and replace any chars
 after the 60th with '...'"
           (org-annotate-file-add-second-level search-link))))))
 
 (defun org-annotate-file-add-upper-level (link)
-  (goto-char (point-min))
-  (call-interactively 'org-insert-heading)
+  (new-entry)
+  (insert "* ")
   (insert link))
 
 (defun org-annotate-file-add-second-level (link)
-  (goto-char (point-at-eol))
-  (call-interactively 'org-insert-subheading)
-  (insert link))
+  (new-entry)
+  (insert "** ")
+  (insert link)
+  (put-cursor-in-annotation))
+
+(defun new-entry ()
+  "Safely positions cursor for a new entry."
+  (goto-char (point-max))
+  (unless (= (char-before) 10)
+	(newline)))
+
+(defun put-cursor-in-annotation ()
+  "After a link is position, newlines cursor inserted to avoid
+clobbering sucessive entries."
+  (newline)
+  (newline)
+  (newline)
+  (previous-line))
 
 (provide 'org-annotate-file)
 ;;; org-annotate-file.el ends here
-