Subject: bug#41852: 27.0.50; text-scale commands don't scale header of tabulated-list-mode

From: Stefan Kangas <[email-masked]>
Date: Fri, 30 Oct 2020 20:22:58 +0000

Eli Zaretskii <[email-masked]> writes:

>> > (2) that text in the header line or elsewhere in such a buffer not
>> > inheriting from (the remapped) header line face is unaffected, and
>>
>> I'm not sure I understand what you mean.  If text-scale-mode is enabled,
>> typically through running e.g. `text-scale-increase', the `default' face
>> is scaled.  The result, AFAICT, is that all faces in the buffer change
>> size (well, not the mode line).
>
> No, only faces that inherit from 'default' are scaled.  And now so
> will the faces that inherit from 'header-line'.

When I use my patch in emacs -Q, say `M-x list-buffer' and then evaluate
this in that buffer:

(setq-local header-line-format (concat
                                (propertize "foo" 'face 'mode-line) " "
                                (propertize "bar" 'face 'bold)))

Both "foo" and "bar" in the header line is scaled with the rest of the
buffer.  But I don't think either of those faces inherits from the
header-line face.

Is this the scenario you had in mind?

>> And that makes sense since all other implicitly inherits from it,
>> right?
>
> No, not every face inherits from 'default', only those that inherit
> explicitly.

`(elisp) Basic Faces' says that they do:

  ‘default’
       The default face, whose attributes are all specified.  All other
       faces implicitly inherit from it: any unspecified attribute
       defaults to the attribute on this face (*note Face Attributes::).

So I'm not sure I understand what you are saying.  I'm probably still
missing something.

> A random face that is defined with defface isn't affected by
> text-scale-*.

What do you mean by "random face" here?  When I do this, the text "bar"
is scaled along with the rest:

(progn
  (defface foo-face '((t :weight bold)) "")
  (pop-to-buffer (get-buffer-create "*test*"))
  (insert "foo\n")
  (insert (propertize "bar\n" 'face 'foo-face))
  (insert "baz\n")
  (text-scale-increase 1))

Or could you give an example of where this does not happen?

>> This works even for anonymous faces, e.g.:
>>
>>    (progn
>>     (fundamental-mode)
>>     (insert (propertize "foo" 'face '(:height 1.5)))
>>     (text-scale-increase))
>>
>> What am I missing?
>
> See above.

Could you elaborate?  What I see is that this anonymous face is scaled.
Are you saying that you see something different?

>> > Wrt (3) I assume that 'tabulated-list-mode' can already get derailed
>> > when a user customizes header line face to use some large or small font
>> > size (a scenario where face remapping is not involved at all).
>>
>> I tried customizing the `Height' for the `header-line' face, and it
>> seems to work as expected:
>>
>> With no text-scale-mode it is as big as it is customized to be.  When I
>> run `text-scale-increase', it scales up accordingly (relative to its
>> customized size).  So I don't know what, if anything, should be added
>> here.  Since it works as expected, perhaps there is nothing to add?
>
> What Martin means, I think, is that using a larger font in header-line
> face might make the text below the header line in tabulated-list-mode
> fail to align.

Oh, okay.  Yes, that is true.

Is there anything we can or should do about that?