GNU bug report logs - #65105
Reusing the same string as 'display on consecutive characters evades display

Previous Next

Package: emacs;

Reported by: JD Smith <jdtsmith <at> gmail.com>

Date: Sat, 5 Aug 2023 18:36:01 UTC

Severity: normal

Tags: notabug

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: JD Smith <jdtsmith <at> gmail.com>
Cc: 65105 <at> debbugs.gnu.org
Subject: bug#65105: Reusing the same string as 'display on consecutive characters evades display
Date: Sat, 05 Aug 2023 22:03:35 +0300
tags 65105 notabug
thanks

> From: JD Smith <jdtsmith <at> gmail.com>
> Date: Sat, 5 Aug 2023 14:35:23 -0400
> 
> Evaluate:
> 
> (let ((s1 "test1")
>       (s2 "test2"))
>   (insert "\n"
>           (propertize " " 'display s1)
>           (propertize " " 'display s1)
>           (propertize " " 'display s2)
>           (propertize " " 'display s1)))
> 
> 
> The first space display does not take effect, since the s1 string is used for two consecutive characters.  This has a practical impact for font-lock backends that use the ‘display text-property and would like to minimize string allocation.  

Emacs cannot distinguish between two consecutive characters having
each a text property with the same value, and two characters having
the same property.  If you think about this for a moment, you will
understand why: we use intervals for text properties, so two adjacent
intervals with the identical property values and one interval with
that same value are indistinguishable (and in fact Emacs optimizes
this during GC by making just one interval from these two).

This is not a bug.




This bug report was last modified 1 year and 290 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.