Function: LaTeX-fill-region
LaTeX-fill-region is an interactive and byte-compiled function defined
in latex.el.
Signature
(LaTeX-fill-region FROM TO &optional JUSTIFY WHAT)
Documentation
Fill and indent the text in region from FROM to TO as LaTeX text.
Prefix arg (non-nil third arg JUSTIFY, if called from program) means justify as well. Fourth arg WHAT is a word to be displayed when formatting.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/latex.el
(defun LaTeX-fill-region (from to &optional justify what)
"Fill and indent the text in region from FROM to TO as LaTeX text.
Prefix arg (non-nil third arg JUSTIFY, if called from program)
means justify as well. Fourth arg WHAT is a word to be displayed when
formatting."
(declare (modes LaTeX-mode))
(interactive "*r\nP")
(save-excursion
(let ((to (set-marker (make-marker) to))
(next-par (make-marker)))
(goto-char from)
(beginning-of-line)
(setq from (point))
(catch 'end-of-buffer
(while (and (< (point) to))
(message "Formatting%s...%d%%"
(or what "")
(/ (* 100 (- (point) from)) (- to from)))
(save-excursion (LaTeX-fill-paragraph justify))
(if (marker-position next-par)
(goto-char (marker-position next-par))
(LaTeX-forward-paragraph))
(when (eobp) (throw 'end-of-buffer t))
(LaTeX-forward-paragraph)
(set-marker next-par (point))
(LaTeX-backward-paragraph)
(while (and (not (eobp))
(looking-at
(concat "^\\($\\|[ \t]+$\\|[ \t]*"
TeX-comment-start-regexp "+[ \t]*$\\)")))
(forward-line 1))))
(set-marker next-par nil)
(set-marker to nil)))
(message "Formatting%s...done" (or what "")))