Subject: bug#7587: 23.2; `format-mode-line' makes Emacs crash

From: Chong Yidong <[email-masked]>
Date: Mon, 20 Dec 2010 23:29:48 +0800

Eli Zaretskii <[email-masked]> writes:

>>   +    : EQ (face, Qmode_line_inactive) ? MODE_LINE_FACE_ID
>
> I fixed these now.

Thanks.

> > I'm not even sure what the FACE argument to format-mode-line is
> > useful for
>
> The doc string and the ELisp manual clearly answer that question:
> format-mode-line can be used to compute the formatted string without
> displaying it.  When you use this API that way, you can specify a face
> for the parts of mode line that don't have their faces specified in
> the mode-line format.  IOW, it sounds like a deliberate feature, given
> the description in the ELisp manual.
>
> > it doesn't seem to be used anywhere in the sources.
>
> ?? init_iterator uses it (well, its index in the face cache) to
> initialize the appropriate member of the iterator object.

I mean, format-mode-line with a non-nil FACE argument doesn't seem to be
used anywhere.

> Given some history of discussions here, and the fact that no one seems
> to be sure how this code should really work and why, I wonder why you
> went ahead with the change without discussing it first.  I'm afraid
> that this change breaks backward compatibility for no good reason.

Given that the backward compatible behavior is to segfault, this
breakage might be acceptable.

Less flippantly, the FACE argument, if non-nil, is still applied as a
text property to the returned string.  So I don't think there's going to
be any noticeable difference (again, we don't have any concrete use
cases, so it's difficult to say).  The docstring change might not even
be necessary.