Function: visual-wrap-prefix-function
visual-wrap-prefix-function is a byte-compiled function defined in
visual-wrap.el.gz.
Signature
(visual-wrap-prefix-function BEG END)
Documentation
Indent the region between BEG and END with visual filling.
Source Code
;; Defined in /usr/src/emacs/lisp/visual-wrap.el.gz
(defun visual-wrap-prefix-function (beg end)
"Indent the region between BEG and END with visual filling."
;; Any change at the beginning of a line might change its wrap
;; prefix, which affects the whole line. So we need to "round-up"
;; `end' to the nearest end of line. We do the same with `beg'
;; although it's probably not needed.
(goto-char end)
(unless (bolp) (forward-line 1))
(setq end (point))
(goto-char beg)
(forward-line 0)
(setq beg (point))
(while (< (point) end)
(let ((lbp (point)))
(put-text-property
(point) (progn (search-forward "\n" end 'move) (point))
'wrap-prefix
(let ((pfx (visual-wrap-fill-context-prefix
lbp (point))))
;; Remove any `wrap-prefix' property that might have been
;; added earlier. Otherwise, we end up with a string
;; containing a `wrap-prefix' string containing a
;; `wrap-prefix' string ...
(remove-text-properties
0 (length pfx) '(wrap-prefix) pfx)
(let ((dp (get-text-property 0 'display pfx)))
(when (and dp (eq dp (get-text-property (1- lbp) 'display)))
;; There's a `display' property which covers not just the
;; prefix but also the previous newline. So it's not
;; just making the prefix more pretty and could interfere
;; or even defeat our efforts (e.g. it comes from
;; `adaptive-fill-mode').
(remove-text-properties
0 (length pfx) '(display) pfx)))
pfx))))
`(jit-lock-bounds ,beg . ,end))