all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#23859: 25.1.50; Inconsistent behavior of (format "%_width_s" string-has-text-property)
@ 2016-06-28  4:32 Chunyang Xu
  2016-06-28 16:11 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Chunyang Xu @ 2016-06-28  4:32 UTC (permalink / raw)
  To: 23859


;; 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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#23859: 25.1.50; Inconsistent behavior of (format "%_width_s" string-has-text-property)
  2016-06-28  4:32 bug#23859: 25.1.50; Inconsistent behavior of (format "%_width_s" string-has-text-property) Chunyang Xu
@ 2016-06-28 16:11 ` Eli Zaretskii
  2016-06-28 16:28   ` Chunyang Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2016-06-28 16:11 UTC (permalink / raw)
  To: Chunyang Xu; +Cc: 23859

> From: Chunyang Xu <xuchunyang.me@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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#23859: 25.1.50; Inconsistent behavior of (format "%_width_s" string-has-text-property)
  2016-06-28 16:11 ` Eli Zaretskii
@ 2016-06-28 16:28   ` Chunyang Xu
  2016-06-28 16:37     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Chunyang Xu @ 2016-06-28 16:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 23859

On Wed, Jun 29, 2016 at 12:11 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Chunyang Xu <xuchunyang.me@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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#23859: 25.1.50; Inconsistent behavior of (format "%_width_s" string-has-text-property)
  2016-06-28 16:28   ` Chunyang Xu
@ 2016-06-28 16:37     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2016-06-28 16:37 UTC (permalink / raw)
  To: Chunyang Xu; +Cc: 23859-done

> From: Chunyang Xu <xuchunyang.me@gmail.com>
> Date: Wed, 29 Jun 2016 00:28:46 +0800
> Cc: 23859@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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-28 16:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-28  4:32 bug#23859: 25.1.50; Inconsistent behavior of (format "%_width_s" string-has-text-property) Chunyang Xu
2016-06-28 16:11 ` Eli Zaretskii
2016-06-28 16:28   ` Chunyang Xu
2016-06-28 16:37     ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.