These statements lets you set foreground and background colours in a straight forward syntax:

(set-face-foreground 'font-lock-constant-face      "brightwhite")
(set-face-background 'font-lock-constant-face      "cyan")

When using custom-set-faces, statements are automatically made like below, in a somewhat more complex form. If I want to re-create the same faces, without relying on custom-set-faces, but using simple statements like above, how can I do this for for example these statements?

 '(dired-directory ((t (:inherit (font-lock-function-name-face default) :foreground "cyan"))))
 '(header-line ((t (:inherit mode-line :inverse-video nil))))
  • 1
    I voted to close because despite the attempt to make this a programming question, it really only seeks an opinion-oriented answer relating to organization; e.g., what feels less messy, what is less cryptic, what is most compact, what is most readable, what is most straight forward, etc. It is impossible for anyone to write an answer that all of us would agree is correct. In general, the people over at Reddit with the Emacs tag love these types of discussions ... i.e., where everyone puts in their own two cents.
    – lawlist
    Commented Apr 23, 2018 at 13:51
  • If you prefer the first option, why don't you use that?
    – Tyler
    Commented Apr 23, 2018 at 14:04

1 Answer 1

(set-face-attribute 'dired-directory nil
                    :inherit '(font-lock-function-name-face default)
                    :foreground "cyan")

But in your case, I'd ask myself why I'd want to do that. There's nothing wrong with custom-set-faces. Unless you want to do something complicated, like, I don't know, having different color schemes depending on system-name you gain nothing by this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.