summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-01-13 00:18:42 -0500
committerKyle Meyer <kyle@kyleam.com>2016-01-13 00:18:42 -0500
commit4eccbce9dc1a5febdc74df86c15655ebaa7aabfb (patch)
tree3a55415ead371dd75c99aed00de3f9018fe5c1b4
parentabb9a0f88aeb67b340d5acaaa86c063353e5d3d0 (diff)
downloadorg-mode-4eccbce9dc1a5febdc74df86c15655ebaa7aabfb.tar.gz
org-bibtex: Fix type error in non-file buffers
* lisp/org-bibtex.el (org-bibtex): Fix type error in cases where the buffer is not visiting a file. In an indirect buffer, use the file name for the base buffer.
-rw-r--r--lisp/org-bibtex.el6
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el
index 2cd84b6..a1cd8b0 100644
--- a/lisp/org-bibtex.el
+++ b/lisp/org-bibtex.el
@@ -555,8 +555,10 @@ Headlines are exported using `org-bibtex-headline'."
(interactive
(list (read-file-name
"Bibtex file: " nil nil nil
- (file-name-nondirectory
- (concat (file-name-sans-extension (buffer-file-name)) ".bib")))))
+ (let ((file (buffer-file-name (buffer-base-buffer))))
+ (and file
+ (file-name-nondirectory
+ (concat (file-name-sans-extension file) ".bib")))))))
(let ((error-point
(catch 'bib
(let ((bibtex-entries