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

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

Re: face-remap-add-relative versus set-face-attribute


From: Emanuel Berg
Subject: Re: face-remap-add-relative versus set-face-attribute
Date: Sun, 13 Feb 2022 01:59:30 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

goncholden via Users list for the GNU Emacs text editor wrote:

> What is superior
>
> Using (face-remap-add-relative 'default :weight 'bold)
>
> or using
>
> (set-face-attribute 'font-lock-comment-face nil :weight normal) ?

They don't do the same thing ...

But the second is good, except I don't think one needs to
`quote' font-lock-comment-face.

It is however needed for font-lock-regexp-grouping-backslash
and font-lock-regexp-grouping-construct - I don't know why
this discrepancy is ...

Don't forget about font-lock-comment-delimiter-face BTW ...

And try this ...

(defun set-all-faces (fg &optional bg weight)
  (let ((backg (or bg     "black"))
        (wght  (or weight 'normal))
        (faces) )
    (mapatoms (lambda (s)
                (when (facep s)
                  (push (symbol-name s) faces) )))
    (dolist (f faces)
      (set-face-attribute (intern f) nil
                          :foreground fg)
                          :background backg
                          :weight     wght
                          :italic     nil) ))

(set-all-faces "red")

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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