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

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

Re: Question about customising faces


From: Eli Zaretskii
Subject: Re: Question about customising faces
Date: Mon, 29 Aug 2022 16:08:52 +0300

> From: Joost Kremers <joostkremers@fastmail.fm>
> Date: Mon, 29 Aug 2022 13:30:21 +0200
> 
> 
> I wanted to customise the faces used by isearch / lazy-highlight, and I ended 
> up
> having to do the following in order to get it to work for both the initial 
> frame
> and any additional frames created during the Emacs session (with
> `make-frame-command`):
> 
> ```
>   ;; We need to set these faces twice: once for the initial frame...
>   (set-face-attribute 'isearch         nil :background nil             
> :foreground "#d33682")
>   (set-face-attribute 'isearch-group-1 nil :background "lightskyblue1" 
> :foreground "#d33682")
>   (set-face-attribute 'isearch-group-2 nil :background "DarkSeaGreen1" 
> :foreground "#d33682")
>   (set-face-attribute 'lazy-highlight  nil :background nil             
> :foreground nil :box "#d33682")
>   ;; ...and once for all future frames:
>   (set-face-attribute 'isearch         t :background 'unspecified    
> :foreground "#d33682")
>   (set-face-attribute 'isearch-group-1 t :background "lightskyblue1" 
> :foreground "#d33682")
>   (set-face-attribute 'isearch-group-2 t :background "DarkSeaGreen1" 
> :foreground "#d33682")
>   (set-face-attribute 'lazy-highlight  t :background 'unspecified    
> :foreground 'unspecified :box "#d33682")
> ```
> 
> So basically, I need two calls to `set-face-attribute` for each face, I 
> haven't
> found a way to reduce these to one call per face.

The call with FRAME nil should have been enough.  And in my testing,
it is: it sets the attributes for both the first and the subsequent
frames.

> I should perhaps point out that I use a custom theme (solarized-theme) and 
> that
> this invocation is placed inside the `use-package` call that loads this theme
> and activates it:

I don't know what that means in terms of effect on Emacs internals.
Does the single call with FRAME nil work if you do it outside the
use-package thing?  If so, perhaps use-package is the reason it
doesn't work for you.



reply via email to

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