Function: org-fill-paragraph
org-fill-paragraph is an interactive and byte-compiled function
defined in org.el.gz.
Signature
(org-fill-paragraph &optional JUSTIFY REGION)
Documentation
Fill element at point, when applicable.
This function only applies to comment blocks, comments, example blocks and paragraphs. Also, as a special case, re-align table when point is at one.
For convenience, when point is at a plain list, an item or a footnote definition, try to fill the first paragraph within.
If JUSTIFY is non-nil (interactively, with prefix argument),
justify as well. If sentence-end-double-space is non-nil, then
period followed by one space does not end a sentence, so don't
break a line there. The variable fill-column controls the
width for filling.
The REGION argument is non-nil if called interactively; in that case, if Transient Mark mode is enabled and the mark is active, fill each of the elements in the active region, instead of just filling the current element.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-fill-paragraph (&optional justify region)
"Fill element at point, when applicable.
This function only applies to comment blocks, comments, example
blocks and paragraphs. Also, as a special case, re-align table
when point is at one.
For convenience, when point is at a plain list, an item or
a footnote definition, try to fill the first paragraph within.
If JUSTIFY is non-nil (interactively, with prefix argument),
justify as well. If `sentence-end-double-space' is non-nil, then
period followed by one space does not end a sentence, so don't
break a line there. The variable `fill-column' controls the
width for filling.
The REGION argument is non-nil if called interactively; in that
case, if Transient Mark mode is enabled and the mark is active,
fill each of the elements in the active region, instead of just
filling the current element."
(interactive (progn
(barf-if-buffer-read-only)
(list (when current-prefix-arg 'full) t)))
(let ((hash (and (not (buffer-modified-p))
(org-buffer-hash))))
(cond
((and region transient-mark-mode mark-active
(not (eq (region-beginning) (region-end))))
(let ((origin (point-marker))
(start (region-beginning)))
(unwind-protect
(progn
(goto-char (region-end))
(skip-chars-backward " \t\n")
(let ((org--single-lines-list-is-paragraph nil))
(while (> (point) start)
(org-fill-element justify)
(org-backward-paragraph)
(skip-chars-backward " \t\n"))))
(goto-char origin)
(set-marker origin nil))))
(t
(save-excursion
(when (org-match-line "[ \t]*$")
(skip-chars-forward " \t\n"))
(org-fill-element justify))))
;; If we didn't change anything in the buffer (and the buffer was
;; previously unmodified), then flip the modification status back
;; to "unchanged".
(when (and hash (equal hash (org-buffer-hash)))
(set-buffer-modified-p nil))
;; Return non-nil.
t))