Function: refer-find-entry-internal
refer-find-entry-internal is a byte-compiled function defined in
refer.el.gz.
Signature
(refer-find-entry-internal KEYWORDS CONTINUE)
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/refer.el.gz
(defun refer-find-entry-internal (keywords continue)
(let ((keywords-list (refer-convert-string-to-list-of-strings keywords))
;; (old-buffer (current-buffer))
(old-window (selected-window))
(new-window (selected-window))
(files (if continue
refer-saved-state
(setq refer-saved-pos nil)
(refer-get-bib-files)))
(n 0)
;; (found nil)
(file nil))
;; find window in which to display bibliography file.
;; if a bibliography file is already displayed in a window, use
;; that one, otherwise use any window other than the current one
(setq new-window
(get-window-with-predicate
(lambda (w)
(while (and (not (null (setq file (nth n files))))
(setq n (1+ n))
(not (string-equal file
(buffer-file-name
(window-buffer w))))))
file)))
(unless new-window
;; didn't find bib file in any window:
(when (one-window-p 'nomini)
(setq old-window (split-window)))
(setq new-window (next-window old-window 'nomini)))
(select-window (if refer-same-file
old-window
new-window)) ; the window in which to show the bib file
(catch 'found
(while files
(let ((file (cond ((file-exists-p (car files)) (car files))
((file-exists-p (concat (car files) ".bib"))
(concat (car files) ".bib")))))
(setq refer-saved-state files)
(if file
(if (refer-find-entry-in-file keywords-list file refer-saved-pos)
(progn
(setq refer-saved-pos (point))
(recenter 0)
(throw 'found (find-file file)))
(setq refer-saved-pos nil
files (cdr files)))
(progn (ding)
(message "Scanning %s... No such file" (car files))
(sit-for 1)
(setq files (cdr files))))))
(ding)
(message "Keywords \"%s\" not found in any .bib file" keywords))
(select-window old-window)))