Function: texinfo--fill-paragraph

texinfo--fill-paragraph is a byte-compiled function defined in texinfo.el.gz.

Signature

(texinfo--fill-paragraph JUSTIFY)

Documentation

Function to fill a paragraph in texinfo-mode.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/texinfo.el.gz
(defun texinfo--fill-paragraph (justify)
  "Function to fill a paragraph in `texinfo-mode'."
  (let ((command-re "\\(@[a-zA-Z]+\\)[ \t\n]")
        ;; Kludge alert: we override paragraph-separate here because
        ;; that is needed for filling @noindent and similar lines.
        ;; The default Texinfo-specific paragraph-separate value,
        ;; OTOH, is needed for auto-fill-mode, which doesn't call
        ;; mode-specific functions.
        (paragraph-separate fill-paragraph-separate))
    (catch 'no-fill
      (save-restriction
        ;; First check whether we're on a command line that can be
        ;; filled by itself.
        (or
         (save-excursion
           (beginning-of-line)
           (when (looking-at command-re)
             (let ((command (match-string 1)))
               (if (member command texinfo-fillable-commands)
                   (progn
                     (narrow-to-region (point) (progn (forward-line 1) (point)))
                     t)
                 (throw 'no-fill nil)))))
         ;; We're not on such a line, so fill the region.
         (save-excursion
           (let ((regexp (concat command-re "\\|^[ \t]*$\\|\f")))
             (narrow-to-region
              (if (re-search-backward regexp nil t)
                  (progn
                    (forward-line 1)
                    (point))
                (point-min))
              (if (re-search-forward regexp nil t)
                  (match-beginning 0)
                (point-max)))
             (goto-char (point-min)))))
        ;; We've now narrowed to the region we want to fill.
        (let ((fill-paragraph-function nil)
              (adaptive-fill-mode nil))
          (fill-paragraph justify))))
    t))