Function: kotl-mode:fill-paragraph

kotl-mode:fill-paragraph is an interactive and byte-compiled function defined in kotl-mode.el.

Signature

(kotl-mode:fill-paragraph &optional JUSTIFY)

Documentation

Fill the current paragraph within the cell.

With optional JUSTIFY, justify the paragraph as well. Ignore any non-nil no-fill attribute attached to the cell.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/kotl-mode.el
(defun kotl-mode:fill-paragraph (&optional justify)
  "Fill the current paragraph within the cell.
With optional JUSTIFY, justify the paragraph as well.
Ignore any non-nil no-fill attribute attached to the cell."
  (interactive "*P")
  (unless (kotl-mode:skip-filling-p (called-interactively-p 'interactive))
    (let ((indent (kcell-view:indent))
	  (opoint (point-marker))
	  start end)
      (re-search-backward (concat "\\`\\|" paragraph-separate))
      (kotl-mode:to-valid-position)
      (setq start (point-marker))
      ;; Add a temporary fill-prefix for the 1st line in the cell which
      ;; contains a label, so that it is filled properly.
      (insert "\n\n") (insert-char ?\  indent)
      (setq end (point-marker))
      ;; Return to original paragraph point.  This is the correct formula,
      ;; considering the fill prefix that was just added.
      (goto-char (min (max opoint (point)) (kcell-view:end-contents)))
      (if (fboundp 'fill-paragraph-and-align)
	  (fill-paragraph-and-align justify)
	(fill-paragraph justify))
      ;; Delete temporary fill prefix.
      (delete-region start end)
      ;; Return to original point.
      (goto-char (min opoint (kcell-view:end-contents)))
      ;; Move to editable point if need be.
      (kotl-mode:to-valid-position)
      ;; Remove markers
      (set-marker opoint nil)
      (set-marker start nil)
      (set-marker end nil))))