bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23730: 24.5; format removes text properties


From: Eli Zaretskii
Subject: bug#23730: 24.5; format removes text properties
Date: Wed, 08 Jun 2016 19:57:10 +0300

> From: ynyaaa@gmail.com
> Date: Wed, 08 Jun 2016 22:41:46 +0900
> 
> 
> `format' may remove text properties.
> Second form is an example.
> 
> (format (propertize "%d" 'face '(:background "red")) 1)
> =>#("1" 0 1 (face (:background "red")))
> 
> (format (propertize "%2d" 'face '(:background "red")) 1)
> =>" 1"
> 
> (format (propertize "%02d" 'face '(:background "red")) 1)
> =>#("01" 0 2 (face (:background "red")))

Why did you expect the properties of the format specifier to be
preserved?  The documentation only promises that the characters
_other_ than the format specifier are copied with their properties,
but makes no such promises about the specifier.

IOW, this is the intended behavior.  If you want the result of the
conversion to have some properties, you should propertize the return
value.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]