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: Christopher Dimech
Subject: Re: custom-set-faces for various file types
Date: Mon, 23 Nov 2020 00:52:58 +0100

> Sent: Monday, November 23, 2020 at 12:38 AM
> From: "Michael Heerdegen" <michael_heerdegen@web.de>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: custom-set-faces for various file types
>
> 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.

Correct.  They are already mode specific.  Still I might need to change
others and would have a good system.  It would also help others making
modifications without having to figure out what to do.

Still, as you suggest I can code tho part for mode specific faces differently.
Then others can find a number of different constructs to learn from, rather than
just one way that simply solve mp problems.

> 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]