From 4dccd56e1fe424ed1af580e29a39c40642618b6b Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Tue, 17 Feb 2015 01:05:26 -0500 Subject: prepare-bib-file: Fix use of bibtex-key-in-head Set the match data according to bibtex-entry-head before calling bibtex-key-in-head. bibtex-key-in-head relies on bibtex-entry-head having generated the most recent match data, but I was using it as though it took care of the matching. By luck, it seems that the most recent match data tends to be correct right after cleaning the entry. --- bog.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bog.el b/bog.el index 18b3e93..3ee30c1 100644 --- a/bog.el +++ b/bog.el @@ -617,8 +617,10 @@ one entry per BibTeX file." (insert-file-contents file) (bibtex-skip-to-valid-entry) (bibtex-clean-entry new-key) - (setq bib-file (expand-file-name (concat (bibtex-key-in-head) ".bib") - new-directory)) + (if (looking-at bibtex-entry-head) + (setq bib-file (expand-file-name (concat (bibtex-key-in-head) ".bib") + new-directory)) + (error "BibTeX header line looks wrong")) (write-file bib-file)) ;; If a buffer was visiting the original bib file, point it to the ;; new file. -- cgit v1.2.3