Function: bibtex-search-entry
bibtex-search-entry is an autoloaded, interactive and byte-compiled
function defined in bibtex.el.gz.
Signature
(bibtex-search-entry KEY &optional GLOBAL START DISPLAY)
Documentation
Move point to the beginning of BibTeX entry named KEY.
Return position of entry if KEY is found or nil if not found.
With GLOBAL non-nil, search KEY in bibtex-files. Otherwise the search
is limited to the current buffer. Optional arg START is buffer position
where the search starts. If it is nil, start search at beginning of buffer.
If DISPLAY is non-nil, display the buffer containing KEY.
Otherwise, use set-buffer.
When called interactively, START is nil, DISPLAY is t.
Also, GLOBAL is t if the current mode is not bibtex-mode
or bibtex-search-entry-globally is non-nil.
A prefix arg negates the value of bibtex-search-entry-globally.
Key Bindings
Aliases
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
;;;###autoload
(defun bibtex-search-entry (key &optional global start display)
"Move point to the beginning of BibTeX entry named KEY.
Return position of entry if KEY is found or nil if not found.
With GLOBAL non-nil, search KEY in `bibtex-files'. Otherwise the search
is limited to the current buffer. Optional arg START is buffer position
where the search starts. If it is nil, start search at beginning of buffer.
If DISPLAY is non-nil, display the buffer containing KEY.
Otherwise, use `set-buffer'.
When called interactively, START is nil, DISPLAY is t.
Also, GLOBAL is t if the current mode is not `bibtex-mode'
or `bibtex-search-entry-globally' is non-nil.
A prefix arg negates the value of `bibtex-search-entry-globally'."
(interactive
(let ((global (or (not (eq major-mode 'bibtex-mode))
(if bibtex-search-entry-globally
(not current-prefix-arg)
current-prefix-arg))))
(list (bibtex-read-key "Find key: " nil global) global nil t)))
(if (and global bibtex-files)
(let ((buffer-list (bibtex-initialize t))
buffer found)
(while (and (not found)
(setq buffer (pop buffer-list)))
(with-current-buffer buffer
(if (cdr (assoc-string key bibtex-reference-keys))
(setq found (bibtex-search-entry key)))))
(cond ((and found display)
;; If possible, reuse the window displaying BUFFER.
(let ((window (get-buffer-window buffer t)))
(if window
(progn
(select-frame-set-input-focus (window-frame window))
(select-window window))
(switch-to-buffer buffer)))
(bibtex-reposition-window found))
(found (set-buffer buffer))
(display (message "Key `%s' not found" key)))
found)
(let* ((case-fold-search t)
(pnt (save-excursion
(goto-char (or start (point-min)))
(if (re-search-forward (concat "^[ \t]*\\("
bibtex-entry-type
"\\)[ \t]*[({][ \t\n]*\\("
(regexp-quote key)
"\\)[ \t\n]*[,=]")
nil t)
(match-beginning 0)))))
(cond (pnt
(goto-char pnt)
(if display (bibtex-reposition-window)))
(display (message "Key `%s' not found" key)))
pnt)))