GNU bug report logs - #23859
25.1.50; Inconsistent behavior of (format "%_width_s" string-has-text-property)

Previous Next

Package: emacs;

Reported by: Chunyang Xu <xuchunyang.me <at> gmail.com>

Date: Tue, 28 Jun 2016 04:34:01 UTC

Severity: normal

Found in version 25.1.50

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23859 in the body.
You can then email your comments to 23859 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#23859; Package emacs. (Tue, 28 Jun 2016 04:34:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chunyang Xu <xuchunyang.me <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 28 Jun 2016 04:34:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Chunyang Xu <xuchunyang.me <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.1.50; Inconsistent behavior of (format "%_width_s"
 string-has-text-property)
Date: Tue, 28 Jun 2016 12:32:57 +0800
;; 24.5
(format "%4s" (propertize "hi" 'face 'bold))
    ⇒ #("  hi" 2 4 (face bold))

;; master
(format "%4s" (propertize "hi" 'face 'bold))
    ⇒ #("  hi" 0 2 (face bold))

is the new behavior wanted? I have code relying on the old behavior.


In GNU Emacs 25.1.50.1 (x86_64-apple-darwin15.5.0, NS appkit-1404.47 Version 10.11.5 (Build 15F34))
 of 2016-06-25 built on MBA.lan
Repository revision: a985d2b09bb88f31b27b02c3131cb34c5879d767




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23859; Package emacs. (Tue, 28 Jun 2016 16:12:01 GMT) Full text and rfc822 format available.

Message #8 received at 23859 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Chunyang Xu <xuchunyang.me <at> gmail.com>
Cc: 23859 <at> debbugs.gnu.org
Subject: Re: bug#23859: 25.1.50; Inconsistent behavior of (format "%_width_s"
 string-has-text-property)
Date: Tue, 28 Jun 2016 19:11:12 +0300
> From: Chunyang Xu <xuchunyang.me <at> gmail.com>
> Date: Tue, 28 Jun 2016 12:32:57 +0800
> 
> ;; 24.5
> (format "%4s" (propertize "hi" 'face 'bold))
>     ⇒ #("  hi" 2 4 (face bold))
> 
> ;; master
> (format "%4s" (propertize "hi" 'face 'bold))
>     ⇒ #("  hi" 0 2 (face bold))
> 
> is the new behavior wanted? I have code relying on the old behavior.

The change in behavior is intended, but its result in this case
reveals a 6-year old bug, now fixed on master.  After fixing the bug
the result is

(format "%4s" (propertize "hi" 'face 'bold))
    ⇒ #("  hi" 0 4 (face bold))

If this still breaks your code, I'm sorry, but you will have to adapt.
The old behavior was buggy and inconsistent (see bug#23730), and the
only way to make the behavior consistent and easily predictable was to
copy the properties onto the entire text produced from a given
argument, including any padding.  Which is what should be expected to
happen on master now.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23859; Package emacs. (Tue, 28 Jun 2016 16:29:02 GMT) Full text and rfc822 format available.

Message #11 received at 23859 <at> debbugs.gnu.org (full text, mbox):

From: Chunyang Xu <xuchunyang.me <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 23859 <at> debbugs.gnu.org
Subject: Re: bug#23859: 25.1.50; Inconsistent behavior of (format "%_width_s"
 string-has-text-property)
Date: Wed, 29 Jun 2016 00:28:46 +0800
On Wed, Jun 29, 2016 at 12:11 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>
> > From: Chunyang Xu <xuchunyang.me <at> gmail.com>
> > Date: Tue, 28 Jun 2016 12:32:57 +0800
> >
> > ;; 24.5
> > (format "%4s" (propertize "hi" 'face 'bold))
> >     ⇒ #("  hi" 2 4 (face bold))
> >
> > ;; master
> > (format "%4s" (propertize "hi" 'face 'bold))
> >     ⇒ #("  hi" 0 2 (face bold))
> >
> > is the new behavior wanted? I have code relying on the old behavior.
>
> The change in behavior is intended, but its result in this case
> reveals a 6-year old bug, now fixed on master.  After fixing the bug
> the result is
>
> (format "%4s" (propertize "hi" 'face 'bold))
>     ⇒ #("  hi" 0 4 (face bold))
>
> If this still breaks your code, I'm sorry, but you will have to adapt.
> The old behavior was buggy and inconsistent (see bug#23730), and the
> only way to make the behavior consistent and easily predictable was to
> copy the properties onto the entire text produced from a given
> argument, including any padding.  Which is what should be expected to
> happen on master now.


Thanks. It works as you described. My code now works as usual without
any changes, since white spaces (with the text properties I want)
still remains invisible.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Tue, 28 Jun 2016 16:39:01 GMT) Full text and rfc822 format available.

Notification sent to Chunyang Xu <xuchunyang.me <at> gmail.com>:
bug acknowledged by developer. (Tue, 28 Jun 2016 16:39:02 GMT) Full text and rfc822 format available.

Message #16 received at 23859-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Chunyang Xu <xuchunyang.me <at> gmail.com>
Cc: 23859-done <at> debbugs.gnu.org
Subject: Re: bug#23859: 25.1.50; Inconsistent behavior of (format "%_width_s"
 string-has-text-property)
Date: Tue, 28 Jun 2016 19:37:51 +0300
> From: Chunyang Xu <xuchunyang.me <at> gmail.com>
> Date: Wed, 29 Jun 2016 00:28:46 +0800
> Cc: 23859 <at> debbugs.gnu.org
> 
> > (format "%4s" (propertize "hi" 'face 'bold))
> >     ⇒ #("  hi" 0 4 (face bold))
> >
> > If this still breaks your code, I'm sorry, but you will have to adapt.
> > The old behavior was buggy and inconsistent (see bug#23730), and the
> > only way to make the behavior consistent and easily predictable was to
> > copy the properties onto the entire text produced from a given
> > argument, including any padding.  Which is what should be expected to
> > happen on master now.
> 
> 
> Thanks. It works as you described. My code now works as usual without
> any changes, since white spaces (with the text properties I want)
> still remains invisible.

Great, closing.

Thanks for reporting the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 27 Jul 2016 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 21 days ago.

Previous Next


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