Commit 7ae9f0fb authored by Roland Winkler's avatar Roland Winkler
Browse files

lisp/textmodes/bibtex.el (bibtex-search-entries): Bug fix

parent 6646e848
2013-04-13 Roland Winkler <winkler@gnu.org>
* textmodes/bibtex.el (bibtex-search-entries): Bug fix. Use match
data before it gets modified by bibtex-beginning-of-entry.
2013-04-13 Roland Winkler <winkler@gnu.org>
 
* textmodes/bibtex.el (bibtex-url): Doc fix.
......
......@@ -5241,19 +5241,22 @@ where FILE is the BibTeX file of ENTRY."
(if (string= "" field)
;; Unrestricted search.
(while (re-search-forward regexp nil t)
(let ((beg (bibtex-beginning-of-entry))
(end (bibtex-end-of-entry))
key)
(if (and (<= beg (match-beginning 0))
(<= (match-end 0) end)
(save-excursion
(goto-char beg)
(and (looking-at bibtex-entry-head)
(setq key (bibtex-key-in-head))))
(not (assoc key entries)))
(push (list key file
(buffer-substring-no-properties beg end))
entries))))
(save-excursion
(let ((mbeg (match-beginning 0))
(mend (match-end 0))
(beg (bibtex-beginning-of-entry))
(end (bibtex-end-of-entry))
key)
(if (and (<= beg mbeg)
(<= mend end)
(progn
(goto-char beg)
(looking-at bibtex-entry-head))
(setq key (bibtex-key-in-head))
(not (assoc key entries)))
(push (list key file
(buffer-substring-no-properties beg end))
entries)))))
;; The following is slow. But it works reliably even in more
;; complicated cases with BibTeX string constants and crossrefed
;; entries. If you prefer speed over reliability, perform an
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment