Function: table--fill-region-strictly

table--fill-region-strictly is a byte-compiled function defined in table.el.gz.

Signature

(table--fill-region-strictly BEG END)

Documentation

Fill region strictly so that no line exceeds fill-column.

When a word exceeds fill-column the word is chopped into pieces. The chopped location is indicated with table-word-continuation-char.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/table.el.gz
(defun table--fill-region-strictly (beg end)
  "Fill region strictly so that no line exceeds `fill-column'.
When a word exceeds `fill-column' the word is chopped into pieces.  The
chopped location is indicated with `table-word-continuation-char'."
  (or (and (markerp beg) (markerp end))
      (error "markerp"))
  (if (< fill-column 2)
      (setq fill-column 2))
  ;; first remove all continuation characters.
  (goto-char beg)
  (while (re-search-forward (concat
			     (format "[^%c ]\\(" table-word-continuation-char)
			     (regexp-quote (char-to-string table-word-continuation-char))
			     "\\s +\\)")
			    end t)
    (delete-region (match-beginning 1) (match-end 1)))
  ;; then fill as normal
  (let ((paragraph-start table-paragraph-start))
    (fill-region beg end nil nil t))
  ;; now fix up
  (goto-char beg)
  (while (let ((col (move-to-column fill-column t)))
	   (cond
	    ((and (<= col fill-column)
		  (looking-at " *$"))
	     (delete-region (match-beginning 0) (match-end 0))
	     (and (zerop (forward-line 1))
		  (< (point) end)))
	    (t (forward-char -1)
	       (insert-before-markers (if (equal (char-before) ?\s) ?\s table-word-continuation-char)
				      "\n")
	       t)))))