; Remove superfluous POSITION argument from 'visual-wrap--apply-to-line'

* lisp/visual-wrap.el (visual-wrap--apply-to-line): Remove POSITION and
just use point instead.  Update caller.
This commit is contained in:
Jim Porter 2025-05-28 10:16:02 -07:00
parent 90c0c9a01e
commit 38c57855ae

View file

@ -143,29 +143,27 @@ members of `visual-wrap--safe-display-specs' (which see)."
(t
"")))))
(defun visual-wrap--apply-to-line (position)
"Apply visual-wrapping properties to the logical line starting at POSITION."
(save-excursion
(goto-char position)
(when-let* ((first-line-prefix (fill-match-adaptive-prefix))
(next-line-prefix (visual-wrap--content-prefix
first-line-prefix position)))
(when (numberp next-line-prefix)
;; Set a minimum width for the prefix so it lines up correctly
;; with subsequent lines. Make sure not to do this past the end
;; of the line though! (`fill-match-adaptive-prefix' could
;; potentially return a prefix longer than the current line in
;; the buffer.)
(add-display-text-property
position (min (+ position (length first-line-prefix))
(pos-eol))
'min-width `((,next-line-prefix . width))))
(setq next-line-prefix (visual-wrap--adjust-prefix next-line-prefix))
(put-text-property
position (pos-eol) 'wrap-prefix
(if (numberp next-line-prefix)
`(space :align-to (,next-line-prefix . width))
next-line-prefix)))))
(defun visual-wrap--apply-to-line ()
"Apply visual-wrapping properties to the logical line starting at point."
(when-let* ((first-line-prefix (fill-match-adaptive-prefix))
(next-line-prefix (visual-wrap--content-prefix
first-line-prefix (point))))
(when (numberp next-line-prefix)
;; Set a minimum width for the prefix so it lines up correctly
;; with subsequent lines. Make sure not to do this past the end
;; of the line though! (`fill-match-adaptive-prefix' could
;; potentially return a prefix longer than the current line in the
;; buffer.)
(add-display-text-property
(point) (min (+ (point) (length first-line-prefix))
(pos-eol))
'min-width `((,next-line-prefix . width))))
(setq next-line-prefix (visual-wrap--adjust-prefix next-line-prefix))
(put-text-property
(point) (pos-eol) 'wrap-prefix
(if (numberp next-line-prefix)
`(space :align-to (,next-line-prefix . width))
next-line-prefix))))
(defun visual-wrap--content-prefix (prefix position)
"Get the next-line prefix for the specified first-line PREFIX.
@ -254,7 +252,7 @@ by `visual-wrap-extra-indent'."
;; If so, we can apply our visual wrapping properties to this
;; line and continue to the next line.
(progn
(visual-wrap--apply-to-line (point))
(visual-wrap--apply-to-line)
(forward-line))
;; Otherwise, skip ahead until the end of any unsafe display
;; properties. NOTE: We do this out of an abundance of caution to