Subject: bug#76018: 31.0.50; wrap-prefix properties from visual-wrap-prefix-mode proliferate

From: Stefan Monnier <[email-masked]>
Date: Wed, 28 May 2025 10:46:03 -0400

> --- a/lisp/visual-wrap.el
> +++ b/lisp/visual-wrap.el
> @@ -165,7 +165,12 @@ visual-wrap--apply-to-line
>         position (pos-eol) 'wrap-prefix
>         (if (numberp next-line-prefix)
>             `(space :align-to (,next-line-prefix . width))
> -         next-line-prefix)))))
> +         next-line-prefix))
> +      ;; Make sure that when typing at the end of a line with
> +      ;; `wrap-prefix' set, we don't continue that property over
> +      ;; subsequent lines.  See bug#76018.
> +      (append-text-property position (pos-eol)
> +                            'rear-nonsticky '(wrap-prefix)))))

Using the `rear-nonsticky` or `front-sticky` properties is a PITA with
lots of odd corner cases, so I'd much rather we try to use the
standard approach of removing all our properties at start.

We have to write the "remove" code for the case where we turn the mode
off anyway.

        Stefan