Function: internal--fill-string-single-line
internal--fill-string-single-line is a byte-compiled function defined
in subr.el.gz.
Signature
(internal--fill-string-single-line STR)
Documentation
Fill string STR to fill-column.
This is intended for very simple filling while bootstrapping
Emacs itself, and does not support all the customization options
of fill.el (for example fill-region).
Source Code
;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun internal--fill-string-single-line (str)
"Fill string STR to `fill-column'.
This is intended for very simple filling while bootstrapping
Emacs itself, and does not support all the customization options
of fill.el (for example `fill-region')."
(if (< (length str) fill-column)
str
(let* ((limit (min fill-column (length str)))
(fst (substring str 0 limit))
(lst (substring str limit)))
(cond ((string-match "\\( \\)$" fst)
(setq fst (replace-match "\n" nil nil fst 1)))
((string-match "^ \\(.*\\)" lst)
(setq fst (concat fst "\n"))
(setq lst (match-string 1 lst)))
((string-match ".*\\( \\(.+\\)\\)$" fst)
(setq lst (concat (match-string 2 fst) lst))
(setq fst (replace-match "\n" nil nil fst 1))))
(concat fst (internal--fill-string-single-line lst)))))