Mercurial > emacs
changeset 43418:b563c818c2b9
(bibtex-parse-keys): Put save-match-data around function body.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Tue, 19 Feb 2002 11:21:23 +0000 |
parents | 39769f818134 |
children | afa0b133a056 |
files | lisp/textmodes/bibtex.el |
diffstat | 1 files changed, 58 insertions(+), 57 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/textmodes/bibtex.el Tue Feb 19 11:16:06 2002 +0000 +++ b/lisp/textmodes/bibtex.el Tue Feb 19 11:21:23 2002 +0000 @@ -2324,63 +2324,64 @@ (let* ((case-fold-search t) (reference-keys (if add bibtex-reference-keys))) (save-excursion - (goto-char (point-min)) - (if verbose - (bibtex-progress-message - (concat (buffer-name) ": parsing reference keys"))) - (if (catch 'userkey - (bibtex-skip-to-valid-entry) - (while (not (eobp)) - (if (and - abortable - (input-pending-p)) - (throw 'userkey t)) - (if verbose - (bibtex-progress-message)) - (let (reference-key - xrefd-reference-key) - (cond - ((looking-at bibtex-entry-head) - (setq - reference-key - (buffer-substring-no-properties - (match-beginning bibtex-key-in-head) - (match-end bibtex-key-in-head))) - (let ((p (point)) - (m (bibtex-end-of-entry))) - (goto-char p) - (let ((bounds (bibtex-search-forward-field "crossref" m))) - (if bounds - (setq - xrefd-reference-key - (buffer-substring-no-properties - (1+ (bibtex-start-of-text-in-field bounds)) - (1- (bibtex-end-of-text-in-field bounds)))))))) - ((bibtex-parse-string) - (let ((bounds (bibtex-parse-string))) - (setq - reference-key - (buffer-substring-no-properties - (bibtex-start-of-reference-key-in-string bounds) - (bibtex-end-of-reference-key-in-string bounds)))))) - (forward-char) - (bibtex-skip-to-valid-entry) - (if (not (assoc reference-key reference-keys)) - (setq reference-keys - (cons (list reference-key) reference-keys))) - (if (and xrefd-reference-key - (not (assoc xrefd-reference-key reference-keys))) - (setq reference-keys - (cons (list xrefd-reference-key) reference-keys)))))) - ;; user has aborted by typing a key --> return nil - nil - ;; successful operation --> return t - (setq - bibtex-buffer-last-parsed-tick (buffer-modified-tick) - bibtex-reference-keys reference-keys) + (save-match-data + (goto-char (point-min)) (if verbose - (bibtex-progress-message 'done)) - t))))) + (bibtex-progress-message + (concat (buffer-name) ": parsing reference keys"))) + (if (catch 'userkey + (bibtex-skip-to-valid-entry) + (while (not (eobp)) + (if (and + abortable + (input-pending-p)) + (throw 'userkey t)) + (if verbose + (bibtex-progress-message)) + (let (reference-key + xrefd-reference-key) + (cond + ((looking-at bibtex-entry-head) + (setq + reference-key + (buffer-substring-no-properties + (match-beginning bibtex-key-in-head) + (match-end bibtex-key-in-head))) + (let ((p (point)) + (m (bibtex-end-of-entry))) + (goto-char p) + (let ((bounds (bibtex-search-forward-field "crossref" m))) + (if bounds + (setq + xrefd-reference-key + (buffer-substring-no-properties + (1+ (bibtex-start-of-text-in-field bounds)) + (1- (bibtex-end-of-text-in-field bounds)))))))) + ((bibtex-parse-string) + (let ((bounds (bibtex-parse-string))) + (setq + reference-key + (buffer-substring-no-properties + (bibtex-start-of-reference-key-in-string bounds) + (bibtex-end-of-reference-key-in-string bounds)))))) + (forward-char) + (bibtex-skip-to-valid-entry) + (if (not (assoc reference-key reference-keys)) + (setq reference-keys + (cons (list reference-key) reference-keys))) + (if (and xrefd-reference-key + (not (assoc xrefd-reference-key reference-keys))) + (setq reference-keys + (cons (list xrefd-reference-key) reference-keys)))))) + ;; user has aborted by typing a key --> return nil + nil + ;; successful operation --> return t + (setq + bibtex-buffer-last-parsed-tick (buffer-modified-tick) + bibtex-reference-keys reference-keys) + (if verbose + (bibtex-progress-message 'done)) + t)))))) (defun bibtex-parse-buffers-stealthily () ;; Called by bibtex-run-with-idle-timer. Whenever emacs has been idle @@ -2700,7 +2701,7 @@ (bibtex-run-with-idle-timer 1 nil (lambda () - (bibtex-parse-keys nil t t)))) + (bibtex-parse-keys nil nil t)))) ;; to get buffer parsed once if everything else (including things ;; installed in bibtex-mode-hook) has done its work (if (not bibtex-parse-idle-timer)