Function: bibtex-fill-field-bounds

bibtex-fill-field-bounds is a byte-compiled function defined in bibtex.el.gz.

Signature

(bibtex-fill-field-bounds BOUNDS JUSTIFY &optional MOVE)

Documentation

Fill BibTeX field delimited by BOUNDS.

If JUSTIFY is non-nil justify as well. If optional arg MOVE is non-nil move point to end of field.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex-fill-field-bounds (bounds justify &optional move)
  "Fill BibTeX field delimited by BOUNDS.
If JUSTIFY is non-nil justify as well.
If optional arg MOVE is non-nil move point to end of field."
  (let ((end-field (copy-marker (bibtex-end-of-field bounds))))
    (if (not justify)
        (goto-char (bibtex-start-of-text-in-field bounds))
      (goto-char (bibtex-start-of-field bounds))
      (forward-char) ; leading comma
      (bibtex-delete-whitespace)
      (insert "\n")
      (indent-to-column (+ bibtex-entry-offset
                           bibtex-field-indentation))
      (re-search-forward "[ \t\n]*=" end-field)
      (replace-match "=")
      (forward-char -1)
      (if bibtex-align-at-equal-sign
          (indent-to-column
           (+ bibtex-entry-offset (- bibtex-text-indentation 2)))
        (insert " "))
      (forward-char)
      (bibtex-delete-whitespace)
      (if bibtex-align-at-equal-sign
          (insert " ")
        (indent-to-column bibtex-text-indentation)))
    ;; Paragraphs within fields are not preserved.  Bother?
    (fill-region-as-paragraph (line-beginning-position) end-field
                              default-justification nil (point))
    (if move (goto-char end-field))))