aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Porter2025-05-28 10:16:02 -0700
committerJim Porter2025-06-10 22:09:26 -0700
commit38c57855ae2b5d4245bce0bb444ee86c35dfcdc5 (patch)
treedcbf2e2c9bad99322a05c9709b119a52cd781428
parent90c0c9a01ed11944c5502f809817a028a1096ee6 (diff)
downloademacs-38c57855ae2b5d4245bce0bb444ee86c35dfcdc5.tar.gz
emacs-38c57855ae2b5d4245bce0bb444ee86c35dfcdc5.zip
; 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.
-rw-r--r--lisp/visual-wrap.el46
1 files changed, 22 insertions, 24 deletions
diff --git a/lisp/visual-wrap.el b/lisp/visual-wrap.el
index 3dcffa7c7e9..24ca8ae7cf4 100644
--- a/lisp/visual-wrap.el
+++ b/lisp/visual-wrap.el
@@ -143,29 +143,27 @@ members of `visual-wrap--safe-display-specs' (which see)."
143 (t 143 (t
144 ""))))) 144 "")))))
145 145
146(defun visual-wrap--apply-to-line (position) 146(defun visual-wrap--apply-to-line ()
147 "Apply visual-wrapping properties to the logical line starting at POSITION." 147 "Apply visual-wrapping properties to the logical line starting at point."
148 (save-excursion 148 (when-let* ((first-line-prefix (fill-match-adaptive-prefix))
149 (goto-char position) 149 (next-line-prefix (visual-wrap--content-prefix
150 (when-let* ((first-line-prefix (fill-match-adaptive-prefix)) 150 first-line-prefix (point))))
151 (next-line-prefix (visual-wrap--content-prefix 151 (when (numberp next-line-prefix)
152 first-line-prefix position))) 152 ;; Set a minimum width for the prefix so it lines up correctly
153 (when (numberp next-line-prefix) 153 ;; with subsequent lines. Make sure not to do this past the end
154 ;; Set a minimum width for the prefix so it lines up correctly 154 ;; of the line though! (`fill-match-adaptive-prefix' could
155 ;; with subsequent lines. Make sure not to do this past the end 155 ;; potentially return a prefix longer than the current line in the
156 ;; of the line though! (`fill-match-adaptive-prefix' could 156 ;; buffer.)
157 ;; potentially return a prefix longer than the current line in 157 (add-display-text-property
158 ;; the buffer.) 158 (point) (min (+ (point) (length first-line-prefix))
159 (add-display-text-property 159 (pos-eol))
160 position (min (+ position (length first-line-prefix)) 160 'min-width `((,next-line-prefix . width))))
161 (pos-eol)) 161 (setq next-line-prefix (visual-wrap--adjust-prefix next-line-prefix))
162 'min-width `((,next-line-prefix . width)))) 162 (put-text-property
163 (setq next-line-prefix (visual-wrap--adjust-prefix next-line-prefix)) 163 (point) (pos-eol) 'wrap-prefix
164 (put-text-property 164 (if (numberp next-line-prefix)
165 position (pos-eol) 'wrap-prefix 165 `(space :align-to (,next-line-prefix . width))
166 (if (numberp next-line-prefix) 166 next-line-prefix))))
167 `(space :align-to (,next-line-prefix . width))
168 next-line-prefix)))))
169 167
170(defun visual-wrap--content-prefix (prefix position) 168(defun visual-wrap--content-prefix (prefix position)
171 "Get the next-line prefix for the specified first-line PREFIX. 169 "Get the next-line prefix for the specified first-line PREFIX.
@@ -254,7 +252,7 @@ by `visual-wrap-extra-indent'."
254 ;; If so, we can apply our visual wrapping properties to this 252 ;; If so, we can apply our visual wrapping properties to this
255 ;; line and continue to the next line. 253 ;; line and continue to the next line.
256 (progn 254 (progn
257 (visual-wrap--apply-to-line (point)) 255 (visual-wrap--apply-to-line)
258 (forward-line)) 256 (forward-line))
259 ;; Otherwise, skip ahead until the end of any unsafe display 257 ;; Otherwise, skip ahead until the end of any unsafe display
260 ;; properties. NOTE: We do this out of an abundance of caution to 258 ;; properties. NOTE: We do this out of an abundance of caution to