Function: bibtex-reposition-window

bibtex-reposition-window is an interactive and byte-compiled function defined in bibtex.el.gz.

Signature

(bibtex-reposition-window &optional POS)

Documentation

Make the current BibTeX entry visible.

If entry is smaller than window-body-height, entry is centered in window. Otherwise display the beginning of entry. Optional arg POS is the position of the BibTeX entry to use.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex-reposition-window (&optional pos)
  "Make the current BibTeX entry visible.
If entry is smaller than `window-body-height', entry is centered in window.
Otherwise display the beginning of entry.
Optional arg POS is the position of the BibTeX entry to use."
  (interactive)
  (if pos (goto-char pos))
  (let ((pnt (point))
        (beg (line-number-at-pos (bibtex-beginning-of-entry)))
        (end (line-number-at-pos (bibtex-end-of-entry))))
    (if (> (window-body-height) (- end beg))
        ;; entry fits in current window
        (progn
          (bibtex-goto-line (/ (+ 1 beg end) 2))
          (recenter)
          (goto-char pnt))
      ;; entry too large for current window
      (bibtex-goto-line beg)
      (recenter 0)
      (if (> (1+ (- (line-number-at-pos pnt) beg))
             (window-body-height))
          (bibtex-goto-line beg)
        (goto-char pnt)))))