Use reftex-default-bibliography
cgcgcg opened this issue · 1 comments
cgcgcg commented
First of all, thanks for your work. Bibretrieve is really great!
I use bibretrieve not only when I'm in a tex document. But (reftex-get-bibfile-list)
fails if reftex doesn't find a \bibliography statement in the current document. I changed the following function, so that it also looks at reftex-default-bibliography
. Not sure though, if this is good lisp...
(defun bibretrieve-find-bibliography-file ()
"Try to find a bibliography file using RefTeX."
;; Returns a string with text properties (as expected by read-file-name)
;; or nil if no file can be found
(let ((bibretrieve-bibfile-list nil))
(if
(not
(ignore-errors
(setq bibretrieve-bibfile-list (reftex-get-bibfile-list))
)
)
(setq bibretrieve-bibfile-list (car (reftex-default-bibliography)))
; This sets bibretrieve-bibfile-list to a list of strings with
; names of bib files. This does nothing if RefTeX finds no bib files
(if bibretrieve-bibfile-list
(car bibretrieve-bibfile-list) nil))
)
)
pzorin commented
Glad to hear that you find bibretrieve useful and thanks for the suggestion!
I have just pushed a more robust version that also works if reftex-default-bibliography is not defined.