Function: bibtex-display-entries

bibtex-display-entries is a byte-compiled function defined in bibtex.el.gz.

Signature

(bibtex-display-entries ENTRIES &optional APPEND)

Documentation

Display BibTeX ENTRIES in bibtex-search-buffer.

ENTRIES is an alist with elements (KEY FILE ENTRY), where FILE is the BibTeX file of ENTRY. If APPEND is non-nil, append ENTRIES to those already displayed.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex-display-entries (entries &optional append)
  "Display BibTeX ENTRIES in `bibtex-search-buffer'.
ENTRIES is an alist with elements (KEY FILE ENTRY),
where FILE is the BibTeX file of ENTRY.
If APPEND is non-nil, append ENTRIES to those already displayed."
  (pop-to-buffer (get-buffer-create bibtex-search-buffer))
  ;; It would be nice if this buffer was editable, though editing
  ;; can be meaningful only for individual existing entries
  ;; (unlike reordering or creating new entries).
  ;; Fancy workaround: Editing commands in the virtual buffer could
  ;; jump to the real entry in the real buffer.
  (let (buffer-read-only)
    (if append (goto-char (point-max)) (erase-buffer))
    (dolist (entry (sort entries (lambda (x y) (string< (car x) (car y)))))
      (insert "% " (nth 1 entry) "\n" (nth 2 entry) "\n\n")))
    ;; `bibtex-sort-buffer' fails with the file names associated with
    ;; each entry.  Prior to sorting we could make the file name
    ;; a BibTeX field of each entry (using `bibtex-make-field').
    ;; Or we could make it a text property that we unfold afterwards.
    ;; (bibtex-sort-buffer)
  (bibtex-mode)
  (set-buffer-modified-p nil)
  (setq buffer-read-only t)
  (goto-char (point-min)))