Browse Source

rm dependency of ox-bibtex on org-bibtex-extras

* contrib/lisp/org-bibtex-extras.el: Remove functions to find
  citations, moved into ox-bibtex.

* contrib/lisp/ox-bibtex.el: Add functionality to follow cite links.
Eric Schulte 7 years ago
parent
commit
5ab53d101d
2 changed files with 21 additions and 24 deletions
  1. 0 22
      contrib/lisp/org-bibtex-extras.el
  2. 21 2
      contrib/lisp/ox-bibtex.el

+ 0 - 22
contrib/lisp/org-bibtex-extras.el

@@ -83,19 +83,6 @@ For example, to point to your `obe-bibtex-file' use the following.
 		obe-citations))
 	obe-citations)))
 
-(defun obe-goto-citation (&optional citation)
-  "Visit a citation given its ID."
-  (interactive)
-  (let ((citation (or citation
-		      (org-icompleting-read "Citation: "
-					    (obe-citations)))))
-    (find-file (or obe-bibtex-file
-		   (error "`obe-bibtex-file' has not been configured")))
-    (goto-char (point-min))
-    (when (re-search-forward (format "  :CUSTOM_ID: %s" citation) nil t)
-      (outline-previous-visible-heading 1)
-      t)))
-
 (defun obe-html-export-citations ()
   "Convert all \\cite{...} citations in the current file into HTML links."
   (save-excursion
@@ -107,15 +94,6 @@ For example, to point to your `obe-bibtex-file' use the following.
 		    (mapcar #'org-babel-trim
 			    (split-string (match-string 1) ",")) ", "))))))
 
-(defun obe-get-meta-data (citation)
-  "Collect meta-data for CITATION."
-  (save-excursion
-    (when (obe-goto-citation citation)
-      (let ((pt (point)))
-	`((:authors . ,(split-string (org-entry-get pt "AUTHOR") " and " t))
-	  (:title   . ,(org-no-properties (org-get-heading 1 1)))
-	  (:journal . ,(org-entry-get pt "JOURNAL")))))))
-
 (defun obe-meta-to-json (meta &optional fields)
   "Turn a list of META data from citations into a string of json."
   (let ((counter 1) nodes links)

+ 21 - 2
contrib/lisp/ox-bibtex.el

@@ -89,8 +89,6 @@
 ;; Initialization
 
 (eval-when-compile (require 'cl))
-(let ((jump-fn (car (org-remove-if-not #'fboundp '(ebib obe-goto-citation)))))
-  (org-add-link-type "cite" jump-fn))
 
 ;;; Internal Functions
 
@@ -149,6 +147,27 @@ to `org-bibtex-citation-p' predicate."
       (and (string-match "\\`\\\\cite{" value)
 	   (substring value (match-end 0) -1)))))
 
+
+;;; Follow cite: links
+
+(defun org-bibtex-file nil "Org-mode file of bibtex entries.")
+
+(defun org-bibtex-goto-citation (&optional citation)
+  "Visit a citation given its ID."
+  (interactive)
+  (let ((citation (or citation
+		      (org-icompleting-read "Citation: "
+					    (obe-citations)))))
+    (find-file (or org-bibtex-file
+		   (error "`org-bibtex-file' has not been configured")))
+    (goto-char (point-min))
+    (when (re-search-forward (format "  :CUSTOM_ID: %s" citation) nil t)
+      (outline-previous-visible-heading 1)
+      t)))
+
+(let ((jump-fn (car (org-remove-if-not #'fboundp '(ebib org-bibtex-goto-citation)))))
+  (org-add-link-type "cite" jump-fn))
+
 
 
 ;;; Filters