From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: dalanicolai Newsgroups: gmane.emacs.bugs Subject: bug#61735: 29.0.50; String object in margin not associated correctly with buffer text Date: Thu, 23 Feb 2023 20:57:20 +0100 Message-ID: References: <83h6vcp96u.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000005bfd6f05f5636c03" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16450"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61735@debbugs.gnu.org, Eli Zaretskii To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 23 20:58:12 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pVHjI-00044K-11 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Feb 2023 20:58:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVHjC-0003lW-4e; Thu, 23 Feb 2023 14:58:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVHj9-0003lJ-B5 for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2023 14:58:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVHj8-00053u-Sm for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2023 14:58:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pVHj8-0001eT-Au for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2023 14:58:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: dalanicolai Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Feb 2023 19:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61735 X-GNU-PR-Package: emacs Original-Received: via spool by 61735-submit@debbugs.gnu.org id=B61735.16771822596320 (code B ref 61735); Thu, 23 Feb 2023 19:58:02 +0000 Original-Received: (at 61735) by debbugs.gnu.org; 23 Feb 2023 19:57:39 +0000 Original-Received: from localhost ([127.0.0.1]:35406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVHil-0001dr-Br for submit@debbugs.gnu.org; Thu, 23 Feb 2023 14:57:39 -0500 Original-Received: from mail-wm1-f49.google.com ([209.85.128.49]:45974) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVHik-0001de-30 for 61735@debbugs.gnu.org; Thu, 23 Feb 2023 14:57:38 -0500 Original-Received: by mail-wm1-f49.google.com with SMTP id d41-20020a05600c4c2900b003e9e066550fso263679wmp.4 for <61735@debbugs.gnu.org>; Thu, 23 Feb 2023 11:57:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=4nZUIpC0cNjJgFEYObJBqNgvfq0H1KWTQQiM6q/lalk=; b=Lz0omd3BrRV45bbdeAnVjvWDhS/QZ3O1TGMBhZZF9mVRncfi/b3zgGyz1sY2ZawdSP 2X+Ns+1Ph3A6LQIwapSmRXm+4AQS+PDQWFV7UoVqBa7rYO492Frnz6Tkgcc3zWmtPfrL vX5yUt1AquhGJG9zHXuSQar8ZOWzcdNWWmY33cVoRbzmDqcv9KdNdi2RZXE5vTqXYUFS J54639Fn7KeSjj3FJ42nmAlAVLZUkYSEYj+8CG3G8XDqIM9kun7GIy9cKc+5YqtkBO82 jW2ntfowrVKDGNGUpTjd/Cwse7TCMOz1py4ge1Q4yAaHLA+ZJIv7zt3Uw/F1a3JjliGu zdYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4nZUIpC0cNjJgFEYObJBqNgvfq0H1KWTQQiM6q/lalk=; b=lCoe0Rza3PuxmiFT5H7sGpENYnFaWyD4IqhsRewwaJ5MTpjDXugu3KGVzUukBVKIRZ 8kGCEfGuRZfo+HhqADGabDCrHsSISvSFF5GIT+TuDmq5NTvPAVubpgdv6ERWkiyKqexL q8n7KALdfaFGVOYm26OSjxhMM5RGVZ10f7jCa03KQ+lMZLvs9N9fZvmCTJTXqBxhqJJf FkIbXN9QV8a0CaijmG7kxwUrUngiCAQWKEi8X3zkksmEul04WpYzlrOiKBjYo/TyB9y2 jWUUbDYgAb4lifc95KHq5ShBKtdVKZP2KQekNVgFYhwv3M9Jbklnr9d2fgLjtGJrE+iU yjEA== X-Gm-Message-State: AO0yUKXzRiKrU6f3FIxpAAor+zNTZXLFO70kMueR5dY+R2i4YM2xOH34 WbBl8GYkP90hrrNBZlhbEMIjuGCsNz21o5Np8tg= X-Google-Smtp-Source: AK7set82OaKO/+yphCp3W9Gw9/se1ItrhdRdfiaghcZ5AtQ79WxkYFQiipJOFNhSRjI3VpXeno4b62jVjGiHiiMxH4g= X-Received: by 2002:a05:600c:502c:b0:3df:fc69:e977 with SMTP id n44-20020a05600c502c00b003dffc69e977mr551262wmr.5.1677182252087; Thu, 23 Feb 2023 11:57:32 -0800 (PST) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:256524 Archived-At: --0000000000005bfd6f05f5636c03 Content-Type: text/plain; charset="UTF-8" Thanks for that explanation. Indeed, I found it hard to find a thorough explanation anywhere. Also, thanks for reminding me about propertize. On Thu, 23 Feb 2023 at 19:36, Stefan Monnier wrote: > > 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 > > --0000000000005bfd6f05f5636c03 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks for that explanation. Indeed, I found it hard = to find a thorough
explanation anywhere. Also, thanks for remindi= ng me about propertize.


<= div dir=3D"ltr" class=3D"gmail_attr">On Thu, 23 Feb 2023 at 19:36, Stefan M= onnier <monnier@iro.umontrea= l.ca> wrote:
> Indeed, I assumed that I was creating new strings because (eq &quo= t; " " ")
> is nil.

Your test can return nil even if new strings aren't created at runtime<= br> (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).

>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(let ((s " "))

Here you have a single " " string in your source code.=C2=A0 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.


=C2=A0 =C2=A0 =C2=A0 =C2=A0 Stefan

--0000000000005bfd6f05f5636c03--