]> git.donarmstrong.com Git - org-ref.git/blobdiff - org-ref.org
test bib file
[org-ref.git] / org-ref.org
index 0561f76a7d583075264fdd1d2099a3f18fa679fe..e5a3c47bd2025ca0c8d36e87b8c5c0bc4b77c2cd 100644 (file)
@@ -2716,8 +2716,8 @@ ref:test citep:test  label:rett
   (interactive)
   (let* ((object (org-element-context))
         (type (org-element-property :type object)))
-
-    (cond
+    (save-excursion
+      (cond
      ;; cite links
      ((-contains? org-ref-cite-types type)
       (message (org-ref-get-citation-string-at-point)))
@@ -2727,6 +2727,10 @@ ref:test citep:test  label:rett
       (message (org-ref-get-label-context
                (org-element-property :path object))))
 
+     ((string= type "eqref")
+      (message (org-ref-get-label-context
+               (org-element-property :path object))))
+
      ;; message the count
      ((string= type "label")
       (let ((count (org-ref-count-labels
@@ -2737,7 +2741,7 @@ ref:test citep:test  label:rett
                  " occurence"
                  (when (or (= count 0)
                            (> count 1))
-                   "s"))))))))
+                   "s")))))))))
 
 
 (when org-ref-show-citation-on-enter
@@ -2791,6 +2795,7 @@ Now, let us define a function that inserts the cite links:
   "Insert selected KEYS as cite link. Append KEYS if you are on a link.
 Technically, this function should return a string that is inserted by helm. This function does the insertion and gives helm an empty string to insert. This lets us handle appending to a link properly."
   (let* ((object (org-element-context)))
+  (message-box "prefix is %s" helm-current-prefix-arg)
     (cond
      ;; case where we are in a link
      ((and (equal (org-element-type object) 'link)
@@ -2874,20 +2879,33 @@ Checks for pdf and doi, and add appropriate functions."
                  (bibtex-autokey-get-field "doi"))))
         (candidates `(("Quit" . org-ref-citation-at-point)
                       ("Open bibtex entry" . org-ref-open-citation-at-point))))
+    ;; for some reason, when there is no doi or url, they are returned as "". I
+    ;; prefer nil so we correct this here.
+    (when (string= doi "") (setq doi nil))
+    (when (string= url "") (setq url nil))
 
-
-    (when (file-exists-p pdf-file)
+    ;; Conditional pdf functions
+    (if (file-exists-p pdf-file)
+       (add-to-list
+        'candidates
+        '("Open pdf" . org-ref-open-pdf-at-point)
+        t)
       (add-to-list
        'candidates
-       '("Open pdf" . org-ref-open-pdf-at-point)
-       t
-       ))
+       '("Try to get pdf" . (lambda ()
+                             (save-window-excursion
+                               (org-ref-open-citation-at-point)
+                                (bibtex-beginning-of-entry)
+                               (doi-utils-get-bibtex-entry-pdf))))
+       t))
+
 
     (add-to-list
      'candidates
      '("Open notes" . org-ref-open-notes-at-point)
      t)
 
+    ;; conditional url and doi functions
     (when (or url doi)
       (add-to-list
        'candidates