Function: bib-apropos

bib-apropos is an interactive and byte-compiled function defined in bib-cite.el.

Signature

(bib-apropos)

Documentation

Display BibTeX entries containing a keyword from bibliography file.

The files specified in the \bibliography command are searched unless the current buffer is in bibtex-mode or is the Help buffer. In those cases, *it* is searched. This allows you to trim down a search further by using bib-apropos sequentially.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/bib-cite.el
(defun bib-apropos ()
  "Display BibTeX entries containing a keyword from bibliography file.
The files specified in the \\bibliography command are searched unless
the current buffer is in `bibtex-mode' or is the Help buffer.  In those
cases, *it* is searched.  This allows you to trim down a search further
by using bib-apropos sequentially."
  ;;(interactive "sBibTeX apropos: ")
  (interactive)
  (let* ((keylist (and (boundp 'TeX-mode-p)
                       (or TeX-mode-p
                           (eq major-mode 'bibtex-mode)) ;Avoid error in FRAMEPOP
                       (fboundp 'LaTeX-bibitem-list) ;Use this if using auctex
                       (LaTeX-bibitem-list)))
         (keyword (bib-apropos-keyword-at-point))
         (keyword (completing-read "BiBTeX apropos: " keylist nil nil keyword))
         (the-text)(key-point)(start-point)
         (new-buffer-f (and (not (string-match "^bib" mode-name))
                            (not (string-equal "*Help*" (buffer-name)))))
         (bib-buffer (or (and new-buffer-f (bib-get-bibliography nil))
                         (current-buffer))))
    (with-current-buffer bib-buffer
      (goto-char (point-min))
      (while (and (re-search-forward "^[ \t]*@" nil t)
                  (re-search-forward keyword nil t))
        (setq key-point (point))        ;To make sure this is within entry
        (re-search-backward "^[ \t]*@" nil t)
        (setq start-point (point))
        (forward-list 1)
        (if (< (point) key-point)       ;And this is that test...
            (goto-char key-point)       ;Not within entry, skip it.
          (setq the-text
                (cons (concat (buffer-substring start-point (point)) "\n")
                      the-text))))
      (if (not the-text)
          (message "Sorry, no matches found.")
        (with-output-to-temp-buffer "*Help*"
          (mapc #'princ (nreverse the-text)))
        (bib-cite-fontify-help-as-bibtex)
        (if bib-novice
            (message
             (substitute-command-keys
              (concat "Use \\[bib-apropos] again in the *help* buffer"
                      " to trim the search")))))
      (if new-buffer-f
          (kill-buffer bib-buffer)))))