~protesilaos/modus-themes

7 2

org-block faces

Details
Message ID
<87v88lyd1b.fsf@ergo>
DKIM signature
missing
Download raw message
Hi Prot! First of all, thank you for the awesome theme (and a bunch of
other packages I use daily). I shall always start praising all the
wonderful work you do for the Emacs community!!

I'd just like to as where the decision to always inherit from
`fixed-pitch' came from and how can I override specific attributes
inherited from it for a particular face.

The situation I came upon was that, when using `org-modern' I noticed
that the height set in `org-modern-block-name' wasn't respected, and it
turns out it was due to the fact that `org-block-begin-line' inherits
from `modus-themes-fixed-pitch', which has a set height. If I execute

    (set-face-attribute 'org-block-begin-line nil :inherit nil)

I get the correct fontification of the height, but this seems to be far
from ideal since other attributes should be inherited from the fixed
pitch face.

Do you have any idea how I could solve this as best as possible?

Best regards,

-- 
João Pedro de A. Paula
IT bachelors at Universidade Federal do Rio Grande do Norte (UFRN)
Details
Message ID
<87r0j9ycfe.fsf@ergo>
In-Reply-To
<87v88lyd1b.fsf@ergo> (view parent)
DKIM signature
missing
Download raw message
Em segunda, 25/12/2023 às 22:21, João Pedro <jpedrodeamorim@gmail.com> escreveu:

> The situation I came upon was that, when using `org-modern' I noticed
> that the height set in `org-modern-block-name' wasn't respected, and it
> turns out it was due to the fact that `org-block-begin-line' inherits
> from `modus-themes-fixed-pitch', which has a set height. If I execute
>
>     (set-face-attribute 'org-block-begin-line nil :inherit nil)
>
> I get the correct fontification of the height, but this seems to be far
> from ideal since other attributes should be inherited from the fixed
> pitch face.

It might also be helpful to explain what I'm trying to achieve in the
end, since there might be a better way to do it: I want to fontify the
body/contents of Org-mode source blocks with `bg-dim' as if I'm using
`modus-themes-org-blocks=gray-background' but the begin and end lines
should continue using the default face.

-- 
João Pedro de A. Paula
IT bachelors at Universidade Federal do Rio Grande do Norte (UFRN)
Details
Message ID
<877cjf2twi.fsf@protesilaos.com>
In-Reply-To
<87v88lyd1b.fsf@ergo> (view parent)
DKIM signature
pass
Download raw message
> From: João Pedro <jpedrodeamorim@gmail.com>
> Date: Mon, 25 Dec 2023 22:21:04 -0300
>
> Hi Prot!

Hello João Pedro,

Sorry for the late reply. I am slow to respond due to my limited typing
time (I have pain in my left arm).

> First of all, thank you for the awesome theme (and a bunch of
> other packages I use daily). I shall always start praising all the
> wonderful work you do for the Emacs community!!

You are welcome!

> I'd just like to as where the decision to always inherit from
> `fixed-pitch' came from and how can I override specific attributes
> inherited from it for a particular face.

Note that some faces inherit from 'fixed-pitch' only if the user option
'modus-themes-fixed-pitch' is enabled. Otherwise they do not inherit
anything.

The idea for that is that we want some spacing-sensitive faces to remain
monospaced when the user sets their default font to a proportionally
spaced family (or enables 'variable-pitch-mode' in the current buffer).

The fixed spacing applies to Org tables, code blocks, and the like.

> The situation I came upon was that, when using `org-modern' I noticed
> that the height set in `org-modern-block-name' wasn't respected, and it
> turns out it was due to the fact that `org-block-begin-line' inherits
> from `modus-themes-fixed-pitch', which has a set height. If I execute
>
>     (set-face-attribute 'org-block-begin-line nil :inherit nil)
>
> [... 8 lines elided]

I suspect that the issue here is that your 'fixed-pitch' family is not
the same as the 'default' one.

The simplest way to set this is with the following (using Source Code
Pro as an example font):

    ;; height is the familiar point size * 10.
    (set-face-attribute 'default nil :family "Source Code Pro" :height 100)

    ;; Only the `default' face needs an absolute :height. The rest should
    ;; either have none or use a floating point as a multiple of the
    ;; default (so they scale properly).
    (set-face-attribute 'fixed-pitch nil :family "Source Code Pro")

    ;; For completeness, we set the `variable-pitch' to our preferred font
    ;; family.
    (set-face-attribute 'variable-pitch nil :family "Source Sans Pro")

For more on fonts, I did a video recently:
<https://protesilaos.com/codelog/2024-01-16-customize-emacs-fonts/>.

Again, sorry for the late response.

All the best,
Prot

P.S. I am phasing out SourceHut: <https://protesilaos.com/codelog/2024-01-27-sourcehut-no-more/>.
Development continues on GitHub with GitLab as a mirror.

-- 
Protesilaos Stavrou
https://protesilaos.com
Details
Message ID
<874jej2tql.fsf@protesilaos.com>
In-Reply-To
<87r0j9ycfe.fsf@ergo> (view parent)
DKIM signature
pass
Download raw message
> From: João Pedro <jpedrodeamorim@gmail.com>
> Date: Mon, 25 Dec 2023 22:34:13 -0300
>
> Em segunda, 25/12/2023 às 22:21, João Pedro <jpedrodeamorim@gmail.com> escreveu:
>
>> The situation I came upon was that, when using `org-modern' I noticed
>> that the height set in `org-modern-block-name' wasn't respected, and it
>> turns out it was due to the fact that `org-block-begin-line' inherits
>> from `modus-themes-fixed-pitch', which has a set height. If I execute
>>
>>     (set-face-attribute 'org-block-begin-line nil :inherit nil)
>>
>> I get the correct fontification of the height, but this seems to be far
>> from ideal since other attributes should be inherited from the fixed
>> pitch face.
>
> It might also be helpful to explain what I'm trying to achieve in the
> end, since there might be a better way to do it: I want to fontify the
> body/contents of Org-mode source blocks with `bg-dim' as if I'm using
> `modus-themes-org-blocks=gray-background' but the begin and end lines
> should continue using the default face.

Oh, I see. I think the easier way for this is for me to add a semantic
palette override to that effect.

Until then, try this:

    (defun my-modus-themes-faces ()
      (modus-themes-with-colors
        (custom-set-faces
         '(org-block-begin-line ((,c :background ,bg-dim))))))

    (add-hook 'modus-themes-post-load-hook #'my-modus-themes-faces)

Then load the theme with something like

    (modus-themes-load-theme 'my-modus-themes)

-- 
Protesilaos Stavrou
https://protesilaos.com
Details
Message ID
<87zfv7tfvv.fsf@ergo>
In-Reply-To
<877cjf2twi.fsf@protesilaos.com> (view parent)
DKIM signature
pass
Download raw message
Em quinta, 08/02/2024 às 11:21 (+02), Protesilaos Stavrou <info@protesilaos.com> escreveu:

> Sorry for the late reply. I am slow to respond due to my limited typing
> time (I have pain in my left arm).

I should be the one apologising this time. A day before you replied I
had a surgery and haven't touched a computer while recovering. I'm all
recovered now!

> Note that some faces inherit from 'fixed-pitch' only if the user option
> 'modus-themes-fixed-pitch' is enabled. Otherwise they do not inherit
> anything.

This option doesn't seem to apply anymore, can I ask you what changed?

> I suspect that the issue here is that your 'fixed-pitch' family is not
> the same as the 'default' one.

They are the same family, and I only set a fixed height for the
'default' face as expected.

Best regards,

-- 
João Pedro de A. Paula
IT bachelors at Universidade Federal do Rio Grande do Norte (UFRN)
Details
Message ID
<87ttlftfpe.fsf@ergo>
In-Reply-To
<874jej2tql.fsf@protesilaos.com> (view parent)
DKIM signature
pass
Download raw message
Em quinta, 08/02/2024 às 11:25 (+02), Protesilaos Stavrou <info@protesilaos.com> escreveu:

> Oh, I see. I think the easier way for this is for me to add a semantic
> palette override to that effect.
>
> Until then, try this:
>
>     (defun my-modus-themes-faces ()
>       (modus-themes-with-colors
>         (custom-set-faces
>          '(org-block-begin-line ((,c :background ,bg-dim))))))
>
>     (add-hook 'modus-themes-post-load-hook #'my-modus-themes-faces)
>
> Then load the theme with something like
>
>     (modus-themes-load-theme 'my-modus-themes)

I have a (in my opinion) simpler workaround:

    (set-face-attribute 'org-block nil :background (modus-themes-get-color-value 'bg-dim))

-- 
João Pedro de A. Paula
IT bachelors at Universidade Federal do Rio Grande do Norte (UFRN)
Details
Message ID
<875xxt1fag.fsf@protesilaos.com>
In-Reply-To
<87ttlftfpe.fsf@ergo> (view parent)
DKIM signature
pass
Download raw message
> From: João Pedro <jpedrodeamorim@gmail.com>
> Date: Sat,  9 Mar 2024 15:36:45 -0300
>
> Em quinta, 08/02/2024 às 11:25 (+02), Protesilaos Stavrou <info@protesilaos.com> escreveu:
>
>> Oh, I see. I think the easier way for this is for me to add a semantic
>> palette override to that effect.
>>
>> Until then, try this:
>>
>>     (defun my-modus-themes-faces ()
>>       (modus-themes-with-colors
>>         (custom-set-faces
>>          '(org-block-begin-line ((,c :background ,bg-dim))))))
>>
>>     (add-hook 'modus-themes-post-load-hook #'my-modus-themes-faces)
>>
>> Then load the theme with something like
>>
>>     (modus-themes-load-theme 'my-modus-themes)
>
> I have a (in my opinion) simpler workaround:
>
>     (set-face-attribute 'org-block nil :background (modus-themes-get-color-value 'bg-dim))

Note that in the current Git version of the themes all code blocks have
a grey background by default. I have made several changes along those
lines.

By the way, I just realised we are on the mailing list. Note that I am
phasing out SourceHut:
<https://protesilaos.com/codelog/2024-01-27-sourcehut-no-more/>.
Development continues on GitHub with GitLab as a mirror.

-- 
Protesilaos Stavrou
https://protesilaos.com
Details
Message ID
<8734sx1f75.fsf@protesilaos.com>
In-Reply-To
<87zfv7tfvv.fsf@ergo> (view parent)
DKIM signature
pass
Download raw message
> From: João Pedro <jpedrodeamorim@gmail.com>
> Date: Sat,  9 Mar 2024 15:32:52 -0300
>
> Em quinta, 08/02/2024 às 11:21 (+02), Protesilaos Stavrou <info@protesilaos.com> escreveu:
>
>> Sorry for the late reply. I am slow to respond due to my limited typing
>> time (I have pain in my left arm).
>
> I should be the one apologising this time. A day before you replied I
> had a surgery and haven't touched a computer while recovering. I'm all
> recovered now!

No worries! I hope you are doing well.

>> Note that some faces inherit from 'fixed-pitch' only if the user option
>> 'modus-themes-fixed-pitch' is enabled. Otherwise they do not inherit
>> anything.
>
> This option doesn't seem to apply anymore, can I ask you what changed?

I don't remember making a change. Can you show me an example?

-- 
Protesilaos Stavrou
https://protesilaos.com
Reply to thread Export thread (mbox)