]> git.donarmstrong.com Git - org-ref.git/commitdiff
minor fix to allow insertion of citations at the very beginning of the buffer
authorJohn Kitchin <jkitchin@andrew.cmu.edu>
Fri, 20 Mar 2015 20:56:10 +0000 (16:56 -0400)
committerJohn Kitchin <jkitchin@andrew.cmu.edu>
Fri, 20 Mar 2015 20:56:10 +0000 (16:56 -0400)
org-ref.el

index 8eb3fff6290b60bc62314be8e10cd275f345fd5f..7a54058c150a8eee5c0ded7fbf7f17de85fcc888 100644 (file)
@@ -3101,11 +3101,13 @@ In the helm-bibtex buffer, C-u will give you a helm menu to select a new link ty
 C-u C-u will change the key at point to the selected keys."
   (let* ((object (org-element-context))
         (last-char (save-excursion
-                     (goto-char (org-element-property :end object))
-                     (backward-char)
-                     (if (looking-at " ")
-                         " "
-                       ""))))
+                     (when (org-element-property :end object)
+                       (goto-char (org-element-property :end object))
+                       (unless (bobp)
+                         (backward-char))
+                       (if (looking-at " ")
+                           " "
+                         "")))))
     (cond
      ;; case where we are in a link
      ((and (equal (org-element-type object) 'link)
@@ -3139,7 +3141,7 @@ C-u C-u will change the key at point to the selected keys."
      ;; We are next to a link, and we want to append
      ;; next to a link means one character back is on a link.
      ((save-excursion
-       (backward-char)
+       (unless (bobp) (backward-char))
        (and (equal (org-element-type (org-element-context)) 'link)
             (-contains?
              org-ref-cite-types