summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-05-01 21:53:24 -0400
committerKyle Meyer <kyle@kyleam.com>2014-05-01 21:53:24 -0400
commit04c2eaca647afb3da42cd62574c7380d895afd6c (patch)
treeed6cd5b8519ddbaf1a6b4aacb8dc84d88fa97ef2
parent8c537918048e91329c538034dd6cc82e09deb3d2 (diff)
downloadbog-04c2eaca647afb3da42cd62574c7380d895afd6c.tar.gz
Fix bog-bib-citekeys when bog-bib-file is non-nil
-rw-r--r--bog.el15
1 files changed, 10 insertions, 5 deletions
diff --git a/bog.el b/bog.el
index 25d2792..975b60e 100644
--- a/bog.el
+++ b/bog.el
@@ -483,11 +483,16 @@ occur in buffer instead of alphabetical order."
(expand-file-name (concat citekey ".bib") bog-bib-directory))
(defun bog-bib-citekeys ()
- "Return a list citekeys for all BibTeX files in `bog-bib-directory'."
- (-map 'file-name-base
- (file-expand-wildcards (concat
- (file-name-as-directory bog-bib-directory)
- "*.bib"))))
+ "Return a list citekeys for all BibTeX entries.
+If `bog-bib-file' is non-nil, it returns citekeys from this file
+instead of citekeys from file names in `bog-bib-directory'."
+ (if bog-bib-file
+ (with-current-buffer (find-file-noselect bog-bib-file)
+ (-map 'car (bibtex-parse-keys)))
+ (-map 'file-name-base
+ (file-expand-wildcards (concat
+ (file-name-as-directory bog-bib-directory)
+ "*.bib")))))
;;; Web