Subject: Re: bug#61735: 29.0.50; String object in margin not associated correctly with buffer text

From: Stefan Monnier <[email-masked]>
Date: Thu, 23 Feb 2023 13:36:44 -0500

> Indeed, I assumed that I was creating new strings because (eq " " " ")
> is nil.

Your test can return nil even if new strings aren't created at runtime
(e.g. because each source code string gets its own runtime string).

It may be nil in your test, but it may also return t (I think if you
byte-compile your test it will return t).

>> >         (let ((s " "))

Here you have a single " " string in your source code.  And no it's not
recreated each time, it will be the same one reused everytime (and
modified by `put-text-property`).

You can use `propertize` instead.

        Stefan