Re: [DISCUSSION] Face priority in Org fontification (was: [BUG] org dates, radio links, and special keywords override heading backgrounds [9.7 (9.7-??-902dacb @ /home/st/.config/emacs/.local/straight/

2024-03-31 Thread Ihor Radchenko
Ihor Radchenko  writes:

> Protesilaos Stavrou  writes:
>
>> Now the tricky part is to figure out which combinations can work this
>> way. Headings and source blocks are two obvious ones. Maybe there are
>> more, but I cannot think of one right now.
>
> This is relevant to any greater element that can contain markup inside
> and where we apply the fontification to both markup and contents:
>
> - headlines
> - tables
> - descriptive lists
> - commented headlines
>
> For headlines and tables, it /feels/ reasonable to apply the container
> face first and then prepend the markup faces.
> However, for descriptive lists and commented headlines, it is not so
> clear. For commented headlines that should fade out compared to ordinary
> headlines, prepending markup faces may lead to commented headlines
> standing out.

I now made it so that markup consistently takes precedence over the
container face, except for commented headings.

Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=d3878cb6f

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [DISCUSSION] Face priority in Org fontification (was: [BUG] org dates, radio links, and special keywords override heading backgrounds [9.7 (9.7-??-902dacb @ /home/st/.config/emacs/.local/straight/

2024-03-15 Thread Ihor Radchenko
Protesilaos Stavrou  writes:

> Now the tricky part is to figure out which combinations can work this
> way. Headings and source blocks are two obvious ones. Maybe there are
> more, but I cannot think of one right now.

This is relevant to any greater element that can contain markup inside
and where we apply the fontification to both markup and contents:

- headlines
- tables
- descriptive lists
- commented headlines

For headlines and tables, it /feels/ reasonable to apply the container
face first and then prepend the markup faces.
However, for descriptive lists and commented headlines, it is not so
clear. For commented headlines that should fade out compared to ordinary
headlines, prepending markup faces may lead to commented headlines
standing out.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [DISCUSSION] Face priority in Org fontification (was: [BUG] org dates, radio links, and special keywords override heading backgrounds [9.7 (9.7-??-902dacb @ /home/st/.config/emacs/.local/straight/

2024-03-14 Thread Protesilaos Stavrou
> From: Ihor Radchenko 
> Date: Wed, 13 Mar 2024 14:27:18 +

> [... 16 lines elided]

>>> CCing Protesilaos. This discussion might be of interest for him.
>>
>> I think it makes sense to not override the background because otherwise
>> the heading can look visually "broken". See attached screenshot for an
>> example: it is called "demo-org-heading-with-background.png". In that
>> screenshot I include an overline for the heading, to show how this is
>> not limited to the background colour but extends to all face attributes.
>> To this end, I also attach "demo-org-heading-with-more-height.png" which
>> shows how the date is not scaling to match the heading's increased text
>> height.
>
> I agree that override (what we do now) is clearly not good.
> The question, however, is whether we should prioritize object face over
> the containing element face or vice versa:
>
> Should link properties take precedence over headline or should headline
> properties take precedence?
>
> For example, if link explicitly sets face height to be smaller, should
> we honor it? Or should we honor the headline face height, if set?
> Similar for background. In your example, the white background override
> does not really look nice when heading has its own background.

This can get tricky, I know.

The idea is to make this behave how all faces relate to the 'default'
face with regard to their 'undefined' attributes. Namely, if a face
defines an attribute, then it overrides the 'default' face, otherwise it
falls back to it for the value of the given attribute.

In the case of the headlines then, every other element should attain the
attributes of the heading unless it explicitly overrides them. So a link
with an 'undefined' height will be as high as the heading, but a link
with a height of, say, 1.0 will keep that height even if the heading is
at a 2.0 height (or whatever).

Same idea for all face attributes.

Now the tricky part is to figure out which combinations can work this
way. Headings and source blocks are two obvious ones. Maybe there are
more, but I cannot think of one right now.

-- 
Protesilaos Stavrou
https://protesilaos.com



Re: [DISCUSSION] Face priority in Org fontification (was: [BUG] org dates, radio links, and special keywords override heading backgrounds [9.7 (9.7-??-902dacb @ /home/st/.config/emacs/.local/straight/

2024-03-13 Thread Ihor Radchenko
Protesilaos Stavrou  writes:

>> This is not an exhaustive list. We have a number of markup objects that
>> are fontified overriding the containing element/paragraph/heading face:
>>
>> - target links
>> - timestamps
>> - footnotes
>> - radio targets
>> - macros
>> - inline export snippets
>>
>> I am not 100% sure we should unconditionally prepend their faces to
>> the containing headline/table/etc.
>>
>> CCing Protesilaos. This discussion might be of interest for him.
>
> I think it makes sense to not override the background because otherwise
> the heading can look visually "broken". See attached screenshot for an
> example: it is called "demo-org-heading-with-background.png". In that
> screenshot I include an overline for the heading, to show how this is
> not limited to the background colour but extends to all face attributes.
> To this end, I also attach "demo-org-heading-with-more-height.png" which
> shows how the date is not scaling to match the heading's increased text
> height.

I agree that override (what we do now) is clearly not good.
The question, however, is whether we should prioritize object face over
the containing element face or vice versa:

Should link properties take precedence over headline or should headline
properties take precedence?

For example, if link explicitly sets face height to be smaller, should
we honor it? Or should we honor the headline face height, if set?
Similar for background. In your example, the white background override
does not really look nice when heading has its own background.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [DISCUSSION] Face priority in Org fontification (was: [BUG] org dates, radio links, and special keywords override heading backgrounds [9.7 (9.7-??-902dacb @ /home/st/.config/emacs/.local/straight/

2024-03-13 Thread Protesilaos Stavrou
Thank you, Ihor!

> From: Ihor Radchenko 
> Date: Mon,  4 Mar 2024 10:32:38 +
>
> StrawberryTea  writes:
>
>> Hello. Currently, if you have a heading background, and you have a date,
>> radio link, or special keyword, the background is overridden. I have
>> attached a patch that fixes this issue by using the `prepend' property
>> instead of the `t' property. Here is also a minimal example to reproduce
>> the issue:
>
> This is not an exhaustive list. We have a number of markup objects that
> are fontified overriding the containing element/paragraph/heading face:
>
> - target links
> - timestamps
> - footnotes
> - radio targets
> - macros
> - inline export snippets
>
> I am not 100% sure we should unconditionally prepend their faces to
> the containing headline/table/etc.
>
> CCing Protesilaos. This discussion might be of interest for him.

I think it makes sense to not override the background because otherwise
the heading can look visually "broken". See attached screenshot for an
example: it is called "demo-org-heading-with-background.png". In that
screenshot I include an overline for the heading, to show how this is
not limited to the background colour but extends to all face attributes.
To this end, I also attach "demo-org-heading-with-more-height.png" which
shows how the date is not scaling to match the heading's increased text
height.

All the best,
Protesilaos (or simply "Prot")

-- 
Protesilaos Stavrou
https://protesilaos.com


[DISCUSSION] Face priority in Org fontification (was: [BUG] org dates, radio links, and special keywords override heading backgrounds [9.7 (9.7-??-902dacb @ /home/st/.config/emacs/.local/straight/buil

2024-03-04 Thread Ihor Radchenko
StrawberryTea  writes:

> Hello. Currently, if you have a heading background, and you have a date,
> radio link, or special keyword, the background is overridden. I have
> attached a patch that fixes this issue by using the `prepend' property
> instead of the `t' property. Here is also a minimal example to reproduce
> the issue:

This is not an exhaustive list. We have a number of markup objects that
are fontified overriding the containing element/paragraph/heading face:

- target links
- timestamps
- footnotes
- radio targets
- macros
- inline export snippets

I am not 100% sure we should unconditionally prepend their faces to
the containing headline/table/etc.

CCing Protesilaos. This discussion might be of interest for him.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at