help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: custom-set-faces for various file types


From: Michael Heerdegen
Subject: Re: custom-set-faces for various file types
Date: Mon, 23 Nov 2020 00:38:10 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Christopher Dimech <dimech@gmx.com> writes:

> Would this be good
>
> (add-hook 'org-mode-hook
>    (lambda ()
>       (face-remap-add-relative
>          '(org-level-1 ((t (:foreground "cyan1"))))
>          '(org-level-2 ((t (:foreground "chartreuse"))))
>          '(org-level-3 ((t (:foreground "dark orange"))))
>          '(org-level-4 ((t (:foreground "yellow"))))
>          '(org-level-5 ((t (:foreground "magenta"))))
>          '(org-level-6 ((t (:foreground "tan1"))))
>          '(org-level-7 ((t (:foreground "deep sky blue"))))
>          '(org-level-8 ((t (:foreground "orange red")))) )))

So far you only showed settings of different, mode specific faces.  Your
situation seems to be less complex than I understood, and you don't need
face remapping for these examples; simple `face-spec-set' calls are good
enough.

BTW, as far as I recall, if you know what your are doing, it is even ok
to have multiple `custom-set-faces' calls in your init file.  I don't
recall what happens when your custom file gets written, probably it will
save your settings a second time there, and that may cause trouble (only
later, much later...)

So, for your init file, `face-spec-set' is better, and for per mode
settings of the faces shared by several modes, you want to use face
remapping.  `text-scale-mode' is such a use case, for example (it
modifies the `default' face, i.e., by inheriting, mostly all faces,
buffer locally).


Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]