Open roshanshariff opened 10 months ago
Hello Roshan,
I think it's basically intended that the Topsy face start from default
so that the text in it will resemble the buffer text that it's supposed to display. So I don't understand what problem this PR is intended to solve. Would you demonstrate with some screenshots please?
Sure, if the header-line
face is not themed then this patch has no effect. But many themes customize header-line
to look like mode-line
, including at least Prot's ef-themes and modus-themes, as well as doom-themes. For example, I'm using ef-themes
which gives the header line a gray background, and I've also enabled an option that uses variable-pitch text for UI elements. Then the Topsy master branch looks like this:
With this patch, it looks like this:
Thanks for the screenshots. But I'm still not sure I fully understand.
header-line
face? I would expect that if it didn't, another user might file a bug report saying that it's not respecting the header-line
face. It seems strange to me that you want our header line to look like just another line of window text, because that's not what it is (at least, not without the other patch that enables that behavior).
- Is it really desirable for our header line to not have the background of the
header-line
face? I would expect that if it didn't, another user might file a bug report saying that it's not respecting theheader-line
face. It seems strange to me that you want our header line to look like just another line of window text, because that's not what it is (at least, not without the other patch that enables that behavior).
I mostly just wanted Topsy to use distinct faces that can be customized independently of header-line
face. I made the face :inherit default
because that made sense to me, but of course the default can be just a null face, in which case it'll look just like every other header line.
I think having such a face makes a lot of sense, because even though Topsy isn't just showing another buffer line, it is quite closely connected to the text in the buffer (it is jarring, for example, when the font family changes when it scrolls off the screen and appears in the header line).
In combination with the other patch, we end up with two faces, one used when showing a sticky header and another when showing a normal buffer line. The default styling of these faces is of course up for discussion. In the current state of the patches, normal buffer text is shown in topsy-header-line
which inherits from default
whereas sticky headers are shown with topsy-highlight
which adds :weight bold :underline t
.
- If this is what we want to do, is remapping the face the best way to do it? Face remapping is very rarely necessary, and it adds much additional complexity (even though the changes to our code are not large, what's happening behind the scenes when using face remapping is much more complex, and can cause performance issues). Can't this be done without face remapping?
Face remapping isn't strictly necessary; we could use add-face-text-property
to add the Topsy faces to the header line string "behind" all the other faces. Unfortunately, we can't use the :propertize
construct in the header-line-format
because it just replaces the faces instead of appending a new one. So the header-line-format
would get a little bit more complicated, because it would have to propertize the leading space that's used to align the header line, and then topsy--header-string
would apply the same face to the string it returns. I can easily make this change if you think face remapping is problematic.
Let me say first that, as you can imagine, I'm trying to digest and review these new PRs while also keeping up with all the other things I need to do. And while you already had all these features working together, I'm trying to review both the design and implementation of each one. So rather than try to do them all, I'll start with one or two, and then we can work on the others.
For this one, I think it's okay to have a base face that can be customized, but I don't think we should use face remapping unless absolutely necessary. And by default, the face should look like the header-line
.
Thanks.
For this one, I think it's okay to have a base face that can be customized, but I don't think we should use face remapping unless absolutely necessary. And by default, the face should look like the header-line.
Sure, sounds good, thanks! I'll make the changes when I have some time.
I'm trying to digest and review these new PRs while also keeping up with all the other things I need to do.
Yeah, of course, and feel free to take as much time as you need. As you know, it took me two years to finally make these PRs, and since this is just a hobby project there's no need to hurry. I appreciate your work for the Emacs community!
Thanks. Agreed that there is no rush, and I was happy to see your followup even after 2 years. (My bug-tracker philosophy is that issues should remain open as long as relevant and unaddressed.) Cheers.
Many themes change the
header-line
face to be similar to the faces used by the mode line. This is often not a good fit for showing a sticky header. To allow the Topsy face to be customized independently of the usual header line, this PR remaps theheader-line
face to a newtopsy-header-line
face when Topsy is active.By default, the
topsy-header-line
face just inherits fromdefault
, so it is displayed just as the rest of the buffer text would be. To revert to the original behaviour of using theheader-line
face, you need to doThis PR is the first in a series that splits out the functionality of #7.