all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
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
Date: Mon, 23 Nov 2020 00:38:10 +0100	[thread overview]
Message-ID: <87pn45nesd.fsf@web.de> (raw)
In-Reply-To: <trinity-467cd4c6-91b2-4bee-b7aa-e07ad015012c-1606085627421@3c-app-mailcom-bs01> (Christopher Dimech's message of "Sun, 22 Nov 2020 23:53:47 +0100")

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	other threads:[~2020-11-22 23:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-22 17:30 custom-set-faces for various file types Christopher Dimech
2020-11-22 20:57 ` Michael Heerdegen
2020-11-22 21:16   ` Christopher Dimech
2020-11-22 21:39     ` Michael Heerdegen
2020-11-22 22:04       ` Christopher Dimech
2020-11-22 22:10       ` Christopher Dimech
2020-11-22 22:53         ` Christopher Dimech
2020-11-22 23:38           ` Michael Heerdegen [this message]
2020-11-22 23:52             ` Christopher Dimech

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pn45nesd.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=dimech@gmx.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.