From ab3b61015a16f208a3d8fbb05c56fd40707e62fa Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sun, 29 Aug 1999 21:20:20 +0000 Subject: (bibtex-mode): Use with-temp-buffer rather than make-temp-name, use match-string-no-properties, and eliminate a quadratic behavior when building bibtex-strings. --- lisp/textmodes/bibtex.el | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index 357e5e75e6..d9513f1360 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -2539,23 +2539,16 @@ non-nil. (if (< item size) ;; file was found (let ((case-fold-search t) - (curbuf (current-buffer)) - (bufname (make-temp-name "")) - (compl bibtex-strings)) - (create-file-buffer bufname) - (set-buffer bufname) - (insert-file-contents fullfilename) - (goto-char (point-min)) - (while (re-search-forward bibtex-string nil t) - (setq compl - (append compl - (list - (list (buffer-substring-no-properties - (match-beginning bibtex-key-in-string) - (match-end bibtex-key-in-string))))))) - (kill-buffer bufname) - (set-buffer curbuf) - (setq bibtex-strings compl)) + (compl nil)) + (with-temp-buffer + (insert-file-contents fullfilename) + (goto-char (point-min)) + (while (re-search-forward bibtex-string nil t) + (setq compl + (cons (list (match-string-no-properties + bibtex-key-in-string)) + compl)))) + (setq bibtex-strings (append bibtex-strings (nreverse compl)))) (error "File %s not in paths defined by bibtex-string-file-path variable" filename)))) -- cgit v1.2.3