]> git.eshelyaron.com Git - emacs.git/commitdiff
; Remove superfluous POSITION argument from 'visual-wrap--apply-to-line'
authorJim Porter <jporterbugs@gmail.com>
Wed, 28 May 2025 17:16:02 +0000 (10:16 -0700)
committerEshel Yaron <me@eshelyaron.com>
Wed, 18 Jun 2025 08:04:52 +0000 (10:04 +0200)
* lisp/visual-wrap.el (visual-wrap--apply-to-line): Remove POSITION and
just use point instead.  Update caller.

(cherry picked from commit 38c57855ae2b5d4245bce0bb444ee86c35dfcdc5)

lisp/visual-wrap.el

index c8ae6f8f376d7c2d5d4152828f5a6fa8e3cd65b6..24ca8ae7cf4ea41b4b60053e1544c7b2d5cbc520 100644 (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