From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Question about customising faces Date: Mon, 29 Aug 2022 16:08:52 +0300 Message-ID: <83wnarw61n.fsf@gnu.org> References: <871qszs2ku.fsf@fastmail.fm> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22447"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 29 15:09:26 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oSeW4-0005az-L7 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 29 Aug 2022 15:09:24 +0200 Original-Received: from localhost ([::1]:42712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSeW3-0000gs-Jl for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 29 Aug 2022 09:09:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSeVE-0000gh-3A for help-gnu-emacs@gnu.org; Mon, 29 Aug 2022 09:08:32 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:40592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSeVD-000420-Qf for help-gnu-emacs@gnu.org; Mon, 29 Aug 2022 09:08:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=M2s8PDpb45GCvgDlBcLKsxnfHxZdcAVsD/HkukmFjoA=; b=U+sAUm0WZtr+ a57IWso8ejzxzYkyv2vYdfmS1Sz0fcRxONhNxzrp63CKIA65W/Kyh492v+h89N6HT4+Z0pOB56Dfm 28wBxx5soVGdsRBgD6faMU1I/+FxxVBYviMC+fbI5uGHMxG2VYTktNRVmddEQOl+5BGvDaXslTG1P MhRy/ZFa+4KhGBkJEvkJulk10g3XvT/OgMoYjid7VS0/APV8BrclLL7NQj6WHKFctAQNxzisXRrs6 jHlqR123Yvgz5QGiPlGsM4V568/p3Wu2M0MVVRRSpslt6O8MLnW0Sz5D9KVKiqweOer6Sbi1zfoxx o6RAOwn+PBMzu5IESJzK2g==; Original-Received: from [87.69.77.57] (port=3596 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSeVD-0000jQ-9w for help-gnu-emacs@gnu.org; Mon, 29 Aug 2022 09:08:31 -0400 In-Reply-To: <871qszs2ku.fsf@fastmail.fm> (message from Joost Kremers on Mon, 29 Aug 2022 13:30:21 +0200) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:139149 Archived-At: > From: Joost Kremers > 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.