From: Roland Winkler Date: Sat, 13 Apr 2013 20:38:52 +0000 (-0500) Subject: lisp/textmodes/bibtex.el (bibtex-initialize): If the current buffer does not visit... X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~478 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=23a0e159ee303e0b3cd00483a0e2c3b1649d8642;p=emacs.git lisp/textmodes/bibtex.el (bibtex-initialize): If the current buffer does not visit a BibTeX file, exclude it from the list of buffers returned by bibtex-initialize --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9f31cd8228b..d01e57fa31f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-09-23 Roland Winkler + + * textmodes/bibtex.el (bibtex-initialize): If the current buffer + does not visit a BibTeX file, exclude it from the list of buffers + returned by bibtex-initialize. + 2013-04-13 Stephen Berman * window.el (split-window): Remove interactive form, since as a diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index aa20b739946..669a33bff73 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -3020,11 +3020,14 @@ Parsing initializes `bibtex-reference-keys' and `bibtex-strings'." Visit the BibTeX files defined by `bibtex-files' and return a list of corresponding buffers. Initialize in these buffers `bibtex-reference-keys' if not yet set. -List of BibTeX buffers includes current buffer if CURRENT is non-nil. +List of BibTeX buffers includes current buffer if CURRENT is non-nil +and the current buffer visits a file using `bibtex-mode'. If FORCE is non-nil, (re)initialize `bibtex-reference-keys' even if already set. If SELECT is non-nil interactively select a BibTeX buffer. -When called interactively, FORCE is t, CURRENT is t if current buffer uses -`bibtex-mode', and SELECT is t if current buffer does not use `bibtex-mode'," + +When called interactively, FORCE is t, CURRENT is t if current buffer +visits a file using `bibtex-mode', and SELECT is t if current buffer +does not use `bibtex-mode'," (interactive (list (eq major-mode 'bibtex-mode) t (not (eq major-mode 'bibtex-mode)))) (let ((file-path (split-string (or bibtex-file-path default-directory) ":+")) @@ -3062,10 +3065,12 @@ When called interactively, FORCE is t, CURRENT is t if current buffer uses (if (file-readable-p file) (push (find-file-noselect file) buffer-list))) ;; Include current buffer iff we want it. - ;; Exclude current buffer if it doesn't use `bibtex-mode'. - ;; Thus calling `bibtex-initialize' gives meaningful results for - ;; any current buffer. - (unless (and current (eq major-mode 'bibtex-mode)) (setq current nil)) + ;; Exclude current buffer if it does not visit a file using `bibtex-mode'. + ;; This way we exclude BibTeX buffers such as `bibtex-search-buffer' + ;; that are not visiting a BibTeX file. Also, calling `bibtex-initialize' + ;; gives meaningful results for any current buffer. + (unless (and current (eq major-mode 'bibtex-mode) buffer-file-name) + (setq current nil)) (cond ((and current (not (memq (current-buffer) buffer-list))) (push (current-buffer) buffer-list)) ((and (not current) (memq (current-buffer) buffer-list))