From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Konstantin Kharlamov Newsgroups: gmane.emacs.help Subject: Re: Getting `load-theme` to work in `-batch` mode? Date: Wed, 14 Feb 2024 18:14:05 +0300 Message-ID: References: <86le7nxfb4.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28989"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.50.3 To: Eli Zaretskii , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 14 16:14:53 2024 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 1raGyK-0007L8-KM for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 14 Feb 2024 16:14:52 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raGxp-0006Vn-5G; Wed, 14 Feb 2024 10:14:21 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raGxn-0006VN-D4 for help-gnu-emacs@gnu.org; Wed, 14 Feb 2024 10:14:19 -0500 Original-Received: from forward502c.mail.yandex.net ([2a02:6b8:c03:500:1:45:d181:d502]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raGxj-0007wh-VD; Wed, 14 Feb 2024 10:14:19 -0500 Original-Received: from mail-nwsmtp-smtp-production-main-42.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-42.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:5590:0:640:aac2:0]) by forward502c.mail.yandex.net (Yandex) with ESMTPS id 7B77F616AC; Wed, 14 Feb 2024 18:14:07 +0300 (MSK) Original-Received: by mail-nwsmtp-smtp-production-main-42.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 6EqPcN16Q0U0-FKjfbASL; Wed, 14 Feb 2024 18:14:07 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1707923647; bh=k7WDX4CuaphVPoHktTph1/ummVSKTq0lAamkE3lvBgA=; h=In-Reply-To:Date:References:To:From:Subject:Message-ID; b=SpDGIKT6jXpkm84bEVCSc+DU/03lAzdiSWaBn8q6n18B4sp7SMmDOBzyEmC5ZJsDt fjYT6TOJ4c9dsosWkcVPjCLIy0TRjt7W/CO+wOLA4g3T3npeGQH877aF9laceo/Kh3 sDCpo7kN1GzGdfk/E08rwyPr/j9SDc3z2iXzAsvE= Authentication-Results: mail-nwsmtp-smtp-production-main-42.myt.yp-c.yandex.net; dkim=pass header.i=@yandex.ru In-Reply-To: <86le7nxfb4.fsf@gnu.org> Received-SPF: pass client-ip=2a02:6b8:c03:500:1:45:d181:d502; envelope-from=Hi-Angel@yandex.ru; helo=forward502c.mail.yandex.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:145944 Archived-At: On Wed, 2024-02-14 at 16:59 +0200, Eli Zaretskii wrote: > > From: Konstantin Kharlamov > > Date: Tue, 13 Feb 2024 18:06:43 +0300 > >=20 > > I'm writing tests for color-identifiers-mode, and as part of the > > testing I need to check it reacts correctly to theme being changed. > >=20 > > There are already tests that work fine so far, but it turns out > > `load- > > theme` doesn't work as is. More specifically, even though `(load- > > theme > > 'adwait)` works fine, but background/foreground have no color: > >=20 > > =C2=A0=C2=A0 emacs -batch --eval "(progn (load-theme 'adwaita) (print (= face- > > =C2=A0=C2=A0 attribute 'default :foreground)) (print (face-attribute 'd= efault > > =C2=A0=C2=A0 :background)))" > > =C2=A0=C2=A0=20 > > =C2=A0=C2=A0 "unspecified-fg" > > =C2=A0=C2=A0=20 > > =C2=A0=C2=A0 "unspecified-bg" >=20 > Those are the default colors of a text-mode frame. >=20 > > I asked on Emacs stackexchange=C2=B9 and I was hinted that it's because > > batch-mode doesn't initialize a windowing system. >=20 > That's right. >=20 > > But is there no function I can call to make `load-theme` assign > > colors > > as in non-batch mode? >=20 > What do you mean by that?=C2=A0 The GUI colors are not necessarily > supported by text-mode frames.=C2=A0 So what do you expect from the above= ? >=20 > Btw, if you look at adwaita-theme.el, you will see that it doesn't > bother supporting frames which support less than 89 colors, and the > default frame used by batch sessions certainly doesn't support such a > large number of colors. Sorry, I just don't know details about frames and themes implementation, so it's hard for me to judge for myself=E2=80=A6 Anyway, my usecase is: `color-identifiers-mode` chooses colors by taking into account the background and foreground colors (to make sure colors have good visibility). And it have an "advice" for `change- theme` that regenerates the colors if theme is changed. I just wanted to add a test to CI that makes sure that after `change- theme` is called (via `load-theme` in this case) the colors are regenerated as expected. But such test wouldn't work if calling `load- theme` doesn't influence fg/bg colors (i.e. because colors remain "unspecified"). So what's the correct course of action do you think here?