GNU bug report logs - #80001
[PATCH 1/1] Support `toolkit-theme-set-functions' on macOS

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Alexander Adolf <alexander.adolf@HIDDEN>; Keywords: patch; dated Sat, 13 Dec 2025 21:08:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 7 Jan 2026 20:39:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 07 15:39:11 2026
Received: from localhost ([127.0.0.1]:38203 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vdaJD-0006jn-EF
	for submit <at> debbugs.gnu.org; Wed, 07 Jan 2026 15:39:11 -0500
Received: from mail-ua1-x935.google.com ([2607:f8b0:4864:20::935]:42060)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vdaJA-0006jX-Gi
 for 80001 <at> debbugs.gnu.org; Wed, 07 Jan 2026 15:39:09 -0500
Received: by mail-ua1-x935.google.com with SMTP id
 a1e0cc1a2514c-93f5910b06cso797486241.0
 for <80001 <at> debbugs.gnu.org>; Wed, 07 Jan 2026 12:39:08 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1767818348; x=1768423148; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=n/gCdMh7NUXry0qKcGs32s13VTLehUuURTbGIjt7C5M=;
 b=mnhY5Inff/NEuzl2Sry04OKSUhG2V+dwkZooHm1gt13LZSMIN7HKsRFdjuI02w8aBV
 LMveGXtagWM4AJu+PMVv5cKB/bEKMZeq2YTg65fDoE2iYE09Sr1BMMCR+/6o/Di27LjD
 6Z0lX6r/F2Iq/snLNIB7meJ+Y9TPKeubB1DrthT41/LyI5xlkpewe1e5jiw0od4e3jmj
 5H2Jykk1aJtwA5eyGOhaiUSvOaC0Mg8bPFgpau+6FyCENSPOypov9MDJJYjJloP+C+hv
 blmbhctJM1ribQB8v/PGI8LoLL2ZrfR/pYMDzFhTSx9tDW0836t6NXVlzMcx8blcwroK
 nQDA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1767818348; x=1768423148;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=n/gCdMh7NUXry0qKcGs32s13VTLehUuURTbGIjt7C5M=;
 b=AKTuNnnByhGCWgvn9AX4PBTKUDQisGcutBLNeBllhEuseptj7+uL3/LPxHmx+FoNnO
 4H72n/1gvU+ua7rKTF2YZfHJkZD+cnzgmFCntQd+d35O/X6E9lESW0d82041AIBTOXG1
 GXIiFnwNuNV1z/WPupgzb0YjC7hy8UJa8sZLb6ndU3qUI4F38tmyipFRFQGL8/zr8KNV
 FxgoYFKlBWRsU/ecMHbuca0r85q5xO/09+tvVOVLR206F8Xne8LyvCc2uBycYwYgJXUu
 rcW0mzRKf//kbXu6RQzZ5NdeXrPRdA+dVVTF5Bwo6pwqRfsjoGvoLajqHwPfXL1j2C3/
 QF1g==
X-Forwarded-Encrypted: i=1;
 AJvYcCX7zP9QnucjtLrmDU/FWJO955pLx6ZdqYcZiAdBRxRXyJ3j5UVUpccG65g25L/LCNauyQ3cWg==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Yx26YwcEGipNq/IAqlqird16hY0MVyMQ75I6sZwU5H1LUHJ2V28
 usX2tb3Lof7H6iZj1eoyunFFXRmNTWRSjvQCR4+iBCs9RLRQmLb8zr8NDVmR3HJnkjiGpw2tUAI
 ex+6nlX53ToYfxwt1FNXTAcgNrd9NogM=
X-Gm-Gg: AY/fxX59G6EZuWOXnaK4mjCcenp350jg3nBVRugv7/BN0RgGKpqQTTSDuMaEWyGM/ZI
 amkXXVkSUn99nRcvUS3XPSe9vQaC5vpffOJwn/f2uUhsoZboIDSO8rruIrrNAZeX86Xvk5XUdEt
 7hI0XwOI/UpynU5a+ckbQx7TYer77nD1IiELtOGYF6prxa/aTwIxn0DIMGdY+He8AoTeI2VDfqQ
 xN5U++bgp7EHPKu+SCo9yqkqT/SS8Oh7+qyvJBC3C+ppOhfTTIdHzwUdr5VrUUSOV9DzKA=
X-Google-Smtp-Source: AGHT+IEMv8lDuTr+2lq58dGh0sjqtWegwyyi3zl/c6XD+u9ewqkRQa7G+K5D7nCp5L/8haMwK9cTf9feciDyNBegI/Q=
X-Received: by 2002:a05:6102:3f01:b0:5db:de8f:3278 with SMTP id
 ada2fe7eead31-5ec757092f3mr3016938137.10.1767818347687; Wed, 07 Jan 2026
 12:39:07 -0800 (PST)
MIME-Version: 1.0
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
 <m2ldier8oc.fsf@HIDDEN>
 <c919fd1b350e01b1befd7202efce81ce@HIDDEN>
 <e5bcea57a9e19146bd6e093cd24bf0b9@HIDDEN>
 <m2fr8ihpr5.fsf@HIDDEN>
 <CAN+1HbqUcy3f9S+ALHNPfZoDOwzPjG2vDbf3OaQ+UOdzGXERiw@HIDDEN>
 <68b7e637ca5eeae60ce2bb6bb40fd0fc@HIDDEN>
 <CAN+1HbpOqmZuctugeRbW6Q0Xgb5DA9n10MabLa3245pAPnxwGQ@HIDDEN>
In-Reply-To: <CAN+1HbpOqmZuctugeRbW6Q0Xgb5DA9n10MabLa3245pAPnxwGQ@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Wed, 7 Jan 2026 15:38:55 -0500
X-Gm-Features: AQt7F2prk8hk_zcrdsrFO1AGXEKw9QbRJHEHz9vtAO85q8y6ZeSoJNO8sKHDpks
Message-ID: <CAN+1Hbq7rTNATFWxF6mJuAfE_U=Pih2uYjOz9nFQPUcXdtBGgA@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
To: Alexander Adolf <alexander.adolf@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000a434220647d2480e"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: =?UTF-8?Q?Rudolf_Adamkovi=C4=8D?= <rudolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000a434220647d2480e
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Wed, Jan 7, 2026 at 3:34=E2=80=AFPM St=C3=A9phane Marks <shipmints@gmail=
.com> wrote:

> On Wed, Jan 7, 2026 at 3:15=E2=80=AFPM Alexander Adolf <
> alexander.adolf@HIDDEN> wrote:
>
>> St=C3=A9phane Marks <shipmints@HIDDEN> writes:
>>
>> > [...]
>> > I'd forgotten about the patch below which is a part of the pre-built
>> Emacs
>> > I use as my production Emacs.  I use many other builds I make myself
>> that
>> > do not include this patch so parity with it would be appreciated.  it
>> > exposes a similar variable `ns-system-appearance` to that I request in
>> your
>> > patch.  It may be instructive to compare.
>> > [...]
>>
>> Many thanks for sharing your patch.
>>
>> As I tried to hint in my previous response to your comment, all I wanted
>> to achieve with this is to have the Elisp functions on
>> `toolkit-theme-set-functions` to be invoked when the macOS appearance
>> changes. I will not be spending time & effort on anything beyond this in
>> the context of the present bug. Sorry for not having better news.
>>
>> Your patch seems to indicate that yo have a working solution for what
>> you need? Why not propose it as an enhancement either as a new bug, or
>> on emacs-devel in your own right?
>>
>> By the way, have you had a look to the new variable `toolkit-theme`,
>> which was introduced together with `toolkit-theme-set-functions`?
>> Perhaps it could be used one way or another to achieve what you seem to
>> be looking for?
>>
>
> I haven't looked.  Will `toolkit-theme` serve the same purpose to
> introspect on demand the extant system theme light or dark?
>

For clarity, it is unlikely I will automate Emacs theme switching but would
like to be able to introspect the system theme on demand.

--000000000000a434220647d2480e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Wed, Jan 7, 2026 at 3:34=E2=80=AFPM St=C3=A9phane Marks &lt;<a href=3D"m=
ailto:shipmints@HIDDEN">shipmints@HIDDEN</a>&gt; wrote:</span></div><=
/div><div class=3D"gmail_quote gmail_quote_container"><blockquote class=3D"=
gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(20=
4,204,204);padding-left:1ex"><div dir=3D"ltr"><div dir=3D"ltr"><div style=
=3D"font-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-=
serif">On Wed, Jan 7, 2026 at 3:15=E2=80=AFPM Alexander Adolf &lt;<a href=
=3D"mailto:alexander.adolf@HIDDEN" target=3D"_blank">alexander=
.adolf@HIDDEN</a>&gt; wrote:</span></div></div><div class=3D"g=
mail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0=
.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">St=C3=A9phane=
 Marks &lt;<a href=3D"mailto:shipmints@HIDDEN" target=3D"_blank">shipmin=
ts@HIDDEN</a>&gt; writes:<br>
<br>
&gt; [...]<br>
&gt; I&#39;d forgotten about the patch below which is a part of the pre-bui=
lt Emacs<br>
&gt; I use as my production Emacs.=C2=A0 I use many other builds I make mys=
elf that<br>
&gt; do not include this patch so parity with it would be appreciated.=C2=
=A0 it<br>
&gt; exposes a similar variable `ns-system-appearance` to that I request in=
 your<br>
&gt; patch.=C2=A0 It may be instructive to compare.<br>
&gt; [...]<br>
<br>
Many thanks for sharing your patch.<br>
<br>
As I tried to hint in my previous response to your comment, all I wanted<br=
>
to achieve with this is to have the Elisp functions on<br>
`toolkit-theme-set-functions` to be invoked when the macOS appearance<br>
changes. I will not be spending time &amp; effort on anything beyond this i=
n<br>
the context of the present bug. Sorry for not having better news.<br>
<br>
Your patch seems to indicate that yo have a working solution for what<br>
you need? Why not propose it as an enhancement either as a new bug, or<br>
on emacs-devel in your own right?<br>
<br>
By the way, have you had a look to the new variable `toolkit-theme`,<br>
which was introduced together with `toolkit-theme-set-functions`?<br>
Perhaps it could be used one way or another to achieve what you seem to<br>
be looking for?<br></blockquote><div><br></div><div style=3D"font-family:mo=
nospace">I haven&#39;t looked.=C2=A0 Will `toolkit-theme` serve the same pu=
rpose to introspect on demand the extant system theme light or dark?</div><=
/div></div></blockquote><div><br></div><div class=3D"gmail_default" style=
=3D"font-family:monospace">For clarity, it is unlikely I will automate Emac=
s theme switching but would like to be able to introspect the system theme =
on demand.</div></div></div>

--000000000000a434220647d2480e--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 7 Jan 2026 20:34:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 07 15:34:33 2026
Received: from localhost ([127.0.0.1]:38172 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vdaEj-0006U1-5t
	for submit <at> debbugs.gnu.org; Wed, 07 Jan 2026 15:34:33 -0500
Received: from mail-ua1-x930.google.com ([2607:f8b0:4864:20::930]:53429)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vdaEh-0006Tt-1T
 for 80001 <at> debbugs.gnu.org; Wed, 07 Jan 2026 15:34:31 -0500
Received: by mail-ua1-x930.google.com with SMTP id
 a1e0cc1a2514c-93f542917eeso814259241.2
 for <80001 <at> debbugs.gnu.org>; Wed, 07 Jan 2026 12:34:31 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1767818070; x=1768422870; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=m+iTnML6fkugqSvxgBUd3FLZIV8j8GmW4EBEFLzIsPo=;
 b=VD+/uBmAPkSNBYGNzvngOXfIKXW9HooMUAddqeTqTwQn9bhifWVNSN2EL9HwOmPnut
 icBZ4T/Fr3DjisNDn2szAOocOxYQXNFQKwAxQI8iHIjH02+AbQjErWRqzFTBQ3t1miZO
 YR3GE79XEXaCDS/6lLrLUeRjvKJ9obqFp6YK8m0Z+GVf4TTEzFPA4TMF/iKArwACjTk0
 hrVLC6REpPvlGyn5/xcbOowNB+ouhemwuZT5V8+Pv5M6djfTRQEacknlDM/b1fEIx4Wa
 uTJLazoC7ALQUk6WMJteAHPTohTHaPMUN2EGLqhHVImms2QLG9xg/5YgKj+5a6iic6A2
 blag==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1767818070; x=1768422870;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=m+iTnML6fkugqSvxgBUd3FLZIV8j8GmW4EBEFLzIsPo=;
 b=bLE82xpKt9/b7926jLkgHt1tKjnX/pQpyc2MRmXYwkQ2MniJj51nbLYwOhJRw/qSe/
 Y4a4h313wDf44FNmpP1ULvA5siJdRBdmqMlw2lVimthx1fJHoewSW57sU2mq4GQnWzsQ
 NFBgKSwonolgZ9818RVzQrxTY1hNHZPA1Nz1MoH5ByCDo1upuYq0/PpC3MbQrF0KjjkH
 v19qEvxrQqoncB2rtGoijjUiUSJWGjHQIfWyD2qMTielkBjJQdWPkFkKu27l19PmIy+l
 yPnMUaMj4Nzlokt82jnPoRSe7K6YM1yWz1iBIX13OrapjRlc1vP4ZaVCfswbSsmNeC10
 kK5Q==
X-Forwarded-Encrypted: i=1;
 AJvYcCVz/de/4HzSTuFz+xE8DmVSKxZEXY6nCEij0oerI1dwc0/DXP6lSRpl/fiYaO5FA7wakk0lHQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxKj8tqhGKFf6hIkAFUuPyo5c0T4eSDiaR/8M4XgcMR7gcIg2+2
 XVqUCjtKJFjnJ7b1kl1oIDn51QPMrEG7PKwU5EkSKaCkat3c1BwmC5Ft+EjKK2wiOyfNksbXsiz
 XZOLZ+xAOGlZRDw03zGhOifZUL2QkT6A=
X-Gm-Gg: AY/fxX5pXUoV7chWh/UPU/N+X+Lzs1LXmZttOCN6qyv8NxsoMjjl3VzLA+lBO1VqySl
 /+e/SgR02XANSn1DVeCum5L2c8Va85p66rL9+TcTcvGeuuxXThr1blgbX3Tu45Nx+iBTyCqmvTJ
 JPVkj0VS3sNfI10R0h1lKJ5gQdOArFGzDqACuBeVLcPIqgmHZlTH79IkdmqZG9itKCMSaBUFP5n
 Mfa8wZtAR3yajiLppW5cHtWfPiC5s9/Rd4Y9gxvTLkXsIx4doTzailkTtkOD1faZKef4PM=
X-Google-Smtp-Source: AGHT+IGM01r6KQO8vj2zIhd3GW2u/aW7ORq0ke+DA5cEcZkGC5uAhQZXB+Z6R8pQVRzYR+8AaLTdFcNtUGhHDi62kqU=
X-Received: by 2002:a05:6102:3f09:b0:5db:f573:a2c with SMTP id
 ada2fe7eead31-5ecb6875d0fmr1166756137.13.1767818070184; Wed, 07 Jan 2026
 12:34:30 -0800 (PST)
MIME-Version: 1.0
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
 <m2ldier8oc.fsf@HIDDEN>
 <c919fd1b350e01b1befd7202efce81ce@HIDDEN>
 <e5bcea57a9e19146bd6e093cd24bf0b9@HIDDEN>
 <m2fr8ihpr5.fsf@HIDDEN>
 <CAN+1HbqUcy3f9S+ALHNPfZoDOwzPjG2vDbf3OaQ+UOdzGXERiw@HIDDEN>
 <68b7e637ca5eeae60ce2bb6bb40fd0fc@HIDDEN>
In-Reply-To: <68b7e637ca5eeae60ce2bb6bb40fd0fc@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Wed, 7 Jan 2026 15:34:18 -0500
X-Gm-Features: AQt7F2ryUaOGWjz1GJxwACKlARJyGYQ6dH81Wl9UBuuP7hYKKPBWdRUDi-X75Ok
Message-ID: <CAN+1HbpOqmZuctugeRbW6Q0Xgb5DA9n10MabLa3245pAPnxwGQ@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
To: Alexander Adolf <alexander.adolf@HIDDEN>
Content-Type: multipart/alternative; boundary="00000000000019d79a0647d238d8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: =?UTF-8?Q?Rudolf_Adamkovi=C4=8D?= <rudolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--00000000000019d79a0647d238d8
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Wed, Jan 7, 2026 at 3:15=E2=80=AFPM Alexander Adolf <
alexander.adolf@HIDDEN> wrote:

> St=C3=A9phane Marks <shipmints@HIDDEN> writes:
>
> > [...]
> > I'd forgotten about the patch below which is a part of the pre-built
> Emacs
> > I use as my production Emacs.  I use many other builds I make myself th=
at
> > do not include this patch so parity with it would be appreciated.  it
> > exposes a similar variable `ns-system-appearance` to that I request in
> your
> > patch.  It may be instructive to compare.
> > [...]
>
> Many thanks for sharing your patch.
>
> As I tried to hint in my previous response to your comment, all I wanted
> to achieve with this is to have the Elisp functions on
> `toolkit-theme-set-functions` to be invoked when the macOS appearance
> changes. I will not be spending time & effort on anything beyond this in
> the context of the present bug. Sorry for not having better news.
>
> Your patch seems to indicate that yo have a working solution for what
> you need? Why not propose it as an enhancement either as a new bug, or
> on emacs-devel in your own right?
>
> By the way, have you had a look to the new variable `toolkit-theme`,
> which was introduced together with `toolkit-theme-set-functions`?
> Perhaps it could be used one way or another to achieve what you seem to
> be looking for?
>

I haven't looked.  Will `toolkit-theme` serve the same purpose to
introspect on demand the extant system theme light or dark?

--00000000000019d79a0647d238d8
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Wed, Jan 7, 2026 at 3:15=E2=80=AFPM Alexander Adolf &lt;<a href=3D"mailt=
o:alexander.adolf@HIDDEN">alexander.adolf@HIDDEN<=
/a>&gt; wrote:</span></div></div><div class=3D"gmail_quote gmail_quote_cont=
ainer"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;=
border-left:1px solid rgb(204,204,204);padding-left:1ex">St=C3=A9phane Mark=
s &lt;<a href=3D"mailto:shipmints@HIDDEN" target=3D"_blank">shipmints@gm=
ail.com</a>&gt; writes:<br>
<br>
&gt; [...]<br>
&gt; I&#39;d forgotten about the patch below which is a part of the pre-bui=
lt Emacs<br>
&gt; I use as my production Emacs.=C2=A0 I use many other builds I make mys=
elf that<br>
&gt; do not include this patch so parity with it would be appreciated.=C2=
=A0 it<br>
&gt; exposes a similar variable `ns-system-appearance` to that I request in=
 your<br>
&gt; patch.=C2=A0 It may be instructive to compare.<br>
&gt; [...]<br>
<br>
Many thanks for sharing your patch.<br>
<br>
As I tried to hint in my previous response to your comment, all I wanted<br=
>
to achieve with this is to have the Elisp functions on<br>
`toolkit-theme-set-functions` to be invoked when the macOS appearance<br>
changes. I will not be spending time &amp; effort on anything beyond this i=
n<br>
the context of the present bug. Sorry for not having better news.<br>
<br>
Your patch seems to indicate that yo have a working solution for what<br>
you need? Why not propose it as an enhancement either as a new bug, or<br>
on emacs-devel in your own right?<br>
<br>
By the way, have you had a look to the new variable `toolkit-theme`,<br>
which was introduced together with `toolkit-theme-set-functions`?<br>
Perhaps it could be used one way or another to achieve what you seem to<br>
be looking for?<br></blockquote><div><br></div><div class=3D"gmail_default"=
 style=3D"font-family:monospace">I haven&#39;t looked.=C2=A0 Will `toolkit-=
theme` serve the same purpose to introspect on demand the extant system the=
me light or dark?</div></div></div>

--00000000000019d79a0647d238d8--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 7 Jan 2026 20:15:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 07 15:15:19 2026
Received: from localhost ([127.0.0.1]:37997 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vdZw7-0005R5-5I
	for submit <at> debbugs.gnu.org; Wed, 07 Jan 2026 15:15:19 -0500
Received: from www191.your-server.de ([188.40.2.11]:51186)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vdZw3-0005O5-5d
 for 80001 <at> debbugs.gnu.org; Wed, 07 Jan 2026 15:15:17 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=condition-alpha.com; s=default2503; h=Content-Transfer-Encoding:
 Content-Type:MIME-Version:Date:In-reply-to:References:Subject:Cc:To:From:
 Message-Id:Sender:Reply-To:Content-ID:Content-Description:Resent-Date:
 Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
 bh=/bsXfM2nU+ZlpxtsQ3yp6p5xamRb/hnVk8Y3POkWENg=; b=bXPrAMSwN6hSfjLMILjn0O3d01
 HwgHqm6+FztFhRYIvBaDZHnY60DJQOZ7ICyYHkN5z9ch0yvMu9aCqUNTta9pvcLygMqM3Bn6Q9QCH
 DlRdERhwhAGBwa6Q8emnWYT0Xm2nJyx5jk7Q/Fr8+3vutdJyBWUw2SVvFFbr46MFAvOrwv9ewuPYH
 x/yTtLFx2Sue4mkCiG4EIz9hwm8ry5JlXOb7ho7FRAnrJ9DYalpErIpGoeRrR52dILMF5xhVrkXKI
 MQLIacp19/CbHH472+o7/Sw8jInCp90znfE3roYxZmaF8sQS0wM5xrdXVUE53LGEygVOKrUFf+JMG
 7tm1BvCw==;
Received: from sslproxy07.your-server.de ([78.47.199.104])
 by www191.your-server.de with esmtpsa  (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96.2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vdZvw-000Dwu-16; Wed, 07 Jan 2026 21:15:08 +0100
Received: from localhost ([127.0.0.1])
 by sslproxy07.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vdZvv-0009jg-19; Wed, 07 Jan 2026 21:15:08 +0100
Message-Id: <68b7e637ca5eeae60ce2bb6bb40fd0fc@HIDDEN>
From: Alexander Adolf <alexander.adolf@HIDDEN>
To: =?utf-8?Q?St=C3=A9phane?= Marks <shipmints@HIDDEN>, Rudolf
 =?utf-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
 <m2ldier8oc.fsf@HIDDEN>
 <c919fd1b350e01b1befd7202efce81ce@HIDDEN>
 <e5bcea57a9e19146bd6e093cd24bf0b9@HIDDEN>
 <m2fr8ihpr5.fsf@HIDDEN>
 <CAN+1HbqUcy3f9S+ALHNPfZoDOwzPjG2vDbf3OaQ+UOdzGXERiw@HIDDEN>
In-reply-to: <CAN+1HbqUcy3f9S+ALHNPfZoDOwzPjG2vDbf3OaQ+UOdzGXERiw@HIDDEN>
Date: Wed, 07 Jan 2026 21:15:07 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: Clear (ClamAV 1.0.9/27873/Wed Jan  7 08:26:11 2026)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

St=C3=A9phane Marks <shipmints@HIDDEN> writes:

> [...]
> I'd forgotten about the patch below which is a part of the pre-built Emacs
> I use as my production Emacs.  I use many other builds I make myself that
> do not include this patch so parity with it would be appreciated.  it
> exposes a similar variable `ns-system-appearance` to that I request in yo=
ur
> patch.  It may be instructive to compare.
> [...]

Many thanks for sharing your patch.

As I tried to hint in my previous response to your comment, all I wanted
to achieve with this is to have the Elisp functions on
`toolkit-theme-set-functions` to be invoked when the macOS appearance
changes. I will not be spending time & effort on anything beyond this in
the context of the present bug. Sorry for not having better news.

Your patch seems to indicate that yo have a working solution for what
you need? Why not propose it as an enhancement either as a new bug, or
on emacs-devel in your own right?

By the way, have you had a look to the new variable `toolkit-theme`,
which was introduced together with `toolkit-theme-set-functions`?
Perhaps it could be used one way or another to achieve what you seem to
be looking for?


Cheers,

  --alexander




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 7 Jan 2026 10:54:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 07 05:54:52 2026
Received: from localhost ([127.0.0.1]:34741 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vdRBj-0004s1-TW
	for submit <at> debbugs.gnu.org; Wed, 07 Jan 2026 05:54:52 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:34014)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <yavor@HIDDEN>) id 1vdRBh-0004rl-0m
 for 80001 <at> debbugs.gnu.org; Wed, 07 Jan 2026 05:54:50 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <yavor@HIDDEN>)
 id 1vdRBa-0002Ku-To; Wed, 07 Jan 2026 05:54:42 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Subject:To:From:
 Date; bh=UY4NoRjEKYdy7mFVbr7ZbqBRGXoXZA5gglTDQcgxeRs=; b=UIddmaAVQqD+y0Se+MnY
 af1JWWkDVvf5/RqiTe3icXLnfY3c168nZT+dX+1O/BXvOAmkJorAvVjtd3h4U3IqCEQueOCPC25Ox
 vlJSjJgzuOErGKIjHu6qeFouUzIwRc05lA9koNyfPgHE4lpmeA50SOHYCNU3tLrhriKnWeL+EDuoH
 /fJ27Lx9deScsH2+EUprsWayHYXfQTlf4q2O9w/B0QF5h/LlP0x9RBHX0Twq5tNEYeiNO9dlNmsZK
 SJX3cLYJ5Hmjz2oR2vAIRzqQiJAxBk4tTy8tXFU9HCyZPq3bhf8WYP4HvEvjJhC41EXq9qPbRQ03Z
 X3P+al480D3P/A==;
Date: Wed, 07 Jan 2026 12:54:24 +0200
Message-ID: <87ikddu1zz.GNU's_not_UNIX!-yavor@HIDDEN>
From: Yavor Doganov <yavor@HIDDEN>
To: Rudolf =?UTF-8?B?QWRhbWtvdmnEjQ==?= <rudolf@HIDDEN>, Alexander
 Adolf <alexander.adolf@HIDDEN>,	=?UTF-8?B?U3TDqXBoYW5l?= Marks
 <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
In-Reply-To: <m2fr8ihpr5.fsf@HIDDEN>
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
 <m2ldier8oc.fsf@HIDDEN>
 <c919fd1b350e01b1befd7202efce81ce@HIDDEN>
 <e5bcea57a9e19146bd6e093cd24bf0b9@HIDDEN>
 <m2fr8ihpr5.fsf@HIDDEN>
User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue)
 FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0
 Emacs/31.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)
Organization: The GNU Emacs Church (Bulgarian Eparchy)
MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue")
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80001
Cc: yavor@HIDDEN, 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Rudolf Adamkovič wrote:
> > +      if (name && ([name length] > 0)) {
> 
> I do not think we need ([name length] > 0).  Yes, the receiver is a
> string, but that is an implementation detail.

Sorry to interfere but this is not correct.  An empty string will pass
the check and apparently that's not the author's intention.  Checking
for "name" is redundant, so a proper condition would be

  if ([name length])

If the receiver is nil or it is the empty string, it will be false.

> > +	BOOL shouldUseDarkAppearance = [name isEqualToString:NSAppearanceNameDarkAqua];
> 
> We could simplify by sending isEqual here.  Yes, the receiver is a
> string, but that is an implementation detail.

When you are certain that both objects are strings, -isEqualToString:
should be preferred because it's faster.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 7 Jan 2026 00:20:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 06 19:20:46 2026
Received: from localhost ([127.0.0.1]:32768 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vdHI6-0003vg-60
	for submit <at> debbugs.gnu.org; Tue, 06 Jan 2026 19:20:46 -0500
Received: from mail-ua1-x929.google.com ([2607:f8b0:4864:20::929]:45097)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vdHHw-0003vM-Hq
 for 80001 <at> debbugs.gnu.org; Tue, 06 Jan 2026 19:20:42 -0500
Received: by mail-ua1-x929.google.com with SMTP id
 a1e0cc1a2514c-93f63d46f34so453644241.2
 for <80001 <at> debbugs.gnu.org>; Tue, 06 Jan 2026 16:20:36 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1767745235; x=1768350035; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=yzs7+QU3ewgTS4d3Wl84sXqj0Qn98gL07yQ0kbL/7/g=;
 b=i7sq6eUo+BWr8uPob9xRWM9b0t1BMnNdJGLsaTytuq46gUSupD/6JjvEUm6g7fn1x8
 NRzoQI2n1cTig57+dyzaWeAX1AJRoc08Gj1CdsFqXwoHi0IyhLjzHhb87B91uhlpPZwY
 gtWSD3paG1oSnWD6Do+8l1jfTxa86rOuVXz2DOyIRvbXb6Uweok+vtfgd7niISI3Hmcb
 pwSjUdbOrQEUD8DEJaJWaqWSEApxfFWtXMeE4Ms0N4QUlwTB1SoStdQHgOB0g5txPQdN
 QPYCQyv4BB7vxzUrEuyqrpSoH1OjwJ2enlciNk63grQ66dtvM6K/2vWxMjNs3bRmDEVS
 brVA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1767745235; x=1768350035;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=yzs7+QU3ewgTS4d3Wl84sXqj0Qn98gL07yQ0kbL/7/g=;
 b=YpLuxnRYLww5IQOwwuEpVadQCPATniMtEsNkz7/MGBJos3Bq505o0SM8uzzUOEuKzj
 9od1dqu01fGE0mqFIe3xcqeMEw7MZhG6ZjH5Bfu9cqrQhrBogChmqydxw03B1ux2zMHK
 M2ffhs7eU358jEVanHFWUmGZpOJAosVWR9qKFPXopLwsvKF35WMQ3E0csJG8bY1hclAt
 viJeU7HPTrHVWxGwbzZvMFJPybHQTX/I/ackvILusbc2zGIqTMMCDTVUq3IAbLEBLnTO
 IA6RTmFLNqc+PTdaJbJrLK2X/XB+74QbZ+MjWe0IPnVs0whKqQDao1FQyDtOKH/5YuMN
 pg2A==
X-Forwarded-Encrypted: i=1;
 AJvYcCVpcdji0i40/dUCxPEJgd0zVqJWQcGI5FQLSReLNtimiO8BNBPp5Y/uuvfm7PvWKFtAGtoTgg==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Yy8mmV1V21y8fISGNgKjWkzXwYElptSfZ8T/19CrieNIGkZndlp
 0QE4cVjMlNvOKNmy2m1J9PiqMNPnyReIpo3i2SXyXXnTvCwPlwZUGg096H1XkhSIAxywvvNvZsj
 m00JRPuvuTC2HqnWXi+t5V9hnO7s3VD8=
X-Gm-Gg: AY/fxX78qY5Xqe4dxmAEB1KbPfj2d1EgfMPslgWY4Ov22Col91ATe0ogdP/VdWutDL+
 PHa/DbBWQuJF0NqazP8qiuSD+QpZrUt6T6YLKd/1lUowjMK6ii+/HBBQJW4AUzjpky2UwG+Xuso
 wr9WxRZ0GPv8/+NLNUZkhYSYJNCSDi2S1/eZiKvaDJ62VDEfPDivSN69g0wTRZ09b9dKL91JzPe
 TrBLC56J7c8xP36Hn7/F3iGYmr5ccjkz5mcisSJUV/QRILdzA9IM/ueJfBLbKcfSJrzgak=
X-Google-Smtp-Source: AGHT+IFY8eetFf3dY/u8wCotblCCnwkDQHAsg3M+eGl3GmHO1brcLlHPW0SyzydfeFaHz8XzOEDbO+/hc52vZdRJd00=
X-Received: by 2002:a05:6102:3592:b0:521:b9f2:a5ca with SMTP id
 ada2fe7eead31-5ecb1e93f35mr203566137.13.1767745235477; Tue, 06 Jan 2026
 16:20:35 -0800 (PST)
MIME-Version: 1.0
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
 <m2ldier8oc.fsf@HIDDEN>
 <c919fd1b350e01b1befd7202efce81ce@HIDDEN>
 <e5bcea57a9e19146bd6e093cd24bf0b9@HIDDEN>
 <m2fr8ihpr5.fsf@HIDDEN>
 <CAN+1HbqUcy3f9S+ALHNPfZoDOwzPjG2vDbf3OaQ+UOdzGXERiw@HIDDEN>
 <m2qzs2xprh.fsf@HIDDEN>
In-Reply-To: <m2qzs2xprh.fsf@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Tue, 6 Jan 2026 19:20:22 -0500
X-Gm-Features: AQt7F2opvOB_2GKpcH-IlM66nrvm9BGk5r7gm8rh37_MtZVzwjsp5MVNvqJyPjE
Message-ID: <CAN+1HboSEAfmvUVVMKCFLCwkqxwephYxcb8r_YWfhFrhtZ-y4Q@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
To: =?UTF-8?Q?Rudolf_Adamkovi=C4=8D?= <rudolf@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000d0682c0647c14218"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: Alexander Adolf <alexander.adolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000d0682c0647c14218
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, Jan 6, 2026 at 6:52=E2=80=AFPM Rudolf Adamkovi=C4=8D <rudolf@adamko=
vic.org>
wrote:

> St=C3=A9phane Marks <shipmints@HIDDEN> writes:
>
> > it exposes a similar variable `ns-system-appearance` to that I request
> > in your patch
>
> IMO, we should avoid adding unnecessary NS-exclusive variables, because
> they make Emacs Lisp code strongly dependent on the underlying OS.  The
> concept of light and dark appearance is not NS-specific, is it?  And if
> it is, should it be?
>

In the absence of a standard variable shared by all GUI toolkits, we need
something.

--000000000000d0682c0647c14218
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Tue, Jan 6, 2026 at 6:52=E2=80=AFPM Rudolf Adamkovi=C4=8D &lt;<a href=3D=
"mailto:rudolf@HIDDEN">rudolf@HIDDEN</a>&gt; wrote:</span></d=
iv></div><div class=3D"gmail_quote gmail_quote_container"><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex">St=C3=A9phane Marks &lt;<a href=3D"mailto:=
shipmints@HIDDEN" target=3D"_blank">shipmints@HIDDEN</a>&gt; writes:<=
br>
<br>
&gt; it exposes a similar variable `ns-system-appearance` to that I request=
<br>
&gt; in your patch<br>
<br>
IMO, we should avoid adding unnecessary NS-exclusive variables, because<br>
they make Emacs Lisp code strongly dependent on the underlying OS.=C2=A0 Th=
e<br>
concept of light and dark appearance is not NS-specific, is it?=C2=A0 And i=
f<br>
it is, should it be?<br></blockquote><div><br></div><div class=3D"gmail_def=
ault" style=3D"font-family:monospace">In the absence of a standard variable=
 shared by all GUI toolkits, we need something.</div></div></div>

--000000000000d0682c0647c14218--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 6 Jan 2026 23:53:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 06 18:53:02 2026
Received: from localhost ([127.0.0.1]:60942 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vdGrG-0002Wy-IB
	for submit <at> debbugs.gnu.org; Tue, 06 Jan 2026 18:53:02 -0500
Received: from fhigh-a1-smtp.messagingengine.com ([103.168.172.152]:54767)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rudolf@HIDDEN>)
 id 1vdGrD-0002WR-Fn
 for 80001 <at> debbugs.gnu.org; Tue, 06 Jan 2026 18:53:00 -0500
Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51])
 by mailfhigh.phl.internal (Postfix) with ESMTP id 88696140005F;
 Tue,  6 Jan 2026 18:52:53 -0500 (EST)
Received: from phl-frontend-04 ([10.202.2.163])
 by phl-compute-11.internal (MEProxy); Tue, 06 Jan 2026 18:52:53 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamkovic.org;
 h=cc:cc:content-transfer-encoding:content-type:content-type
 :date:date:from:from:in-reply-to:in-reply-to:message-id
 :mime-version:references:reply-to:subject:subject:to:to; s=fm3;
 t=1767743573; x=1767829973; bh=eVVwFzp1CByul2EJxvHFYK5+uiaZdUcF
 wzKLrUPIFVs=; b=CAJHF4TD57aiTJQmOUfVQ7vsYgip5xYR+N+Wpeq1AkZExJgP
 RS5OZhqkYofLQ/0BoCRLY6dc5uRhQiw8DiMrwphZSsUo4VEBBH+qmXNqcDITTrj2
 iZ1rzNtfxUfjGMeR4cSxVOZz7sIxN7Pkld3+Spo7i9vmwnXsO0sFdHhcm6uuhAME
 KvDfypdAtKwh8zgcD2Qlm5grMWu21jDA7FtPSfkACtZOtH1AlkhUnrUbpzp0bMPM
 4D7/RSt3xWGQvwcdgZSi5ECio6vGxLBBPP1E1nY2mbSsoMuY+A1sor/RqyzvVVut
 3FwKv4l8oAbzVO3tRS5XsjSS3aO1b7yi/sPujw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1767743573; x=
 1767829973; bh=eVVwFzp1CByul2EJxvHFYK5+uiaZdUcFwzKLrUPIFVs=; b=Y
 EWy3p3EXsO7i12+eBX+Z1JmxYphCaSDRILjNNSoAY7tOM1VCf4GkO2kjOQ2F+yZk
 /80ILqVKZNY9ASKI2Ph+szRNmt3jOWMNfiYcGpVw2MMHD99WFOQq+esyBq/NIGYb
 QSfKtEqS6YqzbCSgMZ2jxTHFia4QG8UGmDR3DYHeeeGjFiVxKZcGVu0Bxpoczv8D
 bR6bZ6jQPmpTBZPM4MOcQfQ/RKwlycDi0QtVD+VhIo7hr11APqTqBAssoXDRo1o8
 U0FPIrjP7gZ9YF0bJ37G7cogigWv7ybIimCARiqF7UbjhFLSvwuQJFS41dhff4Tv
 GzjfYf7hd6BipEA03Lcfg==
X-ME-Sender: <xms:VaBdaVHycAns3fghvT8nYe86z09b8uFO1-r1AFuJdO6cJ5w5AzDp_A>
 <xme:VaBdaRzqSdE0irgesVsdsD1o9sn9COHZe4iPVvE0zgLxjrVxHG6Z4pcXYJ7u17F8k
 WsbSYmMNsDgM2BbLGsc0sNJMQ3vo1XLjSaTcaBAY-S-Q2fSSC83a1o>
X-ME-Received: <xmr:VaBdaUjeG9M33IARR499Vv9weAv_3UtNuN66RsfncJRJTrqS21_HQO1YUWBjCq0rUN4oZ5-ADZd7BudGwYI9CYIj51wEE5M>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddutdduheeiucetufdoteggodetrf
 dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu
 rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf
 gurhephffvvefujghffffkgggtgfesthhqredttddtjeenucfhrhhomheptfhuugholhhf
 ucetuggrmhhkohhvihgtuceorhhuugholhhfsegruggrmhhkohhvihgtrdhorhhgqeenuc
 ggtffrrghtthgvrhhnpeeiueetheffudfghfeggeevheevvddtkefflefhueeludfgtefg
 ffeltdfhudejgeenucffohhmrghinheprggurghmkhhovhhitgdrohhrghenucevlhhush
 htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehruhguohhlfhesrggu
 rghmkhhovhhitgdrohhrghdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouh
 htpdhrtghpthhtohepkedttddtudesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphht
 thhopegrlhgvgigrnhguvghrrdgrugholhhfsegtohhnughithhiohhnqdgrlhhphhgrrd
 gtohhmpdhrtghpthhtohepshhhihhpmhhinhhtshesghhmrghilhdrtghomh
X-ME-Proxy: <xmx:VaBdaUzYvC9mvoyxC-gcocsoBOp7Lk-Ec3b2H8qAEH4MXudDPm14WA>
 <xmx:VaBdafLbLbZeRg7j3FjV8Ll4vwvlZLL41jUEgBteNfVxzGS29jleSA>
 <xmx:VaBdaTSTy26IfNHHQSeXMpDlIwbU3kQQhPqY2bUAE_vYZs5DXgPpTA>
 <xmx:VaBdafpusUxsEwmXGVbk8dQAXd_XjAxhl30PVkuBdmQ9o2ENXfcXAQ>
 <xmx:VaBdaTeyfjQCQ42z-hCIfsGOzHD3nTnPiYDfhIQWzGEQ168C1UY7ZVe5>
Feedback-ID: i88214938:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue,
 6 Jan 2026 18:52:52 -0500 (EST)
From: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>
To: =?utf-8?Q?St=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
In-Reply-To: <CAN+1HbqUcy3f9S+ALHNPfZoDOwzPjG2vDbf3OaQ+UOdzGXERiw@HIDDEN>
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
 <m2ldier8oc.fsf@HIDDEN>
 <c919fd1b350e01b1befd7202efce81ce@HIDDEN>
 <e5bcea57a9e19146bd6e093cd24bf0b9@HIDDEN>
 <m2fr8ihpr5.fsf@HIDDEN>
 <CAN+1HbqUcy3f9S+ALHNPfZoDOwzPjG2vDbf3OaQ+UOdzGXERiw@HIDDEN>
Date: Wed, 07 Jan 2026 00:52:50 +0100
Message-ID: <m2qzs2xprh.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80001
Cc: Alexander Adolf <alexander.adolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

St=C3=A9phane Marks <shipmints@HIDDEN> writes:

> it exposes a similar variable `ns-system-appearance` to that I request
> in your patch

IMO, we should avoid adding unnecessary NS-exclusive variables, because
they make Emacs Lisp code strongly dependent on the underlying OS.  The
concept of light and dark appearance is not NS-specific, is it?  And if
it is, should it be?

Rudy
--=20
"One can begin to reason only when a clear picture has been formed in
the imagination."

--- Walter Warwick Sawyer, Mathematician's Delight, 1943

Rudolf Adamkovi=C4=8D <rudolf@HIDDEN> [he/him]
http://adamkovic.org




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 6 Jan 2026 13:12:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 06 08:12:04 2026
Received: from localhost ([127.0.0.1]:57447 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vd6qy-0004EI-5C
	for submit <at> debbugs.gnu.org; Tue, 06 Jan 2026 08:12:04 -0500
Received: from mail-vs1-xe33.google.com ([2607:f8b0:4864:20::e33]:61485)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vd6qv-0004Dp-Bm
 for 80001 <at> debbugs.gnu.org; Tue, 06 Jan 2026 08:12:02 -0500
Received: by mail-vs1-xe33.google.com with SMTP id
 ada2fe7eead31-5e53441429fso578633137.2
 for <80001 <at> debbugs.gnu.org>; Tue, 06 Jan 2026 05:12:01 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1767705120; x=1768309920; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=am3yBYgJGE5kkFYz1/qXru9i/G6WFZ015R42W4iBWaw=;
 b=djbDl3eVzZF3X/KT4yQBw6wEjajv1pghtdo6RNbgfMFed4jUAALdBHcoArQvtbb+L1
 a0jZJvOzKbHrMPGMJrEwworOUoq/XS7ANvJFCd+j9p67jh7uldRmuuz1kugeuBh1Mg0Q
 urDwYpC+3+U5oal1NQvS4ZDS6KBXGWYhgGSkrGWxLvs2cLDBhBLZbX+zg8ib+mDkKcOf
 t4k0LNi8zm7j7ma8dg3gkVOBF/0bRNO6fFoytXVB8VV3NplhB3CiUUSTfY0OqoJD+fne
 S1GjxZHhcVc0o13I6GjQc1oPivexeEHfS7aqA5WBWG7FMCcsZia5/ASj0PDkPze1Dnlo
 MxhA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1767705120; x=1768309920;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=am3yBYgJGE5kkFYz1/qXru9i/G6WFZ015R42W4iBWaw=;
 b=DTrnXXmAhe7prQAX0qhCUf7dhAw+ufP0XvyIO3ilUjTMW9o35Bi1in4eUJ7PTweeZm
 IXBofzOiYjlf2pSRAo6NvibEMyaVdDxsODOqUU+jMN/OxBe4Tl/neq/MG/IxG2TFsM0x
 uXLKiPu7pIxrzE8doWYpjzy7a6hxXjOMjpy0e0BpXYJzB5JDrXGoeH0gaGKWBBI5BOE6
 wcQHfddv1fsla0mQIP4RJWwwb5o5XIBgFOFsCuqwOPvXUmgmMI5kYEVShH6kZC0AlanE
 Bqswras7vUU8fUk6zacGMgDKg+MlSN1Gcym3uRZuAl33Kxhvzx6arcykmFUlXAsktf6Y
 N02Q==
X-Forwarded-Encrypted: i=1;
 AJvYcCUA8jQvjqWANEIqGOTDCiPUkhq0fH36ZQN+1JIpyGQ2ed20YMnBvj0QFs91RXY6KtuSzgL4wA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwXMoLLlYhY7Lc7xAuSD4fZIuYv9IEKl+UduyW3FXx+hfaD/aco
 akgskQeMCnuMms7K8NPrWCCTLGZeqzPHskMBdvUewACr3UOV8RG1ZEyuk90npmnWmD6ereeLCzt
 ZugegzM3+7GGHC9ZJHflpqizgxcXXT/f6S5BB
X-Gm-Gg: AY/fxX4l8RDWlnFhuDpzVIUq/caovG7J1zyCIy4bNfprLKxVRz9JD00nZbNhfcpyhmR
 CSd5Inr5rTwD9zkAOIB21IsT1rMTCnqe1vlZKlFwHNH0xNZGM9YQDgOzxBvd15jmYoOyEIH04JC
 0wTnUhDdosE8fxQd/1fd9jhFViUu3B8DC90NHXJxYOVpmdcUWY2FnDapJTSPxYLLr7ofLol4JcM
 KZfsqi/b59Opa9OpFpB3Rq5OvHKuvnaaGXRlfiWE0IYCjbvBXIQ7FXaD/A82z1rPYAPPqE=
X-Google-Smtp-Source: AGHT+IEw5ilVLQcR3M8Nt1u2X1yJnf9gByIM4LBCmCETl+87vY327PrA5RVSsU9HOe0dGY0LYm9ukjZyS+16//6Unv4=
X-Received: by 2002:a05:6102:50a7:b0:5db:f352:afbe with SMTP id
 ada2fe7eead31-5ec742efbe7mr895713137.6.1767705120311; Tue, 06 Jan 2026
 05:12:00 -0800 (PST)
MIME-Version: 1.0
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
 <m2ldier8oc.fsf@HIDDEN>
 <c919fd1b350e01b1befd7202efce81ce@HIDDEN>
 <e5bcea57a9e19146bd6e093cd24bf0b9@HIDDEN>
 <m2fr8ihpr5.fsf@HIDDEN>
In-Reply-To: <m2fr8ihpr5.fsf@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Tue, 6 Jan 2026 08:11:47 -0500
X-Gm-Features: AQt7F2rQEgKHAY-iDVaKAwxAMW52ALT9GV7pA5b_JZVsyJLzEGI4d7BnUtcvlWE
Message-ID: <CAN+1HbqUcy3f9S+ALHNPfZoDOwzPjG2vDbf3OaQ+UOdzGXERiw@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
To: =?UTF-8?Q?Rudolf_Adamkovi=C4=8D?= <rudolf@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000c38f170647b7eb7f"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: Alexander Adolf <alexander.adolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000c38f170647b7eb7f
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, Jan 6, 2026 at 7:47=E2=80=AFAM Rudolf Adamkovi=C4=8D <rudolf@adamko=
vic.org>
wrote:

> Alexander Adolf <alexander.adolf@HIDDEN> writes:
>
> > From b984c524985d10ec4f1ee297254dbdef79c08e25 Mon Sep 17 00:00:00 2001
> > From: Alexander Adolf <alexander.adolf@HIDDEN>
> > Date: Sat, 13 Dec 2025 21:25:13 +0100
> > Subject: [PATCH] Support `toolkit-theme-set-functions' on macOS
>
> The patch is looking better and better.
>
> Way to go, Alexander!
>
> > +  /* Ensure that a UI appearance change will be detected at startup by
> > +     setting the property to the opposite of the current UI appearance=
.
> */
> > +  NSArray *referenceNames =3D @[ NSAppearanceNameAqua,
> NSAppearanceNameDarkAqua ];
> > +  NSAppearance *appearance =3D [self effectiveAppearance];
> > +  NSAppearanceName name =3D [appearance
> bestMatchFromAppearancesWithNames:referenceNames];
> > +  if (name && ([name length] > 0)) {
> > +    self.doesUseDarkAppearance =3D ! [name
> isEqualToString:NSAppearanceNameDarkAqua];
> > +  }
>
> We do not have a good reason for adding this complexity.  Let us step
> back to think.  What do we need?  We need 3 states: nil, YES, NO.  In
> other words, we need a boxed Boolean.  We can box a Boolean simply with
> NSNumber.  And properties are nil by default, which is handy.
>
> > +    if ((kind =3D=3D NSKeyValueChangeSetting) && ( ! isPrior)) {
>
> Nit: Strange spacing. :)
>
> > +      NSArray *referenceNames =3D @[NSAppearanceNameAqua,
> NSAppearanceNameDarkAqua];
> > +      NSAppearance *appearance =3D [object effectiveAppearance];
> > +      NSAppearanceName name =3D [appearance
> bestMatchFromAppearancesWithNames:referenceNames];
> > +
> > +      if (name && ([name length] > 0)) {
>
> I do not think we need ([name length] > 0).  Yes, the receiver is a
> string, but that is an implementation detail.
>
> > +     BOOL shouldUseDarkAppearance =3D [name
> isEqualToString:NSAppearanceNameDarkAqua];
>
> We could simplify by sending isEqual here.  Yes, the receiver is a
> string, but that is an implementation detail.
>
> > +     if (shouldUseDarkAppearance !=3D self.doesUseDarkAppearance) {
> > +       self.doesUseDarkAppearance =3D shouldUseDarkAppearance;
> > +
> > +       [super observeValueForKeyPath:keyPath
> > +                            ofObject:object
> > +                              change:change
> > +                             context:context];
>
> We are quickly spiraling into a ball of mud here.  We do not know,
> should not know, and should not care, what super does.  Instead, we want
> to call super at the beginning of the method, not under any if
> statements.  Super will do its things, and then we will do ours.  That
> is how object orientation should work.  This will also remove the
> duplication of the super call within the self method.
>

I'd forgotten about the patch below which is a part of the pre-built Emacs
I use as my production Emacs.  I use many other builds I make myself that
do not include this patch so parity with it would be appreciated.  it
exposes a similar variable `ns-system-appearance` to that I request in your
patch.  It may be instructive to compare.

https://github.com/d12frosted/homebrew-emacs-plus/blob/master/patches/emacs=
-31/system-appearance.patch

--000000000000c38f170647b7eb7f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Tue, Jan 6, 2026 at 7:47=E2=80=AFAM Rudolf Adamkovi=C4=8D &lt;<a href=3D=
"mailto:rudolf@HIDDEN">rudolf@HIDDEN</a>&gt; wrote:</span></d=
iv></div><div class=3D"gmail_quote gmail_quote_container"><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex">Alexander Adolf &lt;<a href=3D"mailto:alex=
ander.adolf@HIDDEN" target=3D"_blank">alexander.adolf@conditio=
n-alpha.com</a>&gt; writes:<br>
<br>
&gt; From b984c524985d10ec4f1ee297254dbdef79c08e25 Mon Sep 17 00:00:00 2001=
<br>
&gt; From: Alexander Adolf &lt;<a href=3D"mailto:alexander.adolf@condition-=
alpha.com" target=3D"_blank">alexander.adolf@HIDDEN</a>&gt;<br=
>
&gt; Date: Sat, 13 Dec 2025 21:25:13 +0100<br>
&gt; Subject: [PATCH] Support `toolkit-theme-set-functions&#39; on macOS<br=
>
<br>
The patch is looking better and better.<br>
<br>
Way to go, Alexander!<br>
<br>
&gt; +=C2=A0 /* Ensure that a UI appearance change will be detected at star=
tup by<br>
&gt; +=C2=A0 =C2=A0 =C2=A0setting the property to the opposite of the curre=
nt UI appearance. */<br>
&gt; +=C2=A0 NSArray *referenceNames =3D @[ NSAppearanceNameAqua, NSAppeara=
nceNameDarkAqua ];<br>
&gt; +=C2=A0 NSAppearance *appearance =3D [self effectiveAppearance];<br>
&gt; +=C2=A0 NSAppearanceName name =3D [appearance bestMatchFromAppearances=
WithNames:referenceNames];<br>
&gt; +=C2=A0 if (name &amp;&amp; ([name length] &gt; 0)) {<br>
&gt; +=C2=A0 =C2=A0 self.doesUseDarkAppearance =3D ! [name isEqualToString:=
NSAppearanceNameDarkAqua];<br>
&gt; +=C2=A0 }<br>
<br>
We do not have a good reason for adding this complexity.=C2=A0 Let us step<=
br>
back to think.=C2=A0 What do we need?=C2=A0 We need 3 states: nil, YES, NO.=
=C2=A0 In<br>
other words, we need a boxed Boolean.=C2=A0 We can box a Boolean simply wit=
h<br>
NSNumber.=C2=A0 And properties are nil by default, which is handy.<br>
<br>
&gt; +=C2=A0 =C2=A0 if ((kind =3D=3D NSKeyValueChangeSetting) &amp;&amp; ( =
! isPrior)) {<br>
<br>
Nit: Strange spacing. :)<br>
<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 NSArray *referenceNames =3D @[NSAppearanceNameAq=
ua, NSAppearanceNameDarkAqua];<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 NSAppearance *appearance =3D [object effectiveAp=
pearance];<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 NSAppearanceName name =3D [appearance bestMatchF=
romAppearancesWithNames:referenceNames];<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 if (name &amp;&amp; ([name length] &gt; 0)) {<br=
>
<br>
I do not think we need ([name length] &gt; 0).=C2=A0 Yes, the receiver is a=
<br>
string, but that is an implementation detail.<br>
<br>
&gt; +=C2=A0 =C2=A0 =C2=A0BOOL shouldUseDarkAppearance =3D [name isEqualToS=
tring:NSAppearanceNameDarkAqua];<br>
<br>
We could simplify by sending isEqual here.=C2=A0 Yes, the receiver is a<br>
string, but that is an implementation detail.<br>
<br>
&gt; +=C2=A0 =C2=A0 =C2=A0if (shouldUseDarkAppearance !=3D self.doesUseDark=
Appearance) {<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0self.doesUseDarkAppearance =3D shouldUseDa=
rkAppearance;<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0[super observeValueForKeyPath:keyPath<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ofObject:object<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 change:change<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0context:context];<br>
<br>
We are quickly spiraling into a ball of mud here.=C2=A0 We do not know,<br>
should not know, and should not care, what super does.=C2=A0 Instead, we wa=
nt<br>
to call super at the beginning of the method, not under any if<br>
statements.=C2=A0 Super will do its things, and then we will do ours.=C2=A0=
 That<br>
is how object orientation should work.=C2=A0 This will also remove the<br>
duplication of the super call within the self method.<br></blockquote><div>=
<br></div><div class=3D"gmail_default" style=3D"font-family:monospace">I&#3=
9;d forgotten about the patch below which is a part of the pre-built Emacs =
I use as my production Emacs.=C2=A0 I use many other builds I make myself t=
hat do not include this patch so parity with it would be appreciated.=C2=A0=
 it exposes a similar variable `ns-system-appearance`=C2=A0to that I reques=
t in your patch.=C2=A0 It may be instructive to compare.</div><div class=3D=
"gmail_default" style=3D"font-family:monospace"><br></div><div class=3D"gma=
il_default" style=3D"font-family:monospace"><a href=3D"https://github.com/d=
12frosted/homebrew-emacs-plus/blob/master/patches/emacs-31/system-appearanc=
e.patch">https://github.com/d12frosted/homebrew-emacs-plus/blob/master/patc=
hes/emacs-31/system-appearance.patch</a></div></div></div>

--000000000000c38f170647b7eb7f--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 6 Jan 2026 12:47:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 06 07:47:38 2026
Received: from localhost ([127.0.0.1]:57383 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vd6TJ-000348-Ub
	for submit <at> debbugs.gnu.org; Tue, 06 Jan 2026 07:47:38 -0500
Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]:53109)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rudolf@HIDDEN>)
 id 1vd6TH-00033q-1E
 for 80001 <at> debbugs.gnu.org; Tue, 06 Jan 2026 07:47:36 -0500
Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45])
 by mailfout.phl.internal (Postfix) with ESMTP id 50AB2EC009E;
 Tue,  6 Jan 2026 07:47:29 -0500 (EST)
Received: from phl-frontend-03 ([10.202.2.162])
 by phl-compute-05.internal (MEProxy); Tue, 06 Jan 2026 07:47:29 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamkovic.org;
 h=cc:cc:content-transfer-encoding:content-type:content-type
 :date:date:from:from:in-reply-to:in-reply-to:message-id
 :mime-version:references:reply-to:subject:subject:to:to; s=fm3;
 t=1767703649; x=1767790049; bh=bJVz2U4spz2lnSAMB2lRuLrcdQQy1we8
 EiNPs98+fNk=; b=Y1Eeg2buU2mBkaBoo3zulTPmv3I0bUCefGlrLiIqOYRpLSHO
 Bp7huOnr5MLHpKhoIAace442Ydnx2WblX1V4b+MV6k109nmugCdXaRHev2S8bM0C
 uR+vZ3R4UtiGYITGuj9mNGlUmku/l71uePvqGn19ilnBjLA5o2mohfJ4v78g0aM3
 vcDUeE2fCV4jNWnlHPz45ucs3/d3C5KltlyBzRUsQuECn3hpbXN7PJU2zPmacpE1
 JWiWs/IjCSi7UxN2iP0rcqEZN+gah3ZxUxV20pE3zz/epgtm9LdDM7jWmD49NBMM
 rtpaWhJVeL2ismvqRxOL9EfzCqM2IPWKnWCDxg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1767703649; x=
 1767790049; bh=bJVz2U4spz2lnSAMB2lRuLrcdQQy1we8EiNPs98+fNk=; b=k
 SN8MCNPIIWUFSxlrhwalyCM3shMQkDWgFkyZguUtJGSQ0ReluppVO26Zfb+Z1z47
 K5J83NpE69OZrB7KHXLBpuJiXBuTreZTsVTPiYfokqfjNgU8KqgKyhMtq3bAy7XE
 dgVWHp9oigJnLjvUjJkdx8rOtk8MkGidLaQAdWEdI/g0WuFsNf1aj20wW/nTB1Va
 RWQQ/YoOmcYRMzPur/KF/H0U6k4+TSgxT/ntkWKthOaU46Prq3dv89+rmgorDV04
 w8MaipS4VXMXQDQMyeH+hRSmniiYon0KZrcXLcFert4sjhmJJLRFVkzf6Ts8++GW
 6lHTsed8FhFo8nxJ3eLnw==
X-ME-Sender: <xms:YQRdaZZ6qoES1Rb8zqTvgXUUqB1-fDa2dOy2sCMRLYEgLo0y_NY-HQ>
 <xme:YQRdaX3t0id6n_DPNbfdERL8EINHEg9F3kVlBVAq-b6nq1iAnySb5dpFyo_itjkOZ
 zLTJcLe69JBKgOSyEgIheCy4RIb6Opkdoslcm3AEYeA25lelSf4ZrY>
X-ME-Received: <xmr:YQRdaZV05_9jGUASCt-yuvoMozyd3jlFy-F0neXgilPD1ORBopqLnCZTtIPMFq_g43sPFEqDCi_-WkABZl8Q5QNBk5mGeF4>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddutddtvdefucetufdoteggodetrf
 dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu
 rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf
 gurhephffvvefujghffffkgggtgfesthhqredttddtjeenucfhrhhomheptfhuugholhhf
 ucetuggrmhhkohhvihgtuceorhhuugholhhfsegruggrmhhkohhvihgtrdhorhhgqeenuc
 ggtffrrghtthgvrhhnpeeiueetheffudfghfeggeevheevvddtkefflefhueeludfgtefg
 ffeltdfhudejgeenucffohhmrghinheprggurghmkhhovhhitgdrohhrghenucevlhhush
 htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehruhguohhlfhesrggu
 rghmkhhovhhitgdrohhrghdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouh
 htpdhrtghpthhtohepkedttddtudesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphht
 thhopehshhhiphhmihhnthhssehgmhgrihhlrdgtohhmpdhrtghpthhtoheprghlvgigrg
 hnuggvrhdrrgguohhlfhestghonhguihhtihhonhdqrghlphhhrgdrtghomh
X-ME-Proxy: <xmx:YQRdaRUFcYAFn7xc5JnheHoNUdDCiqcK-IGCdmrqQ4EB2tla_C2nLw>
 <xmx:YQRdaYeDbYoNBozOfPQ3z5O1V_B0c7iXTBWao_qMUhPwTm3UkCvgaQ>
 <xmx:YQRdaaXL0bFHeVY6yAbUOJ7gpTVcvcSSQssaaKFjrLu4citdOHGWUw>
 <xmx:YQRdaRf9OHMMRQSDpxz3AhsI7ibUwQ0WD_ggMEw73iXmrbVNSJRbLg>
 <xmx:YQRdabhJV4cUuDCbYUfHKMnY03PgWUShzoaFJ3n-JeLI3mE43jyXXCfF>
Feedback-ID: i88214938:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue,
 6 Jan 2026 07:47:28 -0500 (EST)
From: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>
To: Alexander Adolf <alexander.adolf@HIDDEN>, =?utf-8?Q?St?=
 =?utf-8?Q?=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
In-Reply-To: <e5bcea57a9e19146bd6e093cd24bf0b9@HIDDEN>
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
 <m2ldier8oc.fsf@HIDDEN>
 <c919fd1b350e01b1befd7202efce81ce@HIDDEN>
 <e5bcea57a9e19146bd6e093cd24bf0b9@HIDDEN>
Date: Tue, 06 Jan 2026 13:47:26 +0100
Message-ID: <m2fr8ihpr5.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Alexander Adolf <alexander.adolf@HIDDEN> writes:

> From b984c524985d10ec4f1ee297254dbdef79c08e25 Mon Sep 17 00:00:00 2001
> From: Alexander Adolf <alexander.adolf@HIDDEN>
> Date: Sat, 13 Dec 2025 21:25:13 +0100
> Subject: [PATCH] Support `toolkit-theme-set-functions' on macOS

The patch is looking better and better.

Way to go, Alexander!

> +  /* Ensure that a UI appearance change will be detected at startup by
> +     setting the property to the opposite of the current UI appearance. =
*/
> +  NSArray *referenceNames =3D @[ NSAppearanceNameAqua, NSAppearanceNameD=
arkAqua ];
> +  NSAppearance *appearance =3D [self effectiveAppearance];
> +  NSAppearanceName name =3D [appearance bestMatchFromAppearancesWithName=
s:referenceNames];
> +  if (name && ([name length] > 0)) {
> +    self.doesUseDarkAppearance =3D ! [name isEqualToString:NSAppearanceN=
ameDarkAqua];
> +  }

We do not have a good reason for adding this complexity.  Let us step
back to think.  What do we need?  We need 3 states: nil, YES, NO.  In
other words, we need a boxed Boolean.  We can box a Boolean simply with
NSNumber.  And properties are nil by default, which is handy.

> +    if ((kind =3D=3D NSKeyValueChangeSetting) && ( ! isPrior)) {

Nit: Strange spacing. :)

> +      NSArray *referenceNames =3D @[NSAppearanceNameAqua, NSAppearanceNa=
meDarkAqua];
> +      NSAppearance *appearance =3D [object effectiveAppearance];
> +      NSAppearanceName name =3D [appearance bestMatchFromAppearancesWith=
Names:referenceNames];
> +
> +      if (name && ([name length] > 0)) {

I do not think we need ([name length] > 0).  Yes, the receiver is a
string, but that is an implementation detail.

> +	BOOL shouldUseDarkAppearance =3D [name isEqualToString:NSAppearanceName=
DarkAqua];

We could simplify by sending isEqual here.  Yes, the receiver is a
string, but that is an implementation detail.

> +	if (shouldUseDarkAppearance !=3D self.doesUseDarkAppearance) {
> +	  self.doesUseDarkAppearance =3D shouldUseDarkAppearance;
> +
> +	  [super observeValueForKeyPath:keyPath
> +			       ofObject:object
> +				 change:change
> +				context:context];

We are quickly spiraling into a ball of mud here.  We do not know,
should not know, and should not care, what super does.  Instead, we want
to call super at the beginning of the method, not under any if
statements.  Super will do its things, and then we will do ours.  That
is how object orientation should work.  This will also remove the
duplication of the super call within the self method.

Rudy
--=20
"An intelligent hell would be better than a stupid paradise."

--- Victor Hugo, Ninety-Three (1874)

Rudolf Adamkovi=C4=8D <rudolf@HIDDEN> [he/him]
http://adamkovic.org




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 5 Jan 2026 21:27:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 05 16:27:01 2026
Received: from localhost ([127.0.0.1]:54507 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vcs6P-0005jP-9s
	for submit <at> debbugs.gnu.org; Mon, 05 Jan 2026 16:27:01 -0500
Received: from mail-ua1-x930.google.com ([2607:f8b0:4864:20::930]:54608)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vcs6L-0005jD-R1
 for 80001 <at> debbugs.gnu.org; Mon, 05 Jan 2026 16:26:59 -0500
Received: by mail-ua1-x930.google.com with SMTP id
 a1e0cc1a2514c-93f64ae67dbso126016241.1
 for <80001 <at> debbugs.gnu.org>; Mon, 05 Jan 2026 13:26:57 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1767648417; x=1768253217; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=ptoF4MNWzgmkge6dcjKcP4aHFDIMoWMUVmKgFzRNrEY=;
 b=H91tDJ7BwBKLN/T/aGGdNIsvam92y+FtPu1BnhYg/gLvUPMNxXBSLalwBKlKlpXy98
 j0L77VAKcV8R6W6jcNY7h/8V9uxrkEP7z+w0wGoYcLWzk1ngR+5TaJ+J8ZPEQHY9Pps4
 uifkTTtSbQNuwd6odaPqAw0CaRzT4aUc9IDnwvs4qMEDy+E0tJMalkz74tu4sqdk8oe1
 DUwInw+99/oMftoY7ky146Nbyp9yAc0MAC/B34gJxABqQz1IspJdgmez+NqrzCIkAjON
 2IULipVMeqOQo4nFIxItTq9Tw7YKsP163gW32z0UcyOH/f9t5DRKmCLew+yGlxOIiTEK
 J4cw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1767648417; x=1768253217;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=ptoF4MNWzgmkge6dcjKcP4aHFDIMoWMUVmKgFzRNrEY=;
 b=RK5C9fdpiRVK1gJCYqKOhadtud9ZjlN5wZuGE40EwWXaxhwosmm7NGI8sNb9gx9ZCI
 IpNPzlqNMzZYsJa9NlDYAYOf2nRiMHkmpOMBLnuSXNUZQYzvaazOUuxnsUaosGvyVUIn
 lARDLBLF/Lx7F+Ph5NDyo5KiahbhchGAlb+rTIh/PC9Z7yvA/H+4soOHQppPhqnlaw0j
 WhmlT0+vFbhiuFdQPpaB4/CLp3If1ScGYodLo3JvBC+4FYn/RtoVXNUfpw4IcNPCGRb7
 +etLoSVwkM93bprVZqIWciPlnOMBdImgQo3bBYY0YRGF3Q0lHB9pNcfxCAk/xp3Os6fA
 VfAg==
X-Forwarded-Encrypted: i=1;
 AJvYcCVI3E7hc5aWbCrB/LKKvreiPXCTZ7+Lip/U8lwpElfKPB3j69j/1PP2tHHWwLHhxpdYblfIug==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxTPW+zbwafFyoJ1UU6eE0XB1Oe5tu2OgCsNq2SRGNoGDpbk6ze
 364F0qbGS/zIwAQG0BpYKRKKc3rwJGHVch/cIy+YzOnuzBNEpV2Os+w7FmdQrq8hbI8eRU8w7o7
 3MwWjX7ApcIcSx5FSQ2jqw+TcDoReuCBUMg==
X-Gm-Gg: AY/fxX57r7VFzl3XgUAJpi3Y+menM2gjiFzQEoKasGN2E9+Ca5TEOlNzmXYg1tSqzZ9
 Y01O27FBZulmMCMYUjLhnEn69ZCDlyS78c5z/s43m0MTAey7scsG6hm+L25zp5OQQ5tQ+7fqBYe
 WgkAa8jEDonJyddPe0x5jyTCijZvhJ7krXanywkjfwXwTqEa51CdFqJCawgcoOIV0566hQf7UWy
 hiaPUskk19MuihGYXNQw+7ycZnypQrhGTvKe1W8LTNhVpHjMsChvaf/JNyWRxgiaTtG/mk=
X-Google-Smtp-Source: AGHT+IGjT9mhBgKMdCOKfelfui3eGaas6J9cm3B0hElNZ0VGrVLqgZOiNEQaWLeOnBg3cBNGOoqHjAiU2tlOvLfK3eA=
X-Received: by 2002:a05:6102:3fa0:b0:5db:f031:84d6 with SMTP id
 ada2fe7eead31-5ec744576f7mr331703137.28.1767648416982; Mon, 05 Jan 2026
 13:26:56 -0800 (PST)
MIME-Version: 1.0
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
 <391b0625a5d2375de9f50d83f5cd3af3@HIDDEN>
 <CAN+1HbqytwLZv8uJW=rE619-PgfJRKMqoyi+6m+6MGqGE2TQTQ@HIDDEN>
 <ecfe75a42854ca22344b33f0b6a8349e@HIDDEN>
 <CAN+1Hbqx3W7yN8CuLTKYXxv77audssGhq3qdWm8MUNjeCbTRjQ@HIDDEN>
 <c82acba043ad08597e56e78414912d41@HIDDEN>
In-Reply-To: <c82acba043ad08597e56e78414912d41@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Mon, 5 Jan 2026 16:26:44 -0500
X-Gm-Features: AQt7F2qSb98n4xBl2NXAXML9zwZskYBUKuwMkF-SwMyFW3mLpNbyHsG49ZU-WL8
Message-ID: <CAN+1HbofX-MckzJ0qe86as+EHq86riB+A=TG96VO=T6EWYvsvw@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
To: Alexander Adolf <alexander.adolf@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000fb6b880647aab729"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: =?UTF-8?Q?Rudolf_Adamkovi=C4=8D?= <rudolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000fb6b880647aab729
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, Jan 5, 2026 at 3:48=E2=80=AFPM Alexander Adolf <
alexander.adolf@HIDDEN> wrote:

> St=C3=A9phane Marks <shipmints@HIDDEN> writes:
>
> > [...]
> > I can't speak to the other platforms, but I want a way to query in ELis=
p
> > what the system claims the system theme is.
>
> The punchline (and my intent) for the present bug#800001 ("Support
> `toolkit-theme-set-functions' on macOS") doesn't quite seem to cover
> that.
>
> Perhaps it would be best for you to open a new bug covering the new
> functionality you are looking for?
>

If you're adding real-time notifications, just save the state in a variable
exposed to ELisp and for the sake of completeness for people who want to
query the state your new code is in charge of maintaining. I don't see why
another bug is needed.

--000000000000fb6b880647aab729
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Mon, Jan 5, 2026 at 3:48=E2=80=AFPM Alexander Adolf &lt;<a href=3D"mailt=
o:alexander.adolf@HIDDEN">alexander.adolf@HIDDEN<=
/a>&gt; wrote:</span></div></div><div class=3D"gmail_quote gmail_quote_cont=
ainer"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;=
border-left:1px solid rgb(204,204,204);padding-left:1ex">St=C3=A9phane Mark=
s &lt;<a href=3D"mailto:shipmints@HIDDEN" target=3D"_blank">shipmints@gm=
ail.com</a>&gt; writes:<br>
<br>
&gt; [...]<br>
&gt; I can&#39;t speak to the other platforms, but I want a way to query in=
 ELisp<br>
&gt; what the system claims the system theme is.<br>
<br>
The punchline (and my intent) for the present bug#800001 (&quot;Support<br>
`toolkit-theme-set-functions&#39; on macOS&quot;) doesn&#39;t quite seem to=
 cover<br>
that.<br>
<br>
Perhaps it would be best for you to open a new bug covering the new<br>
functionality you are looking for?<br></blockquote><div><br></div><div clas=
s=3D"gmail_default" style=3D"font-family:monospace">If you&#39;re adding re=
al-time notifications, just save the state in a variable exposed to ELisp a=
nd for the sake=C2=A0of completeness for people who want to query the state=
 your=C2=A0new code is in charge of maintaining. I don&#39;t see why anothe=
r bug is needed.=C2=A0</div></div></div>

--000000000000fb6b880647aab729--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 5 Jan 2026 20:48:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 05 15:48:21 2026
Received: from localhost ([127.0.0.1]:54448 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vcrUy-0003vR-Mr
	for submit <at> debbugs.gnu.org; Mon, 05 Jan 2026 15:48:21 -0500
Received: from www191.your-server.de ([188.40.2.11]:40268)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vcrUw-0003vB-Ii
 for 80001 <at> debbugs.gnu.org; Mon, 05 Jan 2026 15:48:19 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=condition-alpha.com; s=default2503; h=Content-Transfer-Encoding:
 Content-Type:MIME-Version:Date:In-reply-to:References:Subject:Cc:To:From:
 Message-Id:Sender:Reply-To:Content-ID:Content-Description:Resent-Date:
 Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
 bh=DXPg+8tieYCJmRUrLhcgYHHR2lOJliGvsdNkTCtc7Cs=; b=TWWbl3iroHEGoQR8ct3ddnbOwm
 tWfElzJK1JFMWNmJjsKjclplYDXHUPRjfbn8m48/5DjOOxkusLUYLHe0y2d8kJOVdYgJFuam1wRum
 TJ4lS9Is2DmB4L7jq6YXDySgPj+r6Qt0fLTeWZOxmdhkOBhpx3t5TPf9jQeJ2upHCRO35A1oV/9dA
 tqOXVA4bxuCEK1qlkryywFrLDZZnU8U7PQVXzSglLwYx31DwQc1TzvIhhM/Snzx3YLzXxErNs1a1I
 l25q034hskyW9dAPg6VLveOWanQxb5xatOsbKnw9AtYkGzmsrw3XU4EGPCjsFYjm5Kih9TXrT0Vrn
 avPiMVJQ==;
Received: from sslproxy02.your-server.de ([78.47.166.47])
 by www191.your-server.de with esmtpsa  (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96.2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vcrUp-00018C-2w; Mon, 05 Jan 2026 21:48:11 +0100
Received: from localhost ([127.0.0.1])
 by sslproxy02.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vcrUp-0009wO-0L; Mon, 05 Jan 2026 21:48:11 +0100
Message-Id: <c82acba043ad08597e56e78414912d41@HIDDEN>
From: Alexander Adolf <alexander.adolf@HIDDEN>
To: =?utf-8?Q?St=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
 <391b0625a5d2375de9f50d83f5cd3af3@HIDDEN>
 <CAN+1HbqytwLZv8uJW=rE619-PgfJRKMqoyi+6m+6MGqGE2TQTQ@HIDDEN>
 <ecfe75a42854ca22344b33f0b6a8349e@HIDDEN>
 <CAN+1Hbqx3W7yN8CuLTKYXxv77audssGhq3qdWm8MUNjeCbTRjQ@HIDDEN>
In-reply-to: <CAN+1Hbqx3W7yN8CuLTKYXxv77audssGhq3qdWm8MUNjeCbTRjQ@HIDDEN>
Date: Mon, 05 Jan 2026 21:48:10 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: Clear (ClamAV 1.0.9/27871/Mon Jan  5 08:25:47 2026)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

St=C3=A9phane Marks <shipmints@HIDDEN> writes:

> [...]
> I can't speak to the other platforms, but I want a way to query in ELisp
> what the system claims the system theme is.

The punchline (and my intent) for the present bug#800001 ("Support
`toolkit-theme-set-functions' on macOS") doesn't quite seem to cover
that.

Perhaps it would be best for you to open a new bug covering the new
functionality you are looking for?


Many thanks and cheers,

  --alexander




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 5 Jan 2026 16:09:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 05 11:09:35 2026
Received: from localhost ([127.0.0.1]:52845 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vcn9C-00035x-MK
	for submit <at> debbugs.gnu.org; Mon, 05 Jan 2026 11:09:35 -0500
Received: from mail-vs1-xe32.google.com ([2607:f8b0:4864:20::e32]:50434)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vcn99-00035o-Ru
 for 80001 <at> debbugs.gnu.org; Mon, 05 Jan 2026 11:09:33 -0500
Received: by mail-vs1-xe32.google.com with SMTP id
 ada2fe7eead31-5dfa9bfa9c7so24799137.1
 for <80001 <at> debbugs.gnu.org>; Mon, 05 Jan 2026 08:09:31 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1767629371; x=1768234171; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=Lmet3utE6z43rFeYVzkpv7gzqRQBUnalLZMJXxo32s4=;
 b=njsbkRIZuVANHt1+Rz7OYfzpYRWVnSxzhsHfS3NfUaIZ6HjlCTlzsBMgyUnV2nKGHL
 E6KgHANu6pqNEt4nUVGPKLCIiZE4JUx2E2AKNcBjpQL25X/DzMI2/RZUcrs/BrkAbEMv
 7IBeIWbwtKx98CeXemGqAegzVLH1e83vyR2smBILZ+s0nLciu3cd67A80IG+UkxeXsD/
 qVDI2nyCnkMRPAJNzWZD9oLQzkv8MzJLnJa7LyYXHOb05oUJWAoGtFTMWsLQ2Xh6Bcky
 wQi5ux22EK6yqI8w4DPb7COas5I7O/6jn1x/AaX2i3Fdlc0Bs2cAmh6SiPnIF5F9587H
 hJZw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1767629371; x=1768234171;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Lmet3utE6z43rFeYVzkpv7gzqRQBUnalLZMJXxo32s4=;
 b=GOFQL5hHM6+ddN8FI1/tfSZdDIGNrw4GkOtHevvAeYF9jHtatKzuYYZRgDS4lu3K6S
 Pehk/KbJU5zF5LA/NKstzcXlYOJO/Uy1DHaOYVQbBARZOtpBBYQHwZjhlTgydPBdWdbl
 LhRDI1yXVA+AHT7qDQXm3DtW3acL3BO0ls7Xclu8mlh8zrj1oHEdNetDgKGl0UYDpptH
 RMQU3MDwjiJK1q/NlfzKhVkMvi09o3mKFuwoStabocAIsksRKLdJAGARFGQrOsxHOWkT
 V3RKTZJjFwMCdycjCJW4xYXvvzAPJ13jEqRlBnN0F8rjE82HT7Ey1Mt4hp1DlfyzbqdW
 nRaA==
X-Forwarded-Encrypted: i=1;
 AJvYcCWoFxERAAYIs3Un09qBxTafFbxAk0NPsWyvlXBMx6RyzeoDUz3tT6Kwo59plHXt4/nwri9gQQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwwV8Yg1CjIdHyC4BSikV7SWMYjIBBnh5f1AvhnmAeXBcxiLdXm
 Ik3uCblyfJngPIYuc+0KAH+UpUBpWa07300n/xd/ShiPmYT9uNE8w2/EPjvuVPCsRZ57Xv/HW+4
 cc//dbgaULBfc/0V1drtIvlE+7AWnwF/xhg==
X-Gm-Gg: AY/fxX5Uu9+9ZbdYV6Pa1Y2NoEKArHCTEXAQa3mC3kyL2YA7c5ay85TM9r2POUiKeZn
 ouQhVO7uWLRUDua0/LM96Wus6ZRiVvvLZn4qLnxlam13JT7iU5mNaG3GqRrfVDE7LtaAShwPw8M
 4ew8x5ViFvFxp/O4UmCA8wazeT+aQ/oI1l3trpq3G8H5ggkaHSIfF3KJ4VvafjQAkdIlncoqIFd
 aLmV63KYkc6qG2xQH2TvWPg0Aa/zOQGja23KoLMViTqjO8OnU23c8ACioeVqhc4je8eJ4tyOByU
 K1qm3g==
X-Google-Smtp-Source: AGHT+IErBKSQ7t3R8XRwOx80gh7+KcYFtVig6Ip7sTdEhZSUYruK2+oPkGFO3fGqpUSOxfqPRD/Q6sNPxoalKPsZM1M=
X-Received: by 2002:a05:6102:2c81:b0:5db:deb6:b261 with SMTP id
 ada2fe7eead31-5eb1a687a81mr16755105137.13.1767629369589; Mon, 05 Jan 2026
 08:09:29 -0800 (PST)
MIME-Version: 1.0
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
 <391b0625a5d2375de9f50d83f5cd3af3@HIDDEN>
 <CAN+1HbqytwLZv8uJW=rE619-PgfJRKMqoyi+6m+6MGqGE2TQTQ@HIDDEN>
 <ecfe75a42854ca22344b33f0b6a8349e@HIDDEN>
In-Reply-To: <ecfe75a42854ca22344b33f0b6a8349e@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Mon, 5 Jan 2026 11:09:16 -0500
X-Gm-Features: AQt7F2p-mE0ehHH8QlYJrRZSLw7vzoHoE1uz4CfFbCTPK6gmFvP8V377OLLqyMM
Message-ID: <CAN+1Hbqx3W7yN8CuLTKYXxv77audssGhq3qdWm8MUNjeCbTRjQ@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
To: Alexander Adolf <alexander.adolf@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000ab44e10647a64897"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: =?UTF-8?Q?Rudolf_Adamkovi=C4=8D?= <rudolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000ab44e10647a64897
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, Jan 5, 2026 at 11:02=E2=80=AFAM Alexander Adolf <
alexander.adolf@HIDDEN> wrote:

> St=C3=A9phane Marks <shipmints@HIDDEN> writes:
>
> >> > [...]
> >> > Is there a function ELisp can call that says what the NS theme is?
> >> > Something like ns-effective-appearance?
> >>
> >> No, there isn't.
> >
> > Would you be willing to add one as part of this work?
> > [...]
>
> Such a function would not seem needed from my point if view, since the
> key/value observer method will be called at the end of app
> initialisation, causing Elisp functions on `toolkit-theme-set-functions`
> to be called with the current system appearance (light or dark) as a
> parameter.
>
> I would presume that similar behaviour occurs on the other platforms
> which support `toolkit-theme-set-functions` (PGTK, MSWindows32,
> Android)?
>

I can't speak to the other platforms, but I want a way to query in ELisp
what the system claims the system theme is.

--000000000000ab44e10647a64897
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Mon, Jan 5, 2026 at 11:02=E2=80=AFAM Alexander Adolf &lt;<a href=3D"mail=
to:alexander.adolf@HIDDEN">alexander.adolf@HIDDEN=
</a>&gt; wrote:</span></div></div><div class=3D"gmail_quote gmail_quote_con=
tainer"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex=
;border-left:1px solid rgb(204,204,204);padding-left:1ex">St=C3=A9phane Mar=
ks &lt;<a href=3D"mailto:shipmints@HIDDEN" target=3D"_blank">shipmints@g=
mail.com</a>&gt; writes:<br>
<br>
&gt;&gt; &gt; [...]<br>
&gt;&gt; &gt; Is there a function ELisp can call that says what the NS them=
e is?<br>
&gt;&gt; &gt; Something like ns-effective-appearance?<br>
&gt;&gt;<br>
&gt;&gt; No, there isn&#39;t.<br>
&gt;<br>
&gt; Would you be willing to add one as part of this work?<br>
&gt; [...]<br>
<br>
Such a function would not seem needed from my point if view, since the<br>
key/value observer method will be called at the end of app<br>
initialisation, causing Elisp functions on `toolkit-theme-set-functions`<br=
>
to be called with the current system appearance (light or dark) as a<br>
parameter.<br>
<br>
I would presume that similar behaviour occurs on the other platforms<br>
which support `toolkit-theme-set-functions` (PGTK, MSWindows32,<br>
Android)?<br></blockquote><div><br></div><div class=3D"gmail_default" style=
=3D"font-family:monospace">I can&#39;t speak to the other platforms, but I =
want a way to query in ELisp what the system claims the system theme is.</d=
iv></div></div>

--000000000000ab44e10647a64897--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 5 Jan 2026 16:03:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 05 11:03:05 2026
Received: from localhost ([127.0.0.1]:52830 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vcn2v-0002kb-B3
	for submit <at> debbugs.gnu.org; Mon, 05 Jan 2026 11:03:05 -0500
Received: from www191.your-server.de ([188.40.2.11]:45698)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vcn2r-0002jq-GP
 for 80001 <at> debbugs.gnu.org; Mon, 05 Jan 2026 11:03:03 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=condition-alpha.com; s=default2503; h=Content-Transfer-Encoding:
 Content-Type:MIME-Version:Date:In-reply-to:References:Subject:Cc:To:From:
 Message-Id:Sender:Reply-To:Content-ID:Content-Description:Resent-Date:
 Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
 bh=vNBgOIujj5G7DxpBjSv4WgYQOAePV6F1nzlSUWakE9Q=; b=MPGwFqJ8ETnYn61JhvADlFAXom
 qL47mhWd4Q2IigPuem2uu+kUbKSzMfzEW+1gHg4fKvD0eJyVhbNDIBUdso5HjxNufSBxLIkBKNBcN
 vJsGnmBAxgWwOshVy1ozSgxKLEFYRTryhGGACJ62WMKj1OO44H8fqfV/gfWqRHZdZlQyUkblcMJeQ
 DA4rfvPSgc+gf7Dv4GOe4skvYsFOtDtOtGBlsj/n1DIpSJFiaTRzvAaJPvFKrT1I78A2DA3u2fDM8
 sFdfzljtwfDZMWbceEhswCX+j8vaz88oPfVLC8g/Y1jjX7UFWHH5iaAcb6g/tCYcjrIevD+UUQ4Nz
 GlGpwyCg==;
Received: from sslproxy06.your-server.de ([78.46.172.3])
 by www191.your-server.de with esmtpsa  (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96.2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vcn2k-00063Z-2d; Mon, 05 Jan 2026 17:02:54 +0100
Received: from localhost ([127.0.0.1])
 by sslproxy06.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vcn2k-000O0x-28; Mon, 05 Jan 2026 17:02:54 +0100
Message-Id: <ecfe75a42854ca22344b33f0b6a8349e@HIDDEN>
From: Alexander Adolf <alexander.adolf@HIDDEN>
To: =?utf-8?Q?St=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
 <391b0625a5d2375de9f50d83f5cd3af3@HIDDEN>
 <CAN+1HbqytwLZv8uJW=rE619-PgfJRKMqoyi+6m+6MGqGE2TQTQ@HIDDEN>
In-reply-to: <CAN+1HbqytwLZv8uJW=rE619-PgfJRKMqoyi+6m+6MGqGE2TQTQ@HIDDEN>
Date: Mon, 05 Jan 2026 17:02:53 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: Clear (ClamAV 1.0.9/27871/Mon Jan  5 08:25:47 2026)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

St=C3=A9phane Marks <shipmints@HIDDEN> writes:

>> > [...]
>> > Is there a function ELisp can call that says what the NS theme is?
>> > Something like ns-effective-appearance?
>>
>> No, there isn't.
>
> Would you be willing to add one as part of this work?
> [...]

Such a function would not seem needed from my point if view, since the
key/value observer method will be called at the end of app
initialisation, causing Elisp functions on `toolkit-theme-set-functions`
to be called with the current system appearance (light or dark) as a
parameter.

I would presume that similar behaviour occurs on the other platforms
which support `toolkit-theme-set-functions` (PGTK, MSWindows32,
Android)?


Cheers,

  --alexander




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 4 Jan 2026 22:46:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 04 17:46:45 2026
Received: from localhost ([127.0.0.1]:47683 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vcWrz-00034y-NY
	for submit <at> debbugs.gnu.org; Sun, 04 Jan 2026 17:46:44 -0500
Received: from www191.your-server.de ([188.40.2.11]:55882)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vcWrw-00034B-6M
 for 80001 <at> debbugs.gnu.org; Sun, 04 Jan 2026 17:46:41 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=condition-alpha.com; s=default2503; h=Content-Type:MIME-Version:Date:
 In-reply-to:References:Subject:Cc:To:From:Message-Id:Sender:Reply-To:
 Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:
 Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
 bh=gxGm63duJkYqve5MfqvbxyvXZ2kcxZffVicRTPBE7lo=; b=F9sMrx+ERU1HzN/suKH/ysa+mE
 VywaqSAYzUATUi0vuRpYAxdDEo/miNjEZQrYBeghgBPBrymYaA1mjj7PZZXZCylF7dsXTHWBkcrRz
 KFsi0g956C4CcN9CzAhFMWv/S4eLCNCLJ20dHaOwPUlbreyeajEm7YSuvu86C8g+XpeJGxpJoubx6
 cmgDjiR+NRDnqEw5W0cA0BA86GkF3wVWYXNYbU+Ij6Eg1VPTDBVzCJjQUULZsr03TyNiuQqZJei8T
 hHQ4KqKZSG/wT5/G3ZrJXhKn2wucTo1kwGUdK7KRH94FjqfpFp6Iw2bXNUNKLYPLXyHyHePLmTsUs
 F0Bbf2Jw==;
Received: from sslproxy03.your-server.de ([88.198.220.132])
 by www191.your-server.de with esmtpsa  (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96.2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vcWrp-000O5M-0C; Sun, 04 Jan 2026 23:46:33 +0100
Received: from localhost ([127.0.0.1])
 by sslproxy03.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vcWro-000HV4-0w; Sun, 04 Jan 2026 23:46:32 +0100
Message-Id: <e5bcea57a9e19146bd6e093cd24bf0b9@HIDDEN>
From: Alexander Adolf <alexander.adolf@HIDDEN>
To: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>, =?utf-8?Q?St?=
 =?utf-8?Q?=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
 <m2ldier8oc.fsf@HIDDEN>
 <c919fd1b350e01b1befd7202efce81ce@HIDDEN>
In-reply-to: <c919fd1b350e01b1befd7202efce81ce@HIDDEN>
Date: Sun, 04 Jan 2026 23:46:32 +0100
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Virus-Scanned: Clear (ClamAV 1.0.9/27870/Sun Jan  4 08:26:26 2026)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

Alexander Adolf <alexander.adolf@HIDDEN> writes:

> [...]
> One more thing, though... ;-))
>
> I noticed that Emacs's title bars and toolbars don't change their colour
> when the system appearance changes.
>
> It would seem something else will need to be done in addition to change
> these as well?
> [...]

Ok, I figured it. I need to call

	  [super observeValueForKeyPath:keyPath
			       ofObject:object
				 change:change
				context:context];

from the KVO observer method for effectiveAppearance.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
 filename="master-b984c52-Support `toolkit-theme-set-functions' on macOS.patch"

From b984c524985d10ec4f1ee297254dbdef79c08e25 Mon Sep 17 00:00:00 2001
From: Alexander Adolf <alexander.adolf@HIDDEN>
Date: Sat, 13 Dec 2025 21:25:13 +0100
Subject: [PATCH] Support `toolkit-theme-set-functions' on macOS

* src/nsterm.m ([EmacsApp applicationDidFinishLaunching:]): Add
a key/value observer for the effectiveApperance property to
detect light/dark system UI theme changes.
([EmacsApp observeValueForKeyPath:ofObject:change:context:]): New
method implementation to trigger a TOOLKIT_THEME_CHANGED_EVENT
on light/dark system UI theme changes.
* lisp/frame.el (toolkit-theme): Update the docstring to include macOS
10.14+.
* etc/NEWS (toolkit-theme-set-functions): Add macOS 10.14+ to the list
of supported systems, and try to improve the wording of the entry.
---
 etc/NEWS     | 10 ++++----
 src/frame.c  |  3 ++-
 src/nsterm.h |  3 +++
 src/nsterm.m | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 76 insertions(+), 6 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index a3ca45e3dcf..70ff9b9486c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3850,10 +3850,12 @@ automatically toggling between them.
 
 ---
 *** 'toolkit-theme-set-functions' called when the toolkit theme is set for Emacs.
-When the theme is set on PGTK, Android, or MS-Windows systems,
-'toolkit-theme-set-functions' is called.  The result is stored in the
-variable 'toolkit-theme' as either symbol 'dark' or 'light', but may be
-extended to encompass other toolkit-specific symbols in the future.
+When the theme is set on PGTK, Android, MS-Windows, or macOS 10.14+
+systems, functions on 'toolkit-theme-set-functions' will be called with
+the new theme.  The toolkit theme is also stored in the variable
+'toolkit-theme'.  Currently the toolkit theme is conveyed as either
+symbol 'dark' or 'light', but may be extended to encompass other
+toolkit-specific symbols in the future.
 
 +++
 *** New function 'theme-choose-variant-for-background' for adding to 'toolkit-theme-set-functions'
diff --git a/src/frame.c b/src/frame.c
index ec227ce276d..20f1a248136 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -7703,7 +7703,8 @@ focus (where a frame immediately loses focus when it's left by the mouse
 current theme preference.  This variable is updated automatically when
 the system theme changes.
 
-This variable is only set on PGTK, Android, and MS-Windows builds.  */);
+This variable is only set on PGTK, Android, MS-Windows, and macOS 10.14+
+builds.  */);
   Vtoolkit_theme = Qnil;
   DEFSYM (Qlight, "light");
   DEFSYM (Qdark, "dark");
diff --git a/src/nsterm.h b/src/nsterm.h
index e03add9c3f8..12d65008c0b 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -387,6 +387,9 @@ #define NSTRACE_UNSILENCE()
 @public
   int nextappdefined;
 }
+#if (defined NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101400)
+@property (nonatomic) BOOL doesUseDarkAppearance;
+#endif
 - (void)logNotification: (NSNotification *)notification;
 - (void)antialiasThresholdDidChange:(NSNotification *)notification;
 - (void)sendEvent: (NSEvent *)theEvent;
diff --git a/src/nsterm.m b/src/nsterm.m
index fe5bc35086d..752dae5fa63 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6404,11 +6404,75 @@ - (void)applicationDidFinishLaunching: (NSNotification *)notification
 	       allocInitFromFile:
 		 build_string("icons/hicolor/128x128/apps/emacs.png")]];
   }
-#endif
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+  /* Ensure that a UI appearance change will be detected at startup by
+     setting the property to the opposite of the current UI appearance. */
+  NSArray *referenceNames = @[ NSAppearanceNameAqua, NSAppearanceNameDarkAqua ];
+  NSAppearance *appearance = [self effectiveAppearance];
+  NSAppearanceName name = [appearance bestMatchFromAppearancesWithNames:referenceNames];
+  if (name && ([name length] > 0)) {
+    self.doesUseDarkAppearance = ! [name isEqualToString:NSAppearanceNameDarkAqua];
+  }
+
+  /* Have EmacsApp observe its own effectiveApperance property to
+     detect when the UI appearance changes between light and dark. */
+  [self addObserver:self
+	 forKeyPath:@"effectiveAppearance"
+	    options:(NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew)
+	    context:nil];
+#endif /* MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 */
+#endif /* NS_IMPL_COCOA */
 
   ns_send_appdefined (-2);
 }
 
+#if (defined NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101400)
+- (void) observeValueForKeyPath:(NSString *) keyPath
+		       ofObject:(id) object
+			 change:(NSDictionary<NSString *,id> *) change
+			context:(void *) context
+{
+  /* Check for key paths we are interested in and which we are handling */
+  if ([keyPath isEqualToString:@"effectiveAppearance"]) {
+    NSUInteger kind = [[change valueForKey:NSKeyValueChangeKindKey] unsignedIntegerValue];
+    BOOL isPrior = [[change valueForKey:NSKeyValueChangeNotificationIsPriorKey] boolValue];
+
+    if ((kind == NSKeyValueChangeSetting) && ( ! isPrior)) {
+      NSArray *referenceNames = @[NSAppearanceNameAqua, NSAppearanceNameDarkAqua];
+      NSAppearance *appearance = [object effectiveAppearance];
+      NSAppearanceName name = [appearance bestMatchFromAppearancesWithNames:referenceNames];
+
+      if (name && ([name length] > 0)) {
+	BOOL shouldUseDarkAppearance = [name isEqualToString:NSAppearanceNameDarkAqua];
+
+	if (shouldUseDarkAppearance != self.doesUseDarkAppearance) {
+	  self.doesUseDarkAppearance = shouldUseDarkAppearance;
+
+	  [super observeValueForKeyPath:keyPath
+			       ofObject:object
+				 change:change
+				context:context];
+
+	  struct input_event inev;
+	  EVENT_INIT (inev);
+	  inev.kind = TOOLKIT_THEME_CHANGED_EVENT;
+	  inev.arg = shouldUseDarkAppearance ? Qdark : Qlight;
+	  kbd_buffer_store_event (&inev);
+	  ns_send_appdefined (-1);
+	}
+      }
+    }
+  }
+  /* Any unrecognised key path must belong to super */
+  else {
+    [super observeValueForKeyPath:keyPath
+			 ofObject:object
+			   change:change
+			  context:context];
+  }
+}
+#endif /* (defined NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) */
+
 - (void)antialiasThresholdDidChange:(NSNotification *)notification
 {
 #ifdef NS_IMPL_COCOA
-- 
2.50.1


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 4 Jan 2026 18:05:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 04 13:05:46 2026
Received: from localhost ([127.0.0.1]:45208 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vcSU4-0000ow-Tw
	for submit <at> debbugs.gnu.org; Sun, 04 Jan 2026 13:05:46 -0500
Received: from mail-vs1-xe32.google.com ([2607:f8b0:4864:20::e32]:44143)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vcSU1-0000oB-J3
 for 80001 <at> debbugs.gnu.org; Sun, 04 Jan 2026 13:05:43 -0500
Received: by mail-vs1-xe32.google.com with SMTP id
 ada2fe7eead31-5dfc6be7df3so4918291137.0
 for <80001 <at> debbugs.gnu.org>; Sun, 04 Jan 2026 10:05:41 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1767549941; x=1768154741; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=6R6sysdXlJpLHMJXeUPEd0XJzwpSwAomnBgA0KyITKk=;
 b=VfPku8Y1El7mkxFW/GIDSBF4oSJRYQFGzHRAmXrKce/hv+QpDoHIoNpiE8AMrywDdx
 QXV5gmlmxMAkWvYVp01PNaut/NWgwKdWCcaJGOLZPhAOU/kCPqofRXtxi30upf8cmMOL
 Nz21iqtlMFqS7GF9M+L0xB9Svrqt14W86h0FjmB1Z0bjp+IVi0WrrHUceaMBnFyaPHNk
 oo+MQ0bi9IRTxujWXx0cZyZp4L56+Uga5vhcd+IlwKzB5/SpEzhzh0ReQ/eYZla9lcuP
 c8nltlu9vasnqvSFCqVXhBDh261Qr+2+wAmyeKwpNHK6fuBIjwm777OFJsxnFrB8PJuF
 TZcA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1767549941; x=1768154741;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=6R6sysdXlJpLHMJXeUPEd0XJzwpSwAomnBgA0KyITKk=;
 b=AM0HNLvYSnvSgND8igFNr5EYQcsASUeu2DFdIktxdi8vrT1b9obPFzsYQ8zO4I3h9v
 BVOaeC2GYXy3zZFfjN8xe5v7xD7jIRG8SwBFDWC99XyJhtd9nO3WsKDUd+Au/wOA6HRL
 BjCtAb97bQo/LChLemwRSiODmAJkNPRE7jjM4icf4asgl1HMoFL/7DrDK76dr5NR/mIs
 glDZmIslINWPxVfnUMa0UIme4Y1sEYbbdWRGt5KbOqRThxoYokj7yWT/eK4kAkpVHF1W
 4M7FtxKrDJzX55TiwSpBTx99j1ibaM68RzvosnP0NRmVHlt2qeVgoc89GNpkFDGg0qQ4
 V8Zg==
X-Forwarded-Encrypted: i=1;
 AJvYcCWVZo58kTeYeeCkqGJ2sHJEWtBaqD1vfYWu+1d3jn1yMR0CJyhRWs7RTk6uFHG87lK9ib+N+Q==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YySM0eeyr6iybT8tJZVKrgCS9SL2GX9IIvkFhalLufP0uIi2DVj
 4CPAsFkdFTLyl/hglNlthryB/H9JLXDd7qOWh9YN0hf1paPb3ieucrY1sktALjwygXmV19RTzt6
 taU7/p3gGaKqR8SgypRxoIYf0vwASCSY=
X-Gm-Gg: AY/fxX5FbIoG8UCgkhFGpzZc8BL+GRQUn9iqqsg+bGTRmyHsfYrG6w76YW96/CYO+zS
 gRWPGYnMrVQ3uAarcwgfGhw6+RgqaaMIGG58LXHX2B4scuvYX1mt2fWoFZ7RsU9TUXNIQHu+jAE
 X6KaOlLUZtLoS5q4+awzjmzoKE64Kk75LzETHFFYGDclXLeFdrShfJvcjL91QHeuGV7VLmaUr2g
 dHc9i+juLibm+TOVWFxbQ7ZA9ikSAShcya6njSbmNiv98tJ/PSuGpZDBu5vDkXwIEUYdQk=
X-Google-Smtp-Source: AGHT+IGINt9kvquUKnGom+4GcFBe4wMx7IsMrdcbImcm25gubHxoACcIgNv9qnOaEfdyJL36N4zR+PgDdfuJJ3Lm/cY=
X-Received: by 2002:a05:6102:e14:b0:5df:99d3:d9a5 with SMTP id
 ada2fe7eead31-5eb1a6171edmr12674720137.4.1767549940763; Sun, 04 Jan 2026
 10:05:40 -0800 (PST)
MIME-Version: 1.0
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
 <m2ldier8oc.fsf@HIDDEN>
 <c919fd1b350e01b1befd7202efce81ce@HIDDEN>
In-Reply-To: <c919fd1b350e01b1befd7202efce81ce@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Sun, 4 Jan 2026 13:05:28 -0500
X-Gm-Features: AQt7F2qV76jjyRF_tNxdkO_BZoXwJk2BX3FdO4y4cjIPVOwLYHjxEXOFLsrm-R8
Message-ID: <CAN+1Hboy96VeyE9a8z0twSusYW7o_FTJjV7du3fFwo9vfucS+Q@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
To: Alexander Adolf <alexander.adolf@HIDDEN>
Content-Type: multipart/alternative; boundary="00000000000057913e064793cab9"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: =?UTF-8?Q?Rudolf_Adamkovi=C4=8D?= <rudolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--00000000000057913e064793cab9
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Sun, Jan 4, 2026 at 12:51=E2=80=AFPM Alexander Adolf <
alexander.adolf@HIDDEN> wrote:

> Rudolf Adamkovi=C4=8D <rudolf@HIDDEN> writes:
>
> > [...]
> > I reproduced your results.  Jeez!  Emacs NS port is a mess, and Apple
> > does not guarantee anything, if you look closely enough.  What a mess!
> > Apologies for the noise.
>
> No worries. Appreciate you going the extra mile to build & run your own
> test!
>
> [...]
> > We can go down to using only NSKeyValueObservingOptionInitial, as
> > NSKeyValueObservingOptionNew is now NOP.
> >
> >>     NSUInteger kind =3D [[change valueForKey:NSKeyValueChangeKindKey]
> >> unsignedIntegerValue];
> >
> > IMO, we can drop the "kind" check because effectiveAppearance will
> > always be called NSKeyValueChangeSetting.  All the other values are for
> > collections.  But maybe it is good to be defensive.  Your call.
>
> I'd opt to stay defensive.
>
> > [...]
> > This could be a static literal:
> >
> >   NSArray *referenceNames =3D @[NSAppearanceNameAqua,
> NSAppearanceNameDarkAqua];
>
> Cool, thanks for the suggestion.
>
> >>      struct input_event inev;
> >>      EVENT_INIT (inev);
> >>      inev.kind =3D TOOLKIT_THEME_CHANGED_EVENT;
> >>      inev.arg =3D [name isEqualToString:NSAppearanceNameDarkAqua]
> >>        ? Qdark
> >>        : Qlight;
> >>      kbd_buffer_store_event (&inev);
> >>      ns_send_appdefined (-1);
> >
> > It seems all objects in this function are auto-released.  But, please
> > eyeball it all.  Two pairs of eyes are better than one. :)
>
> The struct input_event is passed to code in keyboard.c, and _should_ get
> freed there after use.
>
> >> - the isDark property, and the FSM around it;
> >>
> >>   I guess this was to get around the prior/double notifications?
> >
> > Yup.  We filter out prior notifications, but Emacs will still get two
> > calls.  So, we should debounce somehow.
> >
> >> - 'if (!name) return; // Ignore transitional appearances.'
> >>
> >>   What was your intention with this line?
> >
> > The Swift signature for bestMatchFromAppearancesWithNames returns
> > NSAppearance.Name? =3D Optional<NSAppearance.Name>, which means the res=
ult
> > can be nil (not in theory, but also in practice).
>
> Well spotted! Upon re-reading the Obj-C docs, it turns out that
> NSAppearanceName (which is what bestMatchFromAppearancesWithNames
> returns) is in fact an NSString*, so can be NULL.
>
> > I figured we should ignore appearance changes with no match, instead of
> > plowing forward, messaging nil, and switching to Dark theme (I suppose
> > that is what would happen; I did not test this path).
> > [...]
>
> Many thanks for the clarifications.
>
> I have added the debouncing FSM, and guards against no match theme,
> resulting in the below, updated patch.
>
> I had to jump another hoop though, because the debouncing would defeat
> the initial KVO observer option; I'm setting the new property to the
> opposite of the current state in applicationDidFinishLaunching now, to
> force a state transition in the KVO handler at startup.
>
>
> One more thing, though... ;-))
>
> I noticed that Emacs's title bars and toolbars don't change their colour
> when the system appearance changes.
>
> It would seem something else will need to be done in addition to change
> these as well?
>

I see a function called ns_set_appearance on ns_frame_parm_handlers that
might do what you want already.  If so, perhaps chain them BUT make sure
not to interfere with people like me who not alter system theme and only
manually alter Emacs theme toggling from light to dark.

--00000000000057913e064793cab9
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Sun, Jan 4, 2026 at 12:51=E2=80=AFPM Alexander Adolf &lt;<a href=3D"mail=
to:alexander.adolf@HIDDEN">alexander.adolf@HIDDEN=
</a>&gt; wrote:</span></div></div><div class=3D"gmail_quote gmail_quote_con=
tainer"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex=
;border-left:1px solid rgb(204,204,204);padding-left:1ex">Rudolf Adamkovi=
=C4=8D &lt;<a href=3D"mailto:rudolf@HIDDEN" target=3D"_blank">rudolf=
@adamkovic.org</a>&gt; writes:<br>
<br>
&gt; [...]<br>
&gt; I reproduced your results.=C2=A0 Jeez!=C2=A0 Emacs NS port is a mess, =
and Apple<br>
&gt; does not guarantee anything, if you look closely enough.=C2=A0 What a =
mess!<br>
&gt; Apologies for the noise.<br>
<br>
No worries. Appreciate you going the extra mile to build &amp; run your own=
<br>
test!<br>
<br>
[...]<br>
&gt; We can go down to using only NSKeyValueObservingOptionInitial, as<br>
&gt; NSKeyValueObservingOptionNew is now NOP.<br>
&gt;<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0NSUInteger kind =3D [[change valueForKey:NSKeyV=
alueChangeKindKey]<br>
&gt;&gt; unsignedIntegerValue];<br>
&gt;<br>
&gt; IMO, we can drop the &quot;kind&quot; check because effectiveAppearanc=
e will<br>
&gt; always be called NSKeyValueChangeSetting.=C2=A0 All the other values a=
re for<br>
&gt; collections.=C2=A0 But maybe it is good to be defensive.=C2=A0 Your ca=
ll.<br>
<br>
I&#39;d opt to stay defensive.<br>
<br>
&gt; [...]<br>
&gt; This could be a static literal:<br>
&gt;<br>
&gt;=C2=A0 =C2=A0NSArray *referenceNames =3D @[NSAppearanceNameAqua, NSAppe=
aranceNameDarkAqua];<br>
<br>
Cool, thanks for the suggestion.<br>
<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 struct input_event inev;<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 EVENT_INIT (inev);<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 inev.kind =3D TOOLKIT_THEME_CHANGED_EVENT;<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 inev.arg =3D [name isEqualToString:NSAppearanc=
eNameDarkAqua]<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 ? Qdark<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 : Qlight;<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 kbd_buffer_store_event (&amp;inev);<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 ns_send_appdefined (-1);<br>
&gt;<br>
&gt; It seems all objects in this function are auto-released.=C2=A0 But, pl=
ease<br>
&gt; eyeball it all.=C2=A0 Two pairs of eyes are better than one. :)<br>
<br>
The struct input_event is passed to code in keyboard.c, and _should_ get<br=
>
freed there after use.<br>
<br>
&gt;&gt; - the isDark property, and the FSM around it;<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0I guess this was to get around the prior/double notifi=
cations?<br>
&gt;<br>
&gt; Yup.=C2=A0 We filter out prior notifications, but Emacs will still get=
 two<br>
&gt; calls.=C2=A0 So, we should debounce somehow.<br>
&gt;<br>
&gt;&gt; - &#39;if (!name) return; // Ignore transitional appearances.&#39;=
<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0What was your intention with this line?<br>
&gt;<br>
&gt; The Swift signature for bestMatchFromAppearancesWithNames returns<br>
&gt; NSAppearance.Name? =3D Optional&lt;NSAppearance.Name&gt;, which means =
the result<br>
&gt; can be nil (not in theory, but also in practice).<br>
<br>
Well spotted! Upon re-reading the Obj-C docs, it turns out that<br>
NSAppearanceName (which is what bestMatchFromAppearancesWithNames<br>
returns) is in fact an NSString*, so can be NULL.<br>
<br>
&gt; I figured we should ignore appearance changes with no match, instead o=
f<br>
&gt; plowing forward, messaging nil, and switching to Dark theme (I suppose=
<br>
&gt; that is what would happen; I did not test this path).<br>
&gt; [...]<br>
<br>
Many thanks for the clarifications.<br>
<br>
I have added the debouncing FSM, and guards against no match theme,<br>
resulting in the below, updated patch.<br>
<br>
I had to jump another hoop though, because the debouncing would defeat<br>
the initial KVO observer option; I&#39;m setting the new property to the<br=
>
opposite of the current state in applicationDidFinishLaunching now, to<br>
force a state transition in the KVO handler at startup.<br>
<br>
<br>
One more thing, though... ;-))<br>
<br>
I noticed that Emacs&#39;s title bars and toolbars don&#39;t change their c=
olour<br>
when the system appearance changes.<br>
<br>
It would seem something else will need to be done in addition to change<br>
these as well?<br></blockquote><div><br></div><div class=3D"gmail_default" =
style=3D"font-family:monospace">I see a function called ns_set_appearance o=
n ns_frame_parm_handlers that might do what you want already.=C2=A0 If so, =
perhaps chain them BUT make sure not to interfere with people like me who n=
ot alter system theme and only manually alter Emacs theme toggling from lig=
ht to dark.</div></div></div>

--00000000000057913e064793cab9--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 4 Jan 2026 17:51:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 04 12:51:55 2026
Received: from localhost ([127.0.0.1]:45153 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vcSGg-0007bH-Kj
	for submit <at> debbugs.gnu.org; Sun, 04 Jan 2026 12:51:55 -0500
Received: from www191.your-server.de ([188.40.2.11]:39600)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vcSGd-0007ao-LU
 for 80001 <at> debbugs.gnu.org; Sun, 04 Jan 2026 12:51:53 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=condition-alpha.com; s=default2503; h=Content-Type:MIME-Version:Date:
 In-reply-to:References:Subject:Cc:To:From:Message-Id:Sender:Reply-To:
 Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:
 Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
 bh=bmJG5/CZKilc2VzMgrwuhvQavsbsQJuNgvhTYJgb01s=; b=akUtUgFSQZIt77WPzGnWdcKGcS
 P5SDuhG3pPRH1omgs8I5O91xDpXb4htIzVtiFPPJULgd3IyO6FhCLrIz7KFg6DbPxlOaKgh5udyjK
 MHJ/CD2L6RLBNfq2VucnWFN4B6yeRR6Npm1rB2hdM+jNocy5tNt4L5IZ6/KdMMRa+SHOCSgUgw1fv
 S1qgSlxC4P1/v2KZJtFwAoxkh+Nk/OguBjddkOEDG5/KzEilRkbKx6scOc5DQGOe4Z1E+dE+pnH+Z
 u0XFjVi8W+xQ1y5KPKVc1ayam8la6x058GXdu5lTjEVNRAOxzbOpAzDmaLGoC2MNKzKxXjXVGDEAe
 gPKBVkdQ==;
Received: from sslproxy03.your-server.de ([88.198.220.132])
 by www191.your-server.de with esmtpsa  (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96.2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vcSGW-000Fhe-2X; Sun, 04 Jan 2026 18:51:44 +0100
Received: from localhost ([127.0.0.1])
 by sslproxy03.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vcSGW-0000Fs-0K; Sun, 04 Jan 2026 18:51:44 +0100
Message-Id: <c919fd1b350e01b1befd7202efce81ce@HIDDEN>
From: Alexander Adolf <alexander.adolf@HIDDEN>
To: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>, =?utf-8?Q?St?=
 =?utf-8?Q?=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
 <m2ldier8oc.fsf@HIDDEN>
In-reply-to: <m2ldier8oc.fsf@HIDDEN>
Date: Sun, 04 Jan 2026 18:51:43 +0100
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Virus-Scanned: Clear (ClamAV 1.0.9/27870/Sun Jan  4 08:26:26 2026)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Rudolf Adamkovi=C4=8D <rudolf@HIDDEN> writes:

> [...]
> I reproduced your results.  Jeez!  Emacs NS port is a mess, and Apple
> does not guarantee anything, if you look closely enough.  What a mess!
> Apologies for the noise.

No worries. Appreciate you going the extra mile to build & run your own
test!

[...]
> We can go down to using only NSKeyValueObservingOptionInitial, as
> NSKeyValueObservingOptionNew is now NOP.
>
>>     NSUInteger kind =3D [[change valueForKey:NSKeyValueChangeKindKey]
>> unsignedIntegerValue];
>
> IMO, we can drop the "kind" check because effectiveAppearance will
> always be called NSKeyValueChangeSetting.  All the other values are for
> collections.  But maybe it is good to be defensive.  Your call.

I'd opt to stay defensive.

> [...]
> This could be a static literal:
>
>   NSArray *referenceNames =3D @[NSAppearanceNameAqua, NSAppearanceNameDar=
kAqua];

Cool, thanks for the suggestion.

>> 	struct input_event inev;
>> 	EVENT_INIT (inev);
>> 	inev.kind =3D TOOLKIT_THEME_CHANGED_EVENT;
>> 	inev.arg =3D [name isEqualToString:NSAppearanceNameDarkAqua]
>> 	  ? Qdark
>> 	  : Qlight;
>> 	kbd_buffer_store_event (&inev);
>> 	ns_send_appdefined (-1);
>
> It seems all objects in this function are auto-released.  But, please
> eyeball it all.  Two pairs of eyes are better than one. :)

The struct input_event is passed to code in keyboard.c, and _should_ get
freed there after use.

>> - the isDark property, and the FSM around it;
>>
>>   I guess this was to get around the prior/double notifications?
>
> Yup.  We filter out prior notifications, but Emacs will still get two
> calls.  So, we should debounce somehow.
>
>> - 'if (!name) return; // Ignore transitional appearances.'
>>
>>   What was your intention with this line?
>
> The Swift signature for bestMatchFromAppearancesWithNames returns
> NSAppearance.Name? =3D Optional<NSAppearance.Name>, which means the result
> can be nil (not in theory, but also in practice).

Well spotted! Upon re-reading the Obj-C docs, it turns out that
NSAppearanceName (which is what bestMatchFromAppearancesWithNames
returns) is in fact an NSString*, so can be NULL.

> I figured we should ignore appearance changes with no match, instead of
> plowing forward, messaging nil, and switching to Dark theme (I suppose
> that is what would happen; I did not test this path).
> [...]

Many thanks for the clarifications.

I have added the debouncing FSM, and guards against no match theme,
resulting in the below, updated patch.

I had to jump another hoop though, because the debouncing would defeat
the initial KVO observer option; I'm setting the new property to the
opposite of the current state in applicationDidFinishLaunching now, to
force a state transition in the KVO handler at startup.


One more thing, though... ;-))

I noticed that Emacs's title bars and toolbars don't change their colour
when the system appearance changes.

It would seem something else will need to be done in addition to change
these as well?


Many thanks and looking forward to your thoughts,

  --alexander




--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
 filename="master-4167e29-Support `toolkit-theme-set-functions' on macOS.patch"

From 4167e29f6dd0878141f3f2326908e435cbeb1682 Mon Sep 17 00:00:00 2001
From: Alexander Adolf <alexander.adolf@HIDDEN>
Date: Sat, 13 Dec 2025 21:25:13 +0100
Subject: [PATCH] Support `toolkit-theme-set-functions' on macOS

* src/nsterm.m ([EmacsApp applicationDidFinishLaunching:]): Add
a key/value observer for the effectiveApperance property to
detect light/dark system UI theme changes.
([EmacsApp observeValueForKeyPath:ofObject:change:context:]): New
method implementation to trigger a TOOLKIT_THEME_CHANGED_EVENT
on light/dark system UI theme changes.
* lisp/frame.el (toolkit-theme): Update the docstring to include macOS
10.14+.
* etc/NEWS (toolkit-theme-set-functions): Add macOS 10.14+ to the list
of supported systems, and try to improve the wording of the entry.
---
 etc/NEWS     | 10 +++++----
 src/frame.c  |  3 ++-
 src/nsterm.h |  3 +++
 src/nsterm.m | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 71 insertions(+), 6 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index a3ca45e3dcf..70ff9b9486c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3850,10 +3850,12 @@ automatically toggling between them.
 
 ---
 *** 'toolkit-theme-set-functions' called when the toolkit theme is set for Emacs.
-When the theme is set on PGTK, Android, or MS-Windows systems,
-'toolkit-theme-set-functions' is called.  The result is stored in the
-variable 'toolkit-theme' as either symbol 'dark' or 'light', but may be
-extended to encompass other toolkit-specific symbols in the future.
+When the theme is set on PGTK, Android, MS-Windows, or macOS 10.14+
+systems, functions on 'toolkit-theme-set-functions' will be called with
+the new theme.  The toolkit theme is also stored in the variable
+'toolkit-theme'.  Currently the toolkit theme is conveyed as either
+symbol 'dark' or 'light', but may be extended to encompass other
+toolkit-specific symbols in the future.
 
 +++
 *** New function 'theme-choose-variant-for-background' for adding to 'toolkit-theme-set-functions'
diff --git a/src/frame.c b/src/frame.c
index ec227ce276d..20f1a248136 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -7703,7 +7703,8 @@ focus (where a frame immediately loses focus when it's left by the mouse
 current theme preference.  This variable is updated automatically when
 the system theme changes.
 
-This variable is only set on PGTK, Android, and MS-Windows builds.  */);
+This variable is only set on PGTK, Android, MS-Windows, and macOS 10.14+
+builds.  */);
   Vtoolkit_theme = Qnil;
   DEFSYM (Qlight, "light");
   DEFSYM (Qdark, "dark");
diff --git a/src/nsterm.h b/src/nsterm.h
index e03add9c3f8..12d65008c0b 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -387,6 +387,9 @@ #define NSTRACE_UNSILENCE()
 @public
   int nextappdefined;
 }
+#if (defined NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101400)
+@property (nonatomic) BOOL doesUseDarkAppearance;
+#endif
 - (void)logNotification: (NSNotification *)notification;
 - (void)antialiasThresholdDidChange:(NSNotification *)notification;
 - (void)sendEvent: (NSEvent *)theEvent;
diff --git a/src/nsterm.m b/src/nsterm.m
index fe5bc35086d..a660c0c7459 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6404,11 +6404,70 @@ - (void)applicationDidFinishLaunching: (NSNotification *)notification
 	       allocInitFromFile:
 		 build_string("icons/hicolor/128x128/apps/emacs.png")]];
   }
-#endif
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+  /* Ensure that a UI appearance change will be detected at startup by
+     setting the property to the opposite of the current UI appearance. */
+  NSArray *referenceNames = @[ NSAppearanceNameAqua, NSAppearanceNameDarkAqua ];
+  NSAppearance *appearance = [self effectiveAppearance];
+  NSAppearanceName name = [appearance bestMatchFromAppearancesWithNames:referenceNames];
+  if (name && ([name length] > 0)) {
+    self.doesUseDarkAppearance = ! [name isEqualToString:NSAppearanceNameDarkAqua];
+  }
+
+  /* Have EmacsApp observe its own effectiveApperance property to
+     detect when the UI appearance changes between light and dark. */
+  [self addObserver:self
+	 forKeyPath:@"effectiveAppearance"
+	    options:(NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew)
+	    context:nil];
+#endif /* MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 */
+#endif /* NS_IMPL_COCOA */
 
   ns_send_appdefined (-2);
 }
 
+#if (defined NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101400)
+- (void) observeValueForKeyPath:(NSString *) keyPath
+		       ofObject:(id) object
+			 change:(NSDictionary<NSString *,id> *) change
+			context:(void *) context
+{
+  /* Check for key paths we are interested in and which we are handling */
+  if ([keyPath isEqualToString:@"effectiveAppearance"]) {
+    NSUInteger kind = [[change valueForKey:NSKeyValueChangeKindKey] unsignedIntegerValue];
+    BOOL isPrior = [[change valueForKey:NSKeyValueChangeNotificationIsPriorKey] boolValue];
+
+    if ((kind == NSKeyValueChangeSetting) && ( ! isPrior)) {
+      NSArray *referenceNames = @[NSAppearanceNameAqua, NSAppearanceNameDarkAqua];
+      NSAppearance *appearance = [object effectiveAppearance];
+      NSAppearanceName name = [appearance bestMatchFromAppearancesWithNames:referenceNames];
+
+      if (name && ([name length] > 0)) {
+	BOOL shouldUseDarkAppearance = [name isEqualToString:NSAppearanceNameDarkAqua];
+
+	if (shouldUseDarkAppearance != self.doesUseDarkAppearance) {
+	  self.doesUseDarkAppearance = shouldUseDarkAppearance;
+
+	  struct input_event inev;
+	  EVENT_INIT (inev);
+	  inev.kind = TOOLKIT_THEME_CHANGED_EVENT;
+	  inev.arg = shouldUseDarkAppearance ? Qdark : Qlight;
+	  kbd_buffer_store_event (&inev);
+	  ns_send_appdefined (-1);
+	}
+      }
+    }
+  }
+  /* Any unrecognised key path must belong to super */
+  else {
+    [super observeValueForKeyPath:keyPath
+			 ofObject:object
+			   change:change
+			  context:context];
+  }
+}
+#endif /* (defined NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) */
+
 - (void)antialiasThresholdDidChange:(NSNotification *)notification
 {
 #ifdef NS_IMPL_COCOA
-- 
2.50.1


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 4 Jan 2026 17:43:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 04 12:43:36 2026
Received: from localhost ([127.0.0.1]:45110 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vcS8d-00072G-Um
	for submit <at> debbugs.gnu.org; Sun, 04 Jan 2026 12:43:36 -0500
Received: from mail-ua1-x92e.google.com ([2607:f8b0:4864:20::92e]:52602)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vcS8Z-00071z-C0
 for 80001 <at> debbugs.gnu.org; Sun, 04 Jan 2026 12:43:34 -0500
Received: by mail-ua1-x92e.google.com with SMTP id
 a1e0cc1a2514c-93f56a97064so3042632241.1
 for <80001 <at> debbugs.gnu.org>; Sun, 04 Jan 2026 09:43:31 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1767548610; x=1768153410; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=Uoo5gGvccMHnqHuBlDJfk+ojkwJNeRRCloPuL6b304Y=;
 b=L70qviDr6hjAHmSvL6Vl+bGFbWQULYir8talJfEJ28LQE0hYAZPZgfwS8tN2YYlptL
 zoQkB1J85WkXiFHk5dy2TxV2X+3SchbJvaPnqiv/Cxl1jCPKJGf4qHdkv+yQ0Ed028Zl
 jb2VunmqhJwkI7rVdPPexo3yFWrAbcgHWBIgfYajUaL3Oe9x7C8BPpxkDaCHR2hbh0GF
 IRDOJQ6rW4AduCgcc7mjz9mvmvPc+Wrcq9cj0FS6lQhCyYLsIF8xmVbBA8s3Xzec296P
 a2lC0VbAHTtXl/iWa4xUbeuqgiEmrtPaNvgvifHFhaD/wuQrnIOUkI3/zVi9AOdP8Oxg
 J8Jg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1767548610; x=1768153410;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Uoo5gGvccMHnqHuBlDJfk+ojkwJNeRRCloPuL6b304Y=;
 b=qhddQli7gfdOJIec4/hchsoKXZkvoZZDXWydR6tJ8s1yY+k3fT8qfPh2Hc12CJ6v+j
 gvl4lAKyMf+qzRbJpQBPP2o6wo2GdQ2fJcub5QxP2MzM+8Oe7SWro/QTW5ecF/oXTXXM
 VESLS+MvQ3VxYnWtX3+oGLCKNK5EBSJ3LXagzVkRtvUqNBhgBpeJks3eW+LLCRSKrSv/
 +fBxm8GaI5pNW5c6dztKVDl62g6isLKFeJmaabtyNhod0OeHwy/PbkM9ryu92ighYXfM
 QvedHeTB3NS5HWvrR3DgU6YBc2dHABtLVRrRfbqbrRPz5Si0lLVENDxdSnUDrVTKf9+u
 7WMA==
X-Forwarded-Encrypted: i=1;
 AJvYcCUNmBPE+OzwcwGnbHA+ECzq8wzOYDz9h0rEftz9D+zfb0KzBR8Tw1GV8PI37cgT5+Lr+seMsw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Yx7IJby7eH42Dl0bPXrbldNTsx1M0jIv1JKZa0Ln+xyMQAYBG2k
 v3KQN7iCLU0Q5bi8IacJqVSGhUecxSuscpSxbZSW/9x4H9JxwaqA6UwFzGwE0fw2QxUPU58pO88
 PZm2YheO3dLR/GuOHt/+0kFqLkc4GQJOtUg==
X-Gm-Gg: AY/fxX7eYC6uBKLIKYn87Els+SLskl2f/5NVXQ9sn+kxpZ2hpV9lFLSrrapy/XSLC8S
 D3Tc3BxiRjEwifgyhys93Haf6rL+4ewGYe4252PccA7VtOt+5Ob/fLcZ677swcaRw/6BenVPYHn
 fuAGCk2j6Zt4tvqWl9KYGbS7aXzuCaNRbZCT26hbqFg2RuTQTTbn1b4moO4wLPHEq//9W/JwRmU
 inZd2Y0WOCPcSdQeCRY2piVJ6BU+cPJZ1lLhUEt1LHprRwXhmpat2KYF6hmw9VUuAsSfe9UdwmH
 rFrImQ==
X-Google-Smtp-Source: AGHT+IHv2G+1OkZVKVK1TqGmsp0yL44P43moy29yLaDuIkhOy8igu8k8C+NpT1ZSeo3amKAkgXRJqPw6rBmLK4L/Uzo=
X-Received: by 2002:a05:6102:358d:b0:5db:cc69:739c with SMTP id
 ada2fe7eead31-5eb1a67d6f5mr12620871137.17.1767548610552; Sun, 04 Jan 2026
 09:43:30 -0800 (PST)
MIME-Version: 1.0
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
 <391b0625a5d2375de9f50d83f5cd3af3@HIDDEN>
In-Reply-To: <391b0625a5d2375de9f50d83f5cd3af3@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Sun, 4 Jan 2026 12:43:18 -0500
X-Gm-Features: AQt7F2qlvk6zkmeAFvG53GOTupp518foawgkxxPB6FWAVBl_9w2dvpvyQUJEtK8
Message-ID: <CAN+1HbqytwLZv8uJW=rE619-PgfJRKMqoyi+6m+6MGqGE2TQTQ@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
To: Alexander Adolf <alexander.adolf@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000000e24fd0647937bed"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: =?UTF-8?Q?Rudolf_Adamkovi=C4=8D?= <rudolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--0000000000000e24fd0647937bed
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Sun, Jan 4, 2026 at 9:05=E2=80=AFAM Alexander Adolf <
alexander.adolf@HIDDEN> wrote:

> St=C3=A9phane Marks <shipmints@HIDDEN> writes:
>
> > [...]
> > Is there a function ELisp can call that says what the NS theme is?
> > Something like ns-effective-appearance?
>
> No, there isn't.
>

Would you be willing to add one as part of this work?  If there's a
platform-neutral lisp function/package already to integrate this into that
would be best.

--0000000000000e24fd0647937bed
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Sun, Jan 4, 2026 at 9:05=E2=80=AFAM Alexander Adolf &lt;<a href=3D"mailt=
o:alexander.adolf@HIDDEN">alexander.adolf@HIDDEN<=
/a>&gt; wrote:</span></div></div><div class=3D"gmail_quote gmail_quote_cont=
ainer"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;=
border-left:1px solid rgb(204,204,204);padding-left:1ex">St=C3=A9phane Mark=
s &lt;<a href=3D"mailto:shipmints@HIDDEN" target=3D"_blank">shipmints@gm=
ail.com</a>&gt; writes:<br>
<br>
&gt; [...]<br>
&gt; Is there a function ELisp can call that says what the NS theme is?<br>
&gt; Something like ns-effective-appearance?<br>
<br>
No, there isn&#39;t.<br></blockquote><div><br></div><div class=3D"gmail_def=
ault" style=3D"font-family:monospace">Would you be willing to add one as pa=
rt of this work?=C2=A0 If there&#39;s a platform-neutral lisp function/pack=
age already to integrate this into that would be best.</div></div></div>

--0000000000000e24fd0647937bed--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 4 Jan 2026 14:05:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 04 09:05:53 2026
Received: from localhost ([127.0.0.1]:43060 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vcOjx-0002Dk-D7
	for submit <at> debbugs.gnu.org; Sun, 04 Jan 2026 09:05:53 -0500
Received: from www191.your-server.de ([188.40.2.11]:44330)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vcOjs-0002DS-4M
 for 80001 <at> debbugs.gnu.org; Sun, 04 Jan 2026 09:05:51 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=condition-alpha.com; s=default2503; h=Content-Transfer-Encoding:
 Content-Type:MIME-Version:Date:In-reply-to:References:Subject:Cc:To:From:
 Message-Id:Sender:Reply-To:Content-ID:Content-Description:Resent-Date:
 Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
 bh=tf7bhZIgWCkY1n3vwqrM4Wbin/y2xl+MAuY8Is+nMjc=; b=nNVPA2L9eP6PE8CZr/M/DFNkvC
 csYC9BUXuldD0fPKRpTNCsZI1A7luT0FEVuAlSzjZbLog7jDCqrkcvLzwjj2A/G0Aw8upHqi8r3jL
 8PqsLLfV0hWGQSHm42gf1Q9LpqtTNuhVtnlB/KygD8axhfk9Pxzk8EsJWoJCf40bKYiQxyOE7nWKX
 IUr1Nn/MihiJXLI1aBMOod+wVnXw9CVmTxXZd5Ds2HvRWeD0SD6YcAAEKp12Nu1bc5x0f7pQM4DJM
 qQo/OvASXU0zB08qmMv+RbjVqlr9J3fP2B8Cyuwd8K2PyCnmbKWTLJq+SjXJB4lufjACLxQxwbaVo
 lZJzc4bA==;
Received: from sslproxy07.your-server.de ([78.47.199.104])
 by www191.your-server.de with esmtpsa  (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96.2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vcOjl-000EBr-1A; Sun, 04 Jan 2026 15:05:41 +0100
Received: from localhost ([127.0.0.1])
 by sslproxy07.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vcOjk-000Lxs-13; Sun, 04 Jan 2026 15:05:41 +0100
Message-Id: <391b0625a5d2375de9f50d83f5cd3af3@HIDDEN>
From: Alexander Adolf <alexander.adolf@HIDDEN>
To: =?utf-8?Q?St=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
In-reply-to: <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
Date: Sun, 04 Jan 2026 15:05:40 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: Clear (ClamAV 1.0.9/27870/Sun Jan  4 08:26:26 2026)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

St=C3=A9phane Marks <shipmints@HIDDEN> writes:

> [...]
> Is there a function ELisp can call that says what the NS theme is?
> Something like ns-effective-appearance?

No, there isn't.

> [...]
> I have macOS 12.7.6 Mojave and 26.1 and could do some testing on 12 when
> you're ready.

That would be super useful. Many thanks for the offer; I will certainly
get back to you on this soon.


Many thanks and cheers,

  --alexander




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 3 Jan 2026 15:57:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 03 10:57:20 2026
Received: from localhost ([127.0.0.1]:37402 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vc40F-0002MW-Th
	for submit <at> debbugs.gnu.org; Sat, 03 Jan 2026 10:57:20 -0500
Received: from fhigh-a8-smtp.messagingengine.com ([103.168.172.159]:35251)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rudolf@HIDDEN>)
 id 1vc40C-0002MF-Te
 for 80001 <at> debbugs.gnu.org; Sat, 03 Jan 2026 10:57:17 -0500
Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41])
 by mailfhigh.phl.internal (Postfix) with ESMTP id B042C140006B;
 Sat,  3 Jan 2026 10:57:10 -0500 (EST)
Received: from phl-frontend-04 ([10.202.2.163])
 by phl-compute-01.internal (MEProxy); Sat, 03 Jan 2026 10:57:10 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamkovic.org;
 h=cc:cc:content-transfer-encoding:content-type:content-type
 :date:date:from:from:in-reply-to:in-reply-to:in-reply-to
 :message-id:mime-version:references:references:reply-to:subject
 :subject:to:to; s=fm3; t=1767455830; x=1767542230; bh=TBqucTxw50
 954ptIXZ/4CZz0wogxBfyf5YGIowFaT6c=; b=aYba8kNawFy+hSlxXeRErP+g1I
 Y35fYozzRcF5xqzKt2W8HC3Hvq0A1ThmgO1+O4Q6QYIL4ozoQtSd6S9+6jtAhEYA
 +RHRXREFPA+c/gfkuuWYRb5HE2mMhqXNVxK/OmX4eSH98tPXka959SZYHXtW+gU1
 GelFGWOwoRDc8yQkvB0PRQieUjjJrqf/SK2erHViBKRGPajFw+6k+Cz5ON/768Xu
 ncQd5BAddQ8XDdmhPF0MQ9YVsUPJipVwNn+PyR5dfB8pN75gEdyFiFTfwG8d59Nw
 ypI34ksCXCVJWEC9944soe1JktqA4XsvdOL5qxSF1WTaOjt4478uAPcieepQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:in-reply-to:message-id
 :mime-version:references:references:reply-to:subject:subject:to
 :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=
 1767455830; x=1767542230; bh=TBqucTxw50954ptIXZ/4CZz0wogxBfyf5YG
 IowFaT6c=; b=NRLrPi6p+ZfivtmVlxQDRsj8446x6757TcYQ4mEn3NKzgrhoKTT
 NDJteAngPWi/r4egN41X3bgbOL6gDEwZ6LRL1TeDzS9TAuThiMOQfL7L9d9L0Q5h
 9L9BRqqw16nqupW59bnuNOiQPacgZRwv0ayVD90Vv4fMu9jnCHLQzx5wE7AF/O8W
 II4ULwpNeU2gizcdCB+YnqGn6Y20ZqxDu0m4l0J3dqkta2+zoCiDkPLqKjDrBffr
 twQdpz7MPy89KwAwtwbMgP4plgX0BmpdplDdsGWLCvGMkALPZXomxdN2yGD6iMbV
 6gtHc3KSu58Udh+gM2XDkR6JoC8Mswff55g==
X-ME-Sender: <xms:VjxZadbRjUs3Pnn8CQtpLfBICu3AUyVce58XwuozhQRq9BeXxfzZrw>
 <xme:VjxZab2TAk0F_DV2vX4vYXD-6bXMbr1wtImMc_5Y6DlDKivcxSmkBZXqdiBJlK2Xp
 wa1EOahwpKB_KXfyBS5epkQlyIwq21Z-DmBwy1jx4yJUely3RhSn8M>
X-ME-Received: <xmr:VjxZadW9jmcU8XE8sTkmuq6pwfR8g4pxir8dtCxqOQr67u0tHOxO_xuMtWH1SiQG-lTovik6hRf89pMnA9KKmam1_HuO8gw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdeludeliecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr
 ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenogfthf
 evqddqjfgurhdqufhushhpvggtthdqlhhoficuldehmdenogfthfevqddqjfgurhdqufhu
 shhpvggtthculddvtddmnecujfgurhephffvvefujggjfhhffffkgggtgfesthhqredttd
 dtjeenucfhrhhomheptfhuugholhhfucetuggrmhhkohhvihgtuceorhhuugholhhfsegr
 uggrmhhkohhvihgtrdhorhhgqeenucggtffrrghtthgvrhhnpefggffgvddvheekieeuve
 eijeejteevleekfeegkeevvddujeehueegvdejhfehgeenucffohhmrghinheprggurghm
 khhovhhitgdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih
 hlfhhrohhmpehruhguohhlfhesrggurghmkhhovhhitgdrohhrghdpnhgspghrtghpthht
 ohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepkedttddtudesuggvsggsuh
 hgshdrghhnuhdrohhrghdprhgtphhtthhopehshhhiphhmihhnthhssehgmhgrihhlrdgt
 ohhmpdhrtghpthhtoheprghlvgigrghnuggvrhdrrgguohhlfhestghonhguihhtihhonh
 dqrghlphhhrgdrtghomh
X-ME-Proxy: <xmx:VjxZaVW1evXT8EVW2XdbXqko4gpBoNw2cPW7TTN1UcRtvRGbQ0l2cg>
 <xmx:VjxZaccO5w49skkUzruKvvvmbnMuLvrjTIEMVsXP5xznHRkhKqvUyw>
 <xmx:VjxZaeWVrSt3YNVXbClLDgbwwAl6i5JQAZazupAHkd85RG7gwbmFUQ>
 <xmx:VjxZaVeag8Bt5A02WAZpkbTwt1lSQNSlYPdKELahnR1R9ROzYkyKFQ>
 <xmx:VjxZacK1wya35hiKMFhR0h3TA4R8WSkaRMgnA3xosFWKjBydjMrwQAbF>
Feedback-ID: i88214938:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat,
 3 Jan 2026 10:57:09 -0500 (EST)
From: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>
To: Alexander Adolf <alexander.adolf@HIDDEN>, =?utf-8?Q?St?=
 =?utf-8?Q?=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
In-Reply-To: <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
In-Reply-To: <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
 <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
Date: Sat, 03 Jan 2026 16:57:07 +0100
Message-ID: <m2ldier8oc.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Alexander Adolf <alexander.adolf@HIDDEN> writes:

>> COMMENT 1: NSKeyValueObservingOptionInitial
>>
> Yes, that's what I wanted.

Great!

>> COMMENT 2: @"notificationIsPrior"
>> COMMENT 3: NSSystemAppearanceProxy

> [...]

I reproduced your results.  Jeez!  Emacs NS port is a mess, and Apple
does not guarantee anything, if you look closely enough.  What a mess!
Apologies for the noise.

>> COMMENT 4: [appearance localizedStandardContainsString:@"Dark"]
>>
> Point well taken; thanks for the improvement.

Great!

> In applicationDidFinishLaunching, I now have:
> ---------------------------- Begin Quote -----------------------------
>   [self addObserver:self
> 	 forKeyPath:@"effectiveAppearance"
> 	    options:( NSKeyValueObservingOptionInitial | NSKeyValueObservingOpti=
onNew )
> 	    context:nil];
> ----------------------------- End Quote ------------------------------

We can go down to using only NSKeyValueObservingOptionInitial, as
NSKeyValueObservingOptionNew is now NOP.

>     NSUInteger kind =3D [[change valueForKey:NSKeyValueChangeKindKey]
> unsignedIntegerValue];

IMO, we can drop the "kind" check because effectiveAppearance will
always be called NSKeyValueChangeSetting.  All the other values are for
collections.  But maybe it is good to be defensive.  Your call.

> NSArray *referenceNames =3D
>   [NSArray arrayWithObjects:NSAppearanceNameAqua,
> 			    NSAppearanceNameDarkAqua, nil];

This could be a static literal:

  NSArray *referenceNames =3D @[NSAppearanceNameAqua, NSAppearanceNameDarkA=
qua];

> 	struct input_event inev;
> 	EVENT_INIT (inev);
> 	inev.kind =3D TOOLKIT_THEME_CHANGED_EVENT;
> 	inev.arg =3D [name isEqualToString:NSAppearanceNameDarkAqua]
> 	  ? Qdark
> 	  : Qlight;
> 	kbd_buffer_store_event (&inev);
> 	ns_send_appdefined (-1);

It seems all objects in this function are auto-released.  But, please
eyeball it all.  Two pairs of eyes are better than one. :)

> - the isDark property, and the FSM around it;
>
>   I guess this was to get around the prior/double notifications?

Yup.  We filter out prior notifications, but Emacs will still get two
calls.  So, we should debounce somehow.

> - 'if (!name) return; // Ignore transitional appearances.'
>
>   What was your intention with this line?

The Swift signature for bestMatchFromAppearancesWithNames returns
NSAppearance.Name? =3D Optional<NSAppearance.Name>, which means the result
can be nil (not in theory, but also in practice).

I figured we should ignore appearance changes with no match, instead of
plowing forward, messaging nil, and switching to Dark theme (I suppose
that is what would happen; I did not test this path).

WDYT?

The "Ignore transitional appearances" was meant for debouncing, not this
line.  I apologize for causing even more confusion!

> Many thanks and looking forward to your thoughts,

Thank *you* for working so hard on this feature, Alexander!

Rudy
--=20
"Arguing that you don't care about the right to privacy because you have
nothing to hide is no different than saying you don't care about free
speech because you have nothing to say."

--- Edward Snowden, 2015

Rudolf Adamkovi=C4=8D <rudolf@HIDDEN> [he/him]
http://adamkovic.org




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 2 Jan 2026 16:47:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 02 11:47:13 2026
Received: from localhost ([127.0.0.1]:58205 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vbiIz-0000NR-5B
	for submit <at> debbugs.gnu.org; Fri, 02 Jan 2026 11:47:13 -0500
Received: from mail-vk1-xa2e.google.com ([2607:f8b0:4864:20::a2e]:53466)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vbiIw-0000NH-Av
 for 80001 <at> debbugs.gnu.org; Fri, 02 Jan 2026 11:47:11 -0500
Received: by mail-vk1-xa2e.google.com with SMTP id
 71dfb90a1353d-55b2a09ff61so2625969e0c.2
 for <80001 <at> debbugs.gnu.org>; Fri, 02 Jan 2026 08:47:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1767372429; x=1767977229; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=8YtPrjn6A85PuhjxhPJDFd0vnm/Hvdx3UkNjej2JXEc=;
 b=Ms/eGmTnO4mBvFDzofv+MxhYaCOAgc3JzibUPGWbsEpcw6VrzZyoxJ/udyePDB86aT
 ErG61NAsl9t9M3l6mErQxUfEVYttHv7cggyPuP2RSKkKhAKf7jF9/WAA7GSr9QbumPTw
 krwQmfd9aFinf/dj2EqNS8aR6igiTHeONzlrAvLIGFqdkCRGUxlpALzz9A0XOVkS77kJ
 0+7bKVYjjvoW77qpiBT9m1L+ELEGDBSBKaQqjC+mUkzsdF2n3u/SQUmgeNlIjcJw2oKF
 gWZS4nVN0yRtWC7xBIAFKzsqdzhvxH1vlWvhUf4ecMkYVefSPEPnweAt/5G8MVMpUIVn
 Bl/w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1767372429; x=1767977229;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=8YtPrjn6A85PuhjxhPJDFd0vnm/Hvdx3UkNjej2JXEc=;
 b=D50lEkLR90jlexYQ1cYLQpwEVcy6DCmJZ+/ZryLc3yAfR/uljKDraWA0FxXlixzNVg
 fW/TqepWJLo3Wejx56hYFDbBBO+d7FsnSVkzpcTAqetXmT0V+AEcCp8WZHLasMNj19KF
 clNsbldYZLftGonpAyrPiNRXJCB2VMMSoMew8yiFE6nivg717LsSp+KugWcNS2I2APFg
 hFBAkVLlycXMgn/cH/fBxAvfUch8Iq2dpmLOkOq8eSsf7PJfuzLt06CaVVLiO3fRS2nx
 qKC8OZAbcEpb89pCfGVxabXQAjbHYVp53cf0WyBofsXgmbPgkHuiH81qs3Qcq0slhfbP
 Xg0A==
X-Forwarded-Encrypted: i=1;
 AJvYcCUE5TANRdt7USDtjw2nw2z4HyKKBut9Wy7nRxP6RFNwQVTDbKy390DW3rGiB3ZW6UGQI73skg==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxWVmdRYSzH3bZLMSE4CLDTZ4w/EXgratPnT0U+6tc+67/rZ6Bt
 hkaidsUkLuvtCfAJRufZaYNwuVnXhDt6GFJgE3sD6C0eu92Fzwum/oyp2TRDuirwihBxV/IxHwv
 +ObpAhPJp7QQxuf+DQ9REyLiQoWwyZOU=
X-Gm-Gg: AY/fxX5I0z+WeOs7OHY8o5mThsTNErDaC3V5SWQTL7vs/0LFqyLqZwg/lJSxJt8q5IV
 0fQpJ4X2BRAlsb8NRW6RU+qJeJpeAenz5xDl2M5Wq6XIcA+ZFXOGzoi7ZZAbVtZ0ObotPT/2gKz
 sBqg16fO63jC5qB6BfEV7+puXxPnj8oPRv/WUXktdwBw5bTydj7A6mioifxob26cA7rDtajH6cf
 xPg1yYWb4UKuNe9toetD5O8JxhFu4zCzeyV73giCQQuBHv1wdbzJnM3cGbB5Tki4bw6d+E=
X-Google-Smtp-Source: AGHT+IGEHQGqAH5vnsV/LAQCDd43rJ5J8UJBzwnQOQvFPZAt4MP8DVpDvbu0NAdZa4vjAs/eBqVRa8sS1FUmVaqlKV0=
X-Received: by 2002:a05:6102:374c:b0:5de:db29:5c07 with SMTP id
 ada2fe7eead31-5eb1a6bde19mr12447437137.19.1767372429184; Fri, 02 Jan 2026
 08:47:09 -0800 (PST)
MIME-Version: 1.0
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
 <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
In-Reply-To: <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Fri, 2 Jan 2026 11:46:57 -0500
X-Gm-Features: AQt7F2rjFhLPwXASng-niVOe-q_malKA712XIMz7oI0kYHczRNYo2UlYSsJKFzk
Message-ID: <CAN+1Hbr41vk0ocfB3XBeAKhKCDwYL7K2K0Jv_g=y_SZ-TpBs0A@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
To: Alexander Adolf <alexander.adolf@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000d3d15906476a75d2"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: =?UTF-8?Q?Rudolf_Adamkovi=C4=8D?= <rudolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000d3d15906476a75d2
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Fri, Jan 2, 2026 at 11:37=E2=80=AFAM Alexander Adolf <
alexander.adolf@HIDDEN> wrote:

> Rudolf Adamkovi=C4=8D <rudolf@HIDDEN> writes:
>
> > [...]
> > Alex, thank you for working on this feature!  Great work.
>
> Many thanks for your invaluable comments and help!!
>
> > That said, I a couple comments. :)
>
> Yes, please!
>
> > COMMENT 1: NSKeyValueObservingOptionInitial
> >
> > We pass NSKeyValueObservingOptionInitial to addObserver:.  By doing so,
> > as Emacs launches, we immediately get a call that appearance has
> > changed.  Is that what we want?  If so, then great.  If not, then we
> > should remove this option.
>
> Yes, that's what I wanted. Which theme Emacs loads at startup (if any)
> is completely unrelated to the system's light or dark mode. Hence I'm
> using the initial option to trigger Emacs's switching to a matching
> theme right away.
>

Is there a function ELisp can call that says what the NS theme is?
Something like ns-effective-appearance?  I would query that when I need it
rather than use anything automated.  I rarely switch my Emacs from dark to
light and I keep it independent of the system theme but if there was a
function...

I have macOS 12.7.6 Mojave and 26.1 and could do some testing on 12 when
you're ready.

--000000000000d3d15906476a75d2
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Fri, Jan 2, 2026 at 11:37=E2=80=AFAM Alexander Adolf &lt;<a href=3D"mail=
to:alexander.adolf@HIDDEN">alexander.adolf@HIDDEN=
</a>&gt; wrote:</span></div></div><div class=3D"gmail_quote gmail_quote_con=
tainer"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex=
;border-left:1px solid rgb(204,204,204);padding-left:1ex">Rudolf Adamkovi=
=C4=8D &lt;<a href=3D"mailto:rudolf@HIDDEN" target=3D"_blank">rudolf=
@adamkovic.org</a>&gt; writes:<br>
<br>
&gt; [...]<br>
&gt; Alex, thank you for working on this feature!=C2=A0 Great work.<br>
<br>
Many thanks for your invaluable comments and help!!<br>
<br>
&gt; That said, I a couple comments. :)<br>
<br>
Yes, please!<br>
<br>
&gt; COMMENT 1: NSKeyValueObservingOptionInitial<br>
&gt;<br>
&gt; We pass NSKeyValueObservingOptionInitial to addObserver:.=C2=A0 By doi=
ng so,<br>
&gt; as Emacs launches, we immediately get a call that appearance has<br>
&gt; changed.=C2=A0 Is that what we want?=C2=A0 If so, then great.=C2=A0 If=
 not, then we<br>
&gt; should remove this option.<br>
<br>
Yes, that&#39;s what I wanted. Which theme Emacs loads at startup (if any)<=
br>
is completely unrelated to the system&#39;s light or dark mode. Hence I&#39=
;m<br>
using the initial option to trigger Emacs&#39;s switching to a matching<br>
theme right away.<br></blockquote><div><br></div><div><div class=3D"gmail_d=
efault" style=3D"font-family:monospace">Is there a function ELisp can call =
that says what the NS theme is?=C2=A0 Something like ns-effective-appearanc=
e?=C2=A0 I would query that when I need it rather than use anything automat=
ed.=C2=A0 I rarely switch my Emacs from dark to light and I keep it indepen=
dent of the system theme but if there was a function...</div></div><div cla=
ss=3D"gmail_default" style=3D"font-family:monospace"><br></div><div class=
=3D"gmail_default" style=3D"font-family:monospace">I have macOS 12.7.6 Moja=
ve and 26.1 and could do some testing on 12 when you&#39;re ready.</div></d=
iv></div>

--000000000000d3d15906476a75d2--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 2 Jan 2026 16:37:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 02 11:37:37 2026
Received: from localhost ([127.0.0.1]:58185 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vbi9h-0008Mj-2R
	for submit <at> debbugs.gnu.org; Fri, 02 Jan 2026 11:37:37 -0500
Received: from www191.your-server.de ([188.40.2.11]:33548)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vbi9d-0008MR-7B
 for 80001 <at> debbugs.gnu.org; Fri, 02 Jan 2026 11:37:34 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=condition-alpha.com; s=default2503; h=Content-Transfer-Encoding:
 Content-Type:MIME-Version:Date:In-reply-to:References:Subject:Cc:To:From:
 Message-Id:Sender:Reply-To:Content-ID:Content-Description:Resent-Date:
 Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
 bh=1nTq+PQdRpqDFTpGuVWZkYgOm3SXX21jJyIN34jQWpQ=; b=LGmSJOl22bnbmvcKh2kWx7hcVu
 6SwJsumYGSJhS0on1bNgzrm1WXwJmESbyV87dqF8wjDHMjtj0N4binOvZITpIh0JrPPqJJ0m/Bko2
 /Qjs792FC9tuB9IDJ2F6lYFzOgX7gQPI+Ke5d8Jiqi6BHMibd9KIRa6u6hVo/olS3tjWVkvOcg0Cu
 ffUYF0/+74Rf7MgCn8c6e5CigEeF2bOfBeWX9a1BKytHSAuUe6mSjVFMuVEPRHVgiKIvhdG+6AADa
 Doj0SnRKTyRTDQ1FPrs08WulzFESVs7/yJjdM08m8BbKjGTb1UhcIApaxI2qRVNFWdmRbh4iuy4Hb
 ToiB+UXg==;
Received: from sslproxy06.your-server.de ([78.46.172.3])
 by www191.your-server.de with esmtpsa  (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96.2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vbi9W-000HnM-10; Fri, 02 Jan 2026 17:37:26 +0100
Received: from localhost ([127.0.0.1])
 by sslproxy06.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vbi9W-0002yf-0e; Fri, 02 Jan 2026 17:37:26 +0100
Message-Id: <fca2b3b0f108ce567bfad65c238d4323@HIDDEN>
From: Alexander Adolf <alexander.adolf@HIDDEN>
To: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>, =?utf-8?Q?St?=
 =?utf-8?Q?=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
 <m2secp1f6k.fsf@HIDDEN>
In-reply-to: <m2secp1f6k.fsf@HIDDEN>
Date: Fri, 02 Jan 2026 17:37:25 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: Clear (ClamAV 1.0.9/27868/Fri Jan  2 08:26:29 2026)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Rudolf Adamkovi=C4=8D <rudolf@HIDDEN> writes:

> [...]
> Alex, thank you for working on this feature!  Great work.

Many thanks for your invaluable comments and help!!

> That said, I a couple comments. :)

Yes, please!

> COMMENT 1: NSKeyValueObservingOptionInitial
>
> We pass NSKeyValueObservingOptionInitial to addObserver:.  By doing so,
> as Emacs launches, we immediately get a call that appearance has
> changed.  Is that what we want?  If so, then great.  If not, then we
> should remove this option.

Yes, that's what I wanted. Which theme Emacs loads at startup (if any)
is completely unrelated to the system's light or dark mode. Hence I'm
using the initial option to trigger Emacs's switching to a matching
theme right away.

> COMMENT 2: @"notificationIsPrior"
>
> We should not hard-code @"notificationIsPrior" and instead use the
> constant NSKeyValueChangeNotificationIsPriorKey.  But, do we even want
> this?  This key is documented as
>
>   If the NSKeyValueObservingOptionPrior option was specified when the
>   observer was registered this notification is sent prior to a change.
>
> We did not specify NSKeyValueObservingOptionPrior.  Should we?  Its
> documentation says
>
>   Whether separate notifications should be sent to the observer before
>   and after each change, instead of a single notification after the
>   change.
>
> I do not think we want that. We want a single notification after the
> change.  (Which we will get twice, but that is orthogonal.)

With

  [self addObserver:self
	 forKeyPath:@"effectiveAppearance"
	    options:( NSKeyValueObservingOptionInitial
		      | NSKeyValueObservingOptionNew
		      | NSKeyValueObservingOptionOld )
	    context:nil];

here is what happens on my system (26.2):

The system UI appearance is light. Launching Emacs gives:

---------------------------- Begin Quote -----------------------------
=E2=96=B6 ./src/emacs -q
2026-01-02 15:45:06.763 emacs[32354:590905] key_path =3D effectiveAppearance
2026-01-02 15:45:06.763 emacs[32354:590905] object   =3D <EmacsApp: 0x10578=
ad90>
2026-01-02 15:45:06.763 emacs[32354:590905] change   =3D {
    kind =3D 1;
    new =3D "<NSCompositeAppearance: 0xba4d18780>";
}
2026-01-02 15:45:06.763 emacs[32354:590905] [[NSApp effectiveAppearance] na=
me]  =3D NSAppearanceNameAqua
2026-01-02 15:45:06.763 emacs[32354:590905] [[self effectiveAppearance] nam=
e]   =3D NSAppearanceNameAqua
2026-01-02 15:45:06.763 emacs[32354:590905] [[object effectiveAppearance] n=
ame] =3D NSAppearanceNameAqua
----------------------------- End Quote ------------------------------

The initial option seems to do what it says on the package. Now I switch
the system appearance to dark:

---------------------------- Begin Quote -----------------------------
2026-01-02 15:45:29.165 emacs[32354:590905] key_path =3D effectiveAppearance
2026-01-02 15:45:29.166 emacs[32354:590905] object   =3D <NSSystemAppearanc=
eProxy: 0xba51ba160>
2026-01-02 15:45:29.166 emacs[32354:590905] change   =3D {
    kind =3D 1;
    notificationIsPrior =3D 1;
}
2026-01-02 15:45:29.166 emacs[32354:590905] [[NSApp effectiveAppearance] na=
me]  =3D NSAppearanceNameAqua
2026-01-02 15:45:29.166 emacs[32354:590905] [[self effectiveAppearance] nam=
e]   =3D NSAppearanceNameAqua
2026-01-02 15:45:29.166 emacs[32354:590905] [[object effectiveAppearance] n=
ame] =3D NSAppearanceNameAqua
2026-01-02 15:45:29.166 emacs[32354:590905] key_path =3D effectiveAppearance
2026-01-02 15:45:29.166 emacs[32354:590905] object   =3D <NSSystemAppearanc=
eProxy: 0xba51ba160>
2026-01-02 15:45:29.166 emacs[32354:590905] change   =3D {
    kind =3D 1;
}
2026-01-02 15:45:29.166 emacs[32354:590905] [[NSApp effectiveAppearance] na=
me]  =3D NSAppearanceNameAqua
2026-01-02 15:45:29.166 emacs[32354:590905] [[self effectiveAppearance] nam=
e]   =3D NSAppearanceNameAqua
2026-01-02 15:45:29.207 emacs[32354:590905] [[object effectiveAppearance] n=
ame] =3D NSAppearanceNameDarkAqua
----------------------------- End Quote ------------------------------

And back to light appearance:

---------------------------- Begin Quote -----------------------------
2026-01-02 15:46:36.024 emacs[32354:590905] key_path =3D effectiveAppearance
2026-01-02 15:46:36.024 emacs[32354:590905] object   =3D <NSSystemAppearanc=
eProxy: 0xba51ba160>
2026-01-02 15:46:36.024 emacs[32354:590905] change   =3D {
    kind =3D 1;
    notificationIsPrior =3D 1;
}
2026-01-02 15:46:36.024 emacs[32354:590905] [[NSApp effectiveAppearance] na=
me]  =3D NSAppearanceNameAqua
2026-01-02 15:46:36.024 emacs[32354:590905] [[self effectiveAppearance] nam=
e]   =3D NSAppearanceNameAqua
2026-01-02 15:46:36.024 emacs[32354:590905] [[object effectiveAppearance] n=
ame] =3D NSAppearanceNameDarkAqua
2026-01-02 15:46:36.024 emacs[32354:590905] key_path =3D effectiveAppearance
2026-01-02 15:46:36.024 emacs[32354:590905] object   =3D <NSSystemAppearanc=
eProxy: 0xba51ba160>
2026-01-02 15:46:36.024 emacs[32354:590905] change   =3D {
    kind =3D 1;
}
2026-01-02 15:46:36.024 emacs[32354:590905] [[NSApp effectiveAppearance] na=
me]  =3D NSAppearanceNameAqua
2026-01-02 15:46:36.024 emacs[32354:590905] [[self effectiveAppearance] nam=
e]   =3D NSAppearanceNameAqua
2026-01-02 15:46:36.059 emacs[32354:590905] [[object effectiveAppearance] n=
ame] =3D NSAppearanceNameAqua
----------------------------- End Quote ------------------------------

I'm using NSLog inside observeValueForKeyPath to generate this output.

Neither [NSApp effectiveAppearance], nor [self effectiveAppearance]
ever seem to change from the value either had at application launch?

[object effectiveAppearance] does change, however.

And I see a new object in the change dictionary only once: at
application launch when I set the initial KVO option.

The documentation of the new and old KVO options says:

---------------------------- Begin Quote -----------------------------
NSKeyValueObservingOptionNew
Indicates that the change dictionary should provide the new attribute value=
, if applicable.

NSKeyValueObservingOptionOld
Indicates that the change dictionary should contain the old attribute value=
, if applicable.
----------------------------- End Quote ------------------------------

In the case of effectiveAppearance, providing the new or old attribute
value was seemingly considered "not applicable"?

> COMMENT 3: NSSystemAppearanceProxy
>
> The NSSystemAppearanceProxy is suspicious.  Why cannot we simply query
> self instead?

Because [self effectiveAppearance] does not give useful results? See
quoted terminal output above.

> Or, much better, we get the old and new values, with
> NSKeyValueChange[New|Old]Key, after calling addObserver with
> NSKeyValueObservingOption[Old|New] options.

I get neither old, nor new values in the change dictionary (with the
exception of once at application launch); see quoted terminal output
above.

> COMMENT 4: [appearance localizedStandardContainsString:@"Dark"]
>
> Comparing the appearance to "Dark" is not robust.  First, locale-aware
> comparison is not necessary nothing to do with it.  Second, there is no
> guarantee it will keep working, and we should treat those constants as,
> well opaque constants.  Instead, we must call
> bestMatchFromAppearancesWithNames and compare against a constant, as
> shown in my example.  There is no other robust way.

Point well taken; thanks for the improvement.

> SUMMARY
> [...]

In applicationDidFinishLaunching, I now have:
---------------------------- Begin Quote -----------------------------
  [self addObserver:self
	 forKeyPath:@"effectiveAppearance"
	    options:( NSKeyValueObservingOptionInitial | NSKeyValueObservingOption=
New )
	    context:nil];
----------------------------- End Quote ------------------------------

And this is now the observer method:
---------------------------- Begin Quote -----------------------------
- (void) observeValueForKeyPath:(NSString *) keyPath
		       ofObject:(id) object
			 change:(NSDictionary<NSString *,id> *) change
			context:(void *) context
{
  /* Check for key paths we are interested in and which we are handling */
  if ([keyPath isEqualToString:@"effectiveAppearance"]) {
    NSUInteger kind =3D [[change valueForKey:NSKeyValueChangeKindKey] unsig=
nedIntegerValue];
    bool isPrior =3D [[change valueForKey:NSKeyValueChangeNotificationIsPri=
orKey] boolValue];

    if ((kind =3D=3D NSKeyValueChangeSetting) && ( ! isPrior)) {
	NSArray *referenceNames =3D
	  [NSArray arrayWithObjects:NSAppearanceNameAqua,
				    NSAppearanceNameDarkAqua, nil];
	NSAppearance *appearance =3D [object effectiveAppearance];
	NSAppearanceName name =3D [appearance bestMatchFromAppearancesWithNames:re=
ferenceNames];

	struct input_event inev;
	EVENT_INIT (inev);
	inev.kind =3D TOOLKIT_THEME_CHANGED_EVENT;
	inev.arg =3D [name isEqualToString:NSAppearanceNameDarkAqua]
	  ? Qdark
	  : Qlight;
	kbd_buffer_store_event (&inev);
	ns_send_appdefined (-1);
    }
  }
  /* Any unrecognised key path must belong to super */
  else {
    [super observeValueForKeyPath:keyPath
			 ofObject:object
			   change:change
			  context:context];
  }
}
----------------------------- End Quote ------------------------------

That is, I believe to have followed all your advice, except the
following two aspects:

- the isDark property, and the FSM around it;

  I guess this was to get around the prior/double notifications?


- 'if (!name) return; // Ignore transitional appearances.'

  What was your intention with this line?



Many thanks and looking forward to your thoughts,

  --alexander




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 1 Jan 2026 16:16:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 01 11:16:57 2026
Received: from localhost ([127.0.0.1]:54174 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vbLM8-00081K-4R
	for submit <at> debbugs.gnu.org; Thu, 01 Jan 2026 11:16:57 -0500
Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]:57897)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rudolf@HIDDEN>)
 id 1vbLLx-00080t-JF
 for 80001 <at> debbugs.gnu.org; Thu, 01 Jan 2026 11:16:50 -0500
Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43])
 by mailfout.phl.internal (Postfix) with ESMTP id D0D6FEC01AE;
 Thu,  1 Jan 2026 11:16:39 -0500 (EST)
Received: from phl-frontend-03 ([10.202.2.162])
 by phl-compute-03.internal (MEProxy); Thu, 01 Jan 2026 11:16:39 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamkovic.org;
 h=cc:cc:content-transfer-encoding:content-type:content-type
 :date:date:from:from:in-reply-to:in-reply-to:message-id
 :mime-version:references:reply-to:subject:subject:to:to; s=fm3;
 t=1767284199; x=1767370599; bh=CdLAJ2o7VGyF/uXpLnSyZQUQ4oCt2roI
 LfPrqjW3PDU=; b=ihpy5oM1LKHdrPML2RBqA08xj1Utj9F/uDGDU6fdsAaqVien
 SNdBnvjg13MYd/mhZzXgEjC8/rQuG3dn51uM6BLQNLYXGC73WlYWc9gCaWOtP0X0
 1P7LqcuigL+pKX4shv6oOmiDNjBlD3WfP2px2r8Nl1JK/QeWuYuhJvbAzzELtlk7
 XEkXY98jFYsU3mEaAVpM55rtHnz8UpXXoYlVzSSpruQbNleSG1PF0DsfdL9kR1H/
 UkRvO67wy4YFe0ZjTYqvOuDVyfvLi7tWwzvn2rFyu/HTibZrQIFrApv5P3/of+HR
 STVeT7ek0s9pp9zlpS6k45YrII5CNk8bgSmIBQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1767284199; x=
 1767370599; bh=CdLAJ2o7VGyF/uXpLnSyZQUQ4oCt2roILfPrqjW3PDU=; b=x
 ZSu8wjjsvDRpL9dCWiVdeLGoTrnHBzL4rQ6JiNQMFEI1L9dVhQ5bwjLXA4IvdL3b
 AeYtZ/CpDWm7LFllehvoxJNnxyGxYB8MSHix6+0QkKZzNldy7ATq6RVrmUB+eOod
 mdXMhyuAaoNnMIsqQb17TUhH8DMwxLW6rTjg0FTyOaU0gcIO9AdA0AoIEAdQhXes
 Y9YB0sJhZa8WvVvrkirXZ6xPR0cIdGriQIO86MSPTGeKVaZmeC42ZGPUbAIERpEK
 5vOLHzRAlD92x4kfYq4576BC4tvw0gFcCFX+WAwyvcfV65qxdej3eFoB0IeM0rnP
 3J2W6xAakM2HuO8UQgp+g==
X-ME-Sender: <xms:551WaXON8muXfubQhcWN7u5yRBJ7F9PkSsoc7AIJlI0kdAXPnxkp1Q>
 <xme:551WaZaDMbMwHZuIH76GnreDkS4iQ_IPKTZMtFgiYSzTUguEfEJKR8HlqyG9vPQyq
 5uY8s-O4orEJYBgHnxlpyS9NS2x_oHUFXDOFv3WfHxvweSokj2WpAM>
X-ME-Received: <xmr:551WaTrTE19qO62htSMPBrvfsjokmYqKsGCC4h6GA-sqdbbRafO9xA7rGFcx02z9UTK1QiDVoLBd1cYwrJ9e1ZI-r7VrcFI>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdekiedvgecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr
 ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug
 hrpefhvfevufgjfhffkfggtgfgsehtqhertddttdejnecuhfhrohhmpeftuhguohhlfhcu
 tegurghmkhhovhhitgcuoehruhguohhlfhesrggurghmkhhovhhitgdrohhrgheqnecugg
 ftrfgrthhtvghrnhepheeiteevuefhveehgfduveehjefhjedutdffgefhhfduhedvgeei
 keelgeejjeegnecuffhomhgrihhnpegrphhplhgvrdgtohhmpdgruggrmhhkohhvihgtrd
 horhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep
 rhhuugholhhfsegruggrmhhkohhvihgtrdhorhhgpdhnsggprhgtphhtthhopeefpdhmoh
 guvgepshhmthhpohhuthdprhgtphhtthhopeektddttdduseguvggssghughhsrdhgnhhu
 rdhorhhgpdhrtghpthhtohepshhhihhpmhhinhhtshesghhmrghilhdrtghomhdprhgtph
 htthhopegrlhgvgigrnhguvghrrdgrugholhhfsegtohhnughithhiohhnqdgrlhhphhgr
 rdgtohhm
X-ME-Proxy: <xmx:551WaVaPeTno2Q7G29Aj0R6h8ksqlVUzNI4nRgEjxk6MgQPtdT9kTg>
 <xmx:551WaTTHMtGveSo8qkvg62sZAnbTEyKDy9tvMTQbKpxSPLkaAdzcVg>
 <xmx:551WaU4KGXjw4XUa9PNZ2s9wSqtVAa2cW8ifNvIXgmckmXeiVUPw2A>
 <xmx:551WaQyBpjOp-4LRJ5EoqiUeV4ZHAgJOOMdy2UKvwUbZWgZYyUnanQ>
 <xmx:551WafGKZDnpMc0ZqRYtvgKR0ZqFXc4MQkUbEACbfoKqG_Dv84_lKMYr>
Feedback-ID: i88214938:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu,
 1 Jan 2026 11:16:38 -0500 (EST)
From: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>
To: Alexander Adolf <alexander.adolf@HIDDEN>, =?utf-8?Q?St?=
 =?utf-8?Q?=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
In-Reply-To: <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
Date: Thu, 01 Jan 2026 17:16:35 +0100
Message-ID: <m2secp1f6k.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Alexander Adolf <alexander.adolf@HIDDEN> writes:

> This patch would be the final version from my side. Unless either of
> you sees room for improvement still?  Many thanks and looking forward
> to your thoughts, [...]

Alex, thank you for working on this feature!  Great work.

That said, I a couple comments. :)

COMMENT 1: NSKeyValueObservingOptionInitial

We pass NSKeyValueObservingOptionInitial to addObserver:.  By doing so,
as Emacs launches, we immediately get a call that appearance has
changed.  Is that what we want?  If so, then great.  If not, then we
should remove this option.

COMMENT 2: @"notificationIsPrior"

We should not hard-code @"notificationIsPrior" and instead use the
constant NSKeyValueChangeNotificationIsPriorKey.  But, do we even want
this?  This key is documented as

  If the NSKeyValueObservingOptionPrior option was specified when the
  observer was registered this notification is sent prior to a change.

We did not specify NSKeyValueObservingOptionPrior.  Should we?  Its
documentation says

  Whether separate notifications should be sent to the observer before
  and after each change, instead of a single notification after the
  change.

I do not think we want that. We want a single notification after the
change.  (Which we will get twice, but that is orthogonal.)

COMMENT 3: NSSystemAppearanceProxy

The NSSystemAppearanceProxy is suspicious.  Why cannot we simply query
self instead?  Or, much better, we get the old and new values, with
NSKeyValueChange[New|Old]Key, after calling addObserver with
NSKeyValueObservingOption[Old|New] options.

COMMENT 4: [appearance localizedStandardContainsString:@"Dark"]

Comparing the appearance to "Dark" is not robust.  First, locale-aware
comparison is not necessary nothing to do with it.  Second, there is no
guarantee it will keep working, and we should treat those constants as,
well opaque constants.  Instead, we must call
bestMatchFromAppearancesWithNames and compare against a constant, as
shown in my example.  There is no other robust way.

SUMMARY

If the following works, it would be the best (100% robust):

addObserver: options:

- NSKeyValueObservingOptionInitial [1]
- NSKeyValueObservingOptionOld
- NSKeyValueObservingOptionNew

[1] Included only if we want to be called right away, on launch.

observeValueForKeyPath:

1. check the key (good as is)
2. check NSKeyValueChangeKindKey entry is NSKeyValueChangeSetting [1]
3. get NSKeyValueChangeOldKey entry
4. get NSKeyValueChangeNewKey entry
5. if the old/new entries are equal, stop
6. compute dark yes/no with bestMatchFromAppearancesWithNames: [2]
7. issue TOOLKIT_THEME_CHANGED_EVENT

[1] Per the documentation.  See:

    https://developer.apple.com/documentation/foundation/nskeyvaluechangeke=
y?language=3Dobjc
    https://developer.apple.com/documentation/foundation/nskeyvalueobservin=
goptions?language=3Dobjc

[2] As seen in my example; it is the only robust way.

Hopefully this helps!

Rudy
--=20
"It is not the strongest of the species that survives, not the most
intelligent that survives. It is the one that is the most adaptable to
change."

--- Charles Darwin

Rudolf Adamkovi=C4=8D <rudolf@HIDDEN> [he/him]
http://adamkovic.org




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 29 Dec 2025 16:50:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 29 11:50:08 2025
Received: from localhost ([127.0.0.1]:38421 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vaGRc-0006Dn-3c
	for submit <at> debbugs.gnu.org; Mon, 29 Dec 2025 11:50:08 -0500
Received: from mail-ua1-x932.google.com ([2607:f8b0:4864:20::932]:52225)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vaGRZ-0006Ab-54
 for 80001 <at> debbugs.gnu.org; Mon, 29 Dec 2025 11:50:05 -0500
Received: by mail-ua1-x932.google.com with SMTP id
 a1e0cc1a2514c-9412512e9f3so2351065241.0
 for <80001 <at> debbugs.gnu.org>; Mon, 29 Dec 2025 08:50:05 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1767026999; x=1767631799; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=V4oPlJGNAqgR8Ns6VoI4WCZCQNEyOjQA696VYCmgy1A=;
 b=N1lpY2WAH0HynwQFjunOKZtvOTl9e+RW/S58UJu5uTi3DKugryyd/hLjLAuQKSa0bM
 Owap6FTnHJ2HqBgzKZbS6ouvS3R0aw9xQhWQPss7V6OBKLbCyocxniOBtI3h5XW3qRBn
 N8J+EZ0+73kjCdQfhLf+s/XVM4oqLnIqLxdKp7BzVY7jAd5LP7B96w5eQCwQleE1LgwL
 JLDT30/ZFcLLJJcfjEa5jkNuD1N6edx0t4J048M4vLi6W3M0U6aQO46Dy2mgmk8aCQxp
 rzvyHxYqEGD9siftYUWvFFKzpf5QkUy2U5EBr6C9MvPzxoDUp3n5U8Z0eAChNTb4YfoS
 ZsVw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1767026999; x=1767631799;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=V4oPlJGNAqgR8Ns6VoI4WCZCQNEyOjQA696VYCmgy1A=;
 b=gPTksXsS9p4/mQ67zf99zvbtPFfU1iCtqvz0LPyi5ACGw+eovishTgB95YxR98rbwr
 sPHbOdHI1stZuWB5K+B9q6vGD1nzPDnNHRZvUr0yfGJs0CWNAzSL2OReI00LK4W4VlRW
 jxr1oQz/EikgYlYTTveS2sbMMvnXoEr7p//i5oC/1ay2igMMkQYQvpeJgygGvasjl+I+
 vVl/1Y3Cspabr4iXTcqrgr4uvJk0buwn20PC/LmEc4pVMVcBzhh5gAumokHyHua7F+65
 AN4BKkwkWf4G7uOmzwd1l4BptFw8SBTXcwt6S3aO9GQ7zk8r3rVFjxWxsGqyXLIkdEIU
 Q9ZA==
X-Forwarded-Encrypted: i=1;
 AJvYcCV81r7P5CrT4QKA0RLeDn+BWHGEH2RXtabDsGe+mIflQOD2wAz0nSKPfAPdstP4C04XzlTIRA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzRtkJZC7CC7w/AEH66e6Bk7dGnFOG7LZW0FOoycL5zgbyqELQK
 Lrx6uCrne0EtyyLy9Wuqbw+DCzHJ7/SfZCgb90i0bdY3EZXgYHszaBmd/npTbWhWiHTwydLngct
 rw9q/sAHqE15iPSQqFj9jaCWHPTEnrdU=
X-Gm-Gg: AY/fxX6FF/OmtYdDi7iemvlNwzzu+SR1+eXe709LLxQY1UexTynLVjpePuCw8b5HTiN
 kGEd39MT6y1TmGTijHyJNV3QlSaCtT0+Ke8UHBjbuvV5DvFBzNRuNchzGXjDWnM2q+NEh+7P8TM
 xeEdiuBfiHu8f+dYkPzqS7un1rJD8xFoiVjy00IPZM42cHJbQdDPI4uO7hY1pxrdCvNRmvv9dPt
 pXeVRyQT8vLNT67p4h/xozrJWHBDY8ODBJ2pwRsN1AJPbOHg+bKxp8F9Z6tSHH6mMPezTk=
X-Google-Smtp-Source: AGHT+IEVHR3WkKMb1lQdoHVP90NPTgTtvR66fQ2OEBNpXtAPZE0ZQa6V8qhTIU/v3x+0VK5VqXSzhh2yRyqbxpDeYR8=
X-Received: by 2002:a05:6102:3a0d:b0:5dd:c59d:ea2c with SMTP id
 ada2fe7eead31-5eb1a8444demr9036916137.36.1767026999338; Mon, 29 Dec 2025
 08:49:59 -0800 (PST)
MIME-Version: 1.0
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
 <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
In-Reply-To: <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Mon, 29 Dec 2025 11:49:46 -0500
X-Gm-Features: AQt7F2qujGn3e5lRsKUbYOvdhlwKpJlxnTXz4n6enooqhgyes83wTDZxRUePL4Y
Message-ID: <CAN+1HbpR8C1Y-xCpKDhJOgtg1hyzPCQd0d+t8LBZ2Ky_gSS-hQ@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
To: Alexander Adolf <alexander.adolf@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000009aabec06471a0878"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: =?UTF-8?Q?Rudolf_Adamkovi=C4=8D?= <rudolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--0000000000009aabec06471a0878
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, Dec 29, 2025 at 11:41=E2=80=AFAM Alexander Adolf <
alexander.adolf@HIDDEN> wrote:

> Rudolf Adamkovi=C4=8D <rudolf@HIDDEN> writes:
>
> > [...]
> > Okay, so if `viewDidChangeEffectiveAppearance' is out, our options are
> > limited.  NSDistributedNotificationCenter posts a notification, but not
> > a public one.  With that, KVO it is. :)
> >
> > I wrote the example below, compiled it with Xcode, and works well.  But
> > beware!  AppKit can call the observer multiple times.  On my system, th=
e
> > observer is called *twice* per appearance change. Hence, the BOOL
> > property, to make sure we are not doing useless work.
> > [...]
>
> Thanks for the example! Attached is a patch with my KVO version.
>
> The observer is _always_ called twice for me. The first invocation has a
> notificationIsPrior entry with an integer value of one in the change
> dictionary. So seems to be a "heads up, something coming rel soon now"
> type of thing. In my code, I'm hence filtering out those prior
> callbacks.
>
> Also, pondering about the undocumented NSSystemAppearanceProxy a little
> bit more, I am now convinced that it is safe to send it an
> effectiveAppearance message. The semantics of observeValueForKeyPath
> apparently is that when this method is called, the stuff at keyPath of
> the passed in object has changed. Hence, it must always be safe to send
> the passed in object the contents of keyPath as a message.
>
> Hope this works for both of you. This patch would be the final version
> from my side. Unless either of you sees room for improvement still?
>
>
> Many thanks and looking forward to your thoughts,
>

I think if you scope the notification using NSKeyValueObservingOptionNew
instead of NSKeyValueObservingOptionInitial you'll get only one callback?

--0000000000009aabec06471a0878
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Mon, Dec 29, 2025 at 11:41=E2=80=AFAM Alexander Adolf &lt;<a href=3D"mai=
lto:alexander.adolf@HIDDEN">alexander.adolf@HIDDEN=
m</a>&gt; wrote:</span></div></div><div class=3D"gmail_quote gmail_quote_co=
ntainer"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e=
x;border-left:1px solid rgb(204,204,204);padding-left:1ex">Rudolf Adamkovi=
=C4=8D &lt;<a href=3D"mailto:rudolf@HIDDEN" target=3D"_blank">rudolf=
@adamkovic.org</a>&gt; writes:<br>
<br>
&gt; [...]<br>
&gt; Okay, so if `viewDidChangeEffectiveAppearance&#39; is out, our options=
 are<br>
&gt; limited.=C2=A0 NSDistributedNotificationCenter posts a notification, b=
ut not<br>
&gt; a public one.=C2=A0 With that, KVO it is. :)<br>
&gt;<br>
&gt; I wrote the example below, compiled it with Xcode, and works well.=C2=
=A0 But<br>
&gt; beware!=C2=A0 AppKit can call the observer multiple times.=C2=A0 On my=
 system, the<br>
&gt; observer is called *twice* per appearance change. Hence, the BOOL<br>
&gt; property, to make sure we are not doing useless work.<br>
&gt; [...]<br>
<br>
Thanks for the example! Attached is a patch with my KVO version.<br>
<br>
The observer is _always_ called twice for me. The first invocation has a<br=
>
notificationIsPrior entry with an integer value of one in the change<br>
dictionary. So seems to be a &quot;heads up, something coming rel soon now&=
quot;<br>
type of thing. In my code, I&#39;m hence filtering out those prior<br>
callbacks.<br>
<br>
Also, pondering about the undocumented NSSystemAppearanceProxy a little<br>
bit more, I am now convinced that it is safe to send it an<br>
effectiveAppearance message. The semantics of observeValueForKeyPath<br>
apparently is that when this method is called, the stuff at keyPath of<br>
the passed in object has changed. Hence, it must always be safe to send<br>
the passed in object the contents of keyPath as a message.<br>
<br>
Hope this works for both of you. This patch would be the final version<br>
from my side. Unless either of you sees room for improvement still?<br>
<br>
<br>
Many thanks and looking forward to your thoughts,<br></blockquote><div><br>=
</div><div class=3D"gmail_default" style=3D""><font face=3D"monospace">I th=
ink if you scope the notification using=C2=A0NSKeyValueObservingOptionNew i=
nstead of=C2=A0<span style=3D"color:rgb(97,97,97);font-size:14px">NSKeyValu=
eObservingOptionInitial=C2=A0</span>you&#39;ll get only one callback?</font=
></div></div></div>

--0000000000009aabec06471a0878--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 29 Dec 2025 16:42:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 29 11:42:07 2025
Received: from localhost ([127.0.0.1]:38406 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vaGJq-0005rw-Q7
	for submit <at> debbugs.gnu.org; Mon, 29 Dec 2025 11:42:07 -0500
Received: from www191.your-server.de ([188.40.2.11]:48346)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vaGJl-0005rH-2y
 for 80001 <at> debbugs.gnu.org; Mon, 29 Dec 2025 11:42:04 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=condition-alpha.com; s=default2503; h=Content-Type:MIME-Version:Date:
 In-reply-to:References:Subject:Cc:To:From:Message-Id:Sender:Reply-To:
 Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:
 Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
 bh=ohRzDyCp8PExukFjv+zxPGV6rxQTYrDKJXqnUdGPjYw=; b=Fk9FciUzq0TEy/UBqp3jJwYi/0
 6p679V8eohyeFySwK9jLLNXoxTqjndgM0u/k0CsVVOznsRRUdLlKVZ4F5cmxTgFmCLwIfWiItcj3O
 AHGqxgi2NeJ2C7BJbliiKkDcgBbGf5ANYc/wXyRzvWiqFoNInqlobKBWiNBQfQtZIj5jfPtI5kjsd
 Kyyi8jZuDolHqzq0Ku6oTI1evHxjcDIticUFg8OUyO7ru+TLuXc3ySb0wr7VbET6QHywpk02vunu6
 0Hon9jZbhuRq5amBWomsxIahcAQEflplCiXvKzecetggFYpgi02BX0UvdUeNGaNnQSoK5YiI5MJkQ
 SktXgpaQ==;
Received: from sslproxy02.your-server.de ([78.47.166.47])
 by www191.your-server.de with esmtpsa  (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96.2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vaGJe-0007jV-0A; Mon, 29 Dec 2025 17:41:54 +0100
Received: from localhost ([127.0.0.1])
 by sslproxy02.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vaGJd-000KFv-1A; Mon, 29 Dec 2025 17:41:53 +0100
Message-Id: <82041dc15b1caa9b82f9e82d784c2c63@HIDDEN>
From: Alexander Adolf <alexander.adolf@HIDDEN>
To: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>, =?utf-8?Q?St?=
 =?utf-8?Q?=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
 <m27bu6teyu.fsf@HIDDEN>
In-reply-to: <m27bu6teyu.fsf@HIDDEN>
Date: Mon, 29 Dec 2025 17:41:53 +0100
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Virus-Scanned: Clear (ClamAV 1.0.9/27864/Mon Dec 29 08:25:57 2025)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Rudolf Adamkovi=C4=8D <rudolf@HIDDEN> writes:

> [...]
> Okay, so if `viewDidChangeEffectiveAppearance' is out, our options are
> limited.  NSDistributedNotificationCenter posts a notification, but not
> a public one.  With that, KVO it is. :)
>
> I wrote the example below, compiled it with Xcode, and works well.  But
> beware!  AppKit can call the observer multiple times.  On my system, the
> observer is called *twice* per appearance change. Hence, the BOOL
> property, to make sure we are not doing useless work.
> [...]

Thanks for the example! Attached is a patch with my KVO version.

The observer is _always_ called twice for me. The first invocation has a
notificationIsPrior entry with an integer value of one in the change
dictionary. So seems to be a "heads up, something coming rel soon now"
type of thing. In my code, I'm hence filtering out those prior
callbacks.

Also, pondering about the undocumented NSSystemAppearanceProxy a little
bit more, I am now convinced that it is safe to send it an
effectiveAppearance message. The semantics of observeValueForKeyPath
apparently is that when this method is called, the stuff at keyPath of
the passed in object has changed. Hence, it must always be safe to send
the passed in object the contents of keyPath as a message.

Hope this works for both of you. This patch would be the final version
from my side. Unless either of you sees room for improvement still?


Many thanks and looking forward to your thoughts,

  --alexander



--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
 filename="master-e861638-Support toolkit-theme-set-functions on macOS.patch"

From e861638dba4ca8adf448d0da3170606594f5a5a5 Mon Sep 17 00:00:00 2001
From: Alexander Adolf <alexander.adolf@HIDDEN>
Date: Sat, 13 Dec 2025 21:25:13 +0100
Subject: [PATCH] Support `toolkit-theme-set-functions' on macOS

* src/nsterm.m ([EmacsApp applicationDidFinishLaunching:]): Add
a key/value observer for the effectiveApperance property to
detect light/dark system UI theme changes.
([EmacsApp observeValueForKeyPath:ofObject:change:context:]): New
method implementation to trigger a TOOLKIT_THEME_CHANGED_EVENT
on light/dark system UI theme changes.
* lisp/frame.el (toolkit-theme): Update the docstring to include macOS
10.14+.
* etc/NEWS (toolkit-theme-set-functions): Add macOS 10.14+ to the list
of supported systems, and try to improve the wording of the entry.
---
 etc/NEWS     | 10 ++++++----
 src/frame.c  |  3 ++-
 src/nsterm.m | 44 +++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 51 insertions(+), 6 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 8dd3bdbca2e..71a9dc5b167 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3816,10 +3816,12 @@ automatically toggling between them.
 
 ---
 *** 'toolkit-theme-set-functions' called when the toolkit theme is set for Emacs.
-When the theme is set on PGTK, Android, or MS-Windows systems,
-'toolkit-theme-set-functions' is called.  The result is stored in the
-variable 'toolkit-theme' as either symbol 'dark' or 'light', but may be
-extended to encompass other toolkit-specific symbols in the future.
+When the theme is set on PGTK, Android, MS-Windows, or macOS 10.14+
+systems, functions on 'toolkit-theme-set-functions' will be called with
+the new theme.  The toolkit theme is also stored in the variable
+'toolkit-theme'.  Currently the toolkit theme is conveyed as either
+symbol 'dark' or 'light', but may be extended to encompass other
+toolkit-specific symbols in the future.
 
 +++
 ** Progress reporter callbacks.
diff --git a/src/frame.c b/src/frame.c
index 1594578c06d..1702a261e64 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -7699,7 +7699,8 @@ focus (where a frame immediately loses focus when it's left by the mouse
 current theme preference.  This variable is updated automatically when
 the system theme changes.
 
-This variable is only set on PGTK, Android, and MS-Windows builds.  */);
+This variable is only set on PGTK, Android, MS-Windows, and macOS 10.14+
+builds.  */);
   Vtoolkit_theme = Qnil;
   DEFSYM (Qlight, "light");
   DEFSYM (Qdark, "dark");
diff --git a/src/nsterm.m b/src/nsterm.m
index 9468832b6d5..1e4fb013b64 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6404,11 +6404,53 @@ - (void)applicationDidFinishLaunching: (NSNotification *)notification
 	       allocInitFromFile:
 		 build_string("icons/hicolor/128x128/apps/emacs.png")]];
   }
-#endif
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+  /* Have EmacsApp observe its own effectiveApperance property to detect
+     when the UI appearance changes between light and dark. */
+  [self addObserver:self
+	 forKeyPath:@"effectiveAppearance"
+	    options:NSKeyValueObservingOptionInitial
+	    context:nil];
+#endif /* MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 */
+#endif /* NS_IMPL_COCOA */
 
   ns_send_appdefined (-2);
 }
 
+#if (defined NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101400)
+- (void) observeValueForKeyPath:(NSString *) keyPath
+		       ofObject:(id) object
+			 change:(NSDictionary<NSString *,id> *) change
+			context:(void *) context
+{
+  /* Check for key paths we are interested in and which we are handling */
+  if ([keyPath isEqualToString:@"effectiveAppearance"]) {
+      if ( ! ([[change valueForKey:@"notificationIsPrior"] intValue] == 1)) {
+	  /* object is either an EmacsApp (NSApplication), or an
+	     NSSystemAppearanceProxy.  Both respond to the
+	     effectiveAppearance message with an NSAppearance instance. */
+	  NSAppearanceName appearance = [[object effectiveAppearance] name];
+	  struct input_event inev;
+
+	  EVENT_INIT (inev);
+	  inev.kind = TOOLKIT_THEME_CHANGED_EVENT;
+	  inev.arg = [appearance localizedStandardContainsString:@"Dark"]
+	    ? Qdark
+	    : Qlight;
+	  kbd_buffer_store_event (&inev);
+	  ns_send_appdefined (-1);
+      }
+  }
+  /* Any unrecognized key path must belong to super */
+  else {
+    [super observeValueForKeyPath:keyPath
+			 ofObject:object
+			   change:change
+			  context:context];
+  }
+}
+#endif /* (defined NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) */
+
 - (void)antialiasThresholdDidChange:(NSNotification *)notification
 {
 #ifdef NS_IMPL_COCOA
-- 
2.50.1


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 28 Dec 2025 22:32:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 28 17:32:37 2025
Received: from localhost ([127.0.0.1]:34694 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vZzJU-00056F-Vk
	for submit <at> debbugs.gnu.org; Sun, 28 Dec 2025 17:32:37 -0500
Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]:46117)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rudolf@HIDDEN>)
 id 1vZzJR-00055x-W9
 for 80001 <at> debbugs.gnu.org; Sun, 28 Dec 2025 17:32:34 -0500
Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45])
 by mailfout.phl.internal (Postfix) with ESMTP id 5C604EC0194;
 Sun, 28 Dec 2025 17:32:28 -0500 (EST)
Received: from phl-frontend-03 ([10.202.2.162])
 by phl-compute-05.internal (MEProxy); Sun, 28 Dec 2025 17:32:28 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamkovic.org;
 h=cc:cc:content-transfer-encoding:content-type:content-type
 :date:date:from:from:in-reply-to:in-reply-to:message-id
 :mime-version:references:reply-to:subject:subject:to:to; s=fm3;
 t=1766961148; x=1767047548; bh=3nuvCtETUUDqyObWkNj+nTPu10TP7jH5
 DvwJ/1vaL1o=; b=ppfyrLLfAPuiGTBHuTXW4PlJGTjT0xLu0j45RyBnGipDptOE
 /FNVrjZ0+OOy8qXEQ59f2KG/wGsjZXuJSX72e2b60cBsMGDGrXGXfJD4gs/pYspV
 RWAQwQXP1AVFDx0G+DexGaCNHeLdr152Grddi4EqU36pxaoIdXq37O5Sq/8T7OHb
 I2txxw6atC+u9OWNCh1y8BHpmtWgrzHzGlq+RbJ5taIVXhMTNMVoUWP4VxbURgeI
 Wp7O0BOINCYJz3LXQrUcYIeSFDLiiW+lu6RziKUwgiBrxX1U0fQeJi0KpKDo/mlx
 dIFxP7hIqP6LO8h7Log76UD0KXik6qRALg0apQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1766961148; x=
 1767047548; bh=3nuvCtETUUDqyObWkNj+nTPu10TP7jH5DvwJ/1vaL1o=; b=z
 G/+JY/JA6QcNj4cTpD/658AI0p4mG5Ew0yEBUMHDB+qwXuK6mG5ZfK5/QTp+pdde
 AFwlgcKkx6jbnxCXR90DQh/jKrhjmT8dv9gYS0YVRp0OfI24TVl7Zv9vFH2vE6bs
 p6Rben77EH2axc1fjrsYTl8W7CmcAsq+fiDwJ1MmJZlkGBpuOrqmRrlc6uzqhE/w
 OoxA7YHOHSSahC76+C+mkVYuKlI3FGcAsETsf7/ZC22D6+vig07ET1Gchmr8MLHC
 bnDeqCLjK8M8THM1fQFUdg7IOODVjb07aVnDAfNhEw8M8qJSvgduKgH2NBTRsTFY
 7qHpJm+pt5aG6QaFXBQwA==
X-ME-Sender: <xms:-69RaXk-mY1ydwcWehhaBKOuARUvh7vP9R-G5-771cJuaoRDyvD4Ww>
 <xme:-69RaSRHvi-8yUgT-U8g-zusMl9NsbIpVbJqKZWNeHIccEhiWg-Jdtc-I5q_TaTLs
 AIPiTreypcZjcHd5T-08fdq8OEV4fUrqkrPlv4MW9kjJvzw2Xa6QWY>
X-ME-Received: <xmr:-69RabCqnEkapMyIJODc91RcvebTD68UyTM_2cBiTDQIDemNgWNNjxazlBGEHSYtjZO_6aJtQLRQGLOoIHdVr-XpPAqf4rk>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdejheegjecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr
 ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug
 hrpefhvfevufgjfhffkfggtgfgsehtqhertddttdejnecuhfhrohhmpeftuhguohhlfhcu
 tegurghmkhhovhhitgcuoehruhguohhlfhesrggurghmkhhovhhitgdrohhrgheqnecugg
 ftrfgrthhtvghrnhepieeuteehffdugffhgeegveehvedvtdekffelhfeuledugfetgfff
 ledthfdujeegnecuffhomhgrihhnpegruggrmhhkohhvihgtrdhorhhgnecuvehluhhsth
 gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhhuugholhhfsegruggr
 mhhkohhvihgtrdhorhhgpdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuth
 dprhgtphhtthhopeektddttdduseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthht
 ohepshhhihhpmhhinhhtshesghhmrghilhdrtghomhdprhgtphhtthhopegrlhgvgigrnh
 guvghrrdgrugholhhfsegtohhnughithhiohhnqdgrlhhphhgrrdgtohhm
X-ME-Proxy: <xmx:-69RaZRQGfwxw_xS-IJKOibkDTh9-YJ82114X5vwNi1_f-0F4Bcfvw>
 <xmx:-69RaZrC_R_VX0nqNl0Z2Hdufdwp3MRvkkkauL640wW2evZ_yo6Qxg>
 <xmx:-69Raby4a5jCcpBIuPxZJAxCAZ72eCriAcVEnlWF_ShCwIWDwxtSow>
 <xmx:-69RaeKZ-XAJs_A5wkBlT4_KBRWI4iY80I2ltAuEEle9Wc4d67UM9g>
 <xmx:_K9RaT_wR_WMFsy7YddZD_ZQBFbCPxXDaA_bO6rsxpX7wnxLk7VKutAM>
Feedback-ID: i88214938:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun,
 28 Dec 2025 17:32:27 -0500 (EST)
From: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>
To: Alexander Adolf <alexander.adolf@HIDDEN>, =?utf-8?Q?St?=
 =?utf-8?Q?=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
In-Reply-To: <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
 <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
Date: Sun, 28 Dec 2025 23:32:25 +0100
Message-ID: <m27bu6teyu.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Alexander Adolf <alexander.adolf@HIDDEN> writes:

> [...] each view might have individual resources (and/or be in a
> different state) and might want to react differently to an appearance
> change. I guess that could have been why Apple put the appearance
> callback on NSView, but not on NSApplication?

Exactly!  In a "normal" object-oriented code, which Emacs is not, each
view (e.g. button, switch, etc.) is responsible for its own drawing and
so its appearance, so it makes perfect sense.

> Let's allow a couple of more days for Rudy to respond amidst all the
> holidays going on in some places these days.

Okay, so if `viewDidChangeEffectiveAppearance' is out, our options are
limited.  NSDistributedNotificationCenter posts a notification, but not
a public one.  With that, KVO it is. :)

I wrote the example below, compiled it with Xcode, and works well.  But
beware!  AppKit can call the observer multiple times.  On my system, the
observer is called *twice* per appearance change. Hence, the BOOL
property, to make sure we are not doing useless work.

--8<-------------------------------------------------------->8--

#import "AppDelegate.h"

@interface AppDelegate ()

@property (nonatomic) BOOL isDark;

@end

@implementation AppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)notification {
    if (@available(macOS 10.14, *)) {
        [NSApp addObserver:self
                forKeyPath:@"effectiveAppearance"
                   options:0
                   context:NULL];
    }
}

- (void)observeValueForKeyPath:(NSString *)keyPath
                      ofObject:(id)object
                        change:(NSDictionary<NSKeyValueChangeKey,id> *)chan=
ge
                       context:(void *)context {
    if ([keyPath isEqualToString:@"effectiveAppearance"]) {
        NSAppearance *appearance =3D [NSApp effectiveAppearance];
        NSArray *names =3D [NSArray arrayWithObjects:NSAppearanceNameAqua, =
NSAppearanceNameDarkAqua, nil];
        NSString *name =3D [appearance bestMatchFromAppearancesWithNames:na=
mes];
        if (!name) return; // Ignore transitional appearances.
        BOOL isDark =3D [name isEqualToString:NSAppearanceNameDarkAqua];
        if (isDark !=3D self.isDark) {
            NSLog(@"Appearance: %d", isDark);
            self.isDark =3D isDark;
        }
    }
}

@end

--8<-------------------------------------------------------->8--

Rudy
--=20
"If you're thinking without writing, you only think you're thinking."

--- Leslie Lamport

Rudolf Adamkovi=C4=8D <rudolf@HIDDEN> [he/him]
http://adamkovic.org




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 27 Dec 2025 19:20:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 27 14:20:42 2025
Received: from localhost ([127.0.0.1]:57118 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vZZqD-00014S-V1
	for submit <at> debbugs.gnu.org; Sat, 27 Dec 2025 14:20:42 -0500
Received: from www191.your-server.de ([188.40.2.11]:56950)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vZZqA-000148-Pu
 for 80001 <at> debbugs.gnu.org; Sat, 27 Dec 2025 14:20:39 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=condition-alpha.com; s=default2503; h=Content-Transfer-Encoding:
 Content-Type:MIME-Version:Date:In-reply-to:References:Subject:Cc:To:From:
 Message-Id:Sender:Reply-To:Content-ID:Content-Description:Resent-Date:
 Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
 bh=C5F3AMmblJ9DYrkdnyYOUV6zVu8KNyhLndFjqVFaAxI=; b=jsplTTsD4x+zlF690iEwfP9caK
 F86mnNZEQRCzdGlrs/UH9VQyUUCY2cyoOuxojpsRyShnRz1HXPak0Wlu9VZo5LumHMXusmQXhV7ur
 ZUqQ6Q4n6msUCYunkW5UYAXgcbbtpyffdvHX8362SnHN11Lje71PqkGztwG9vrEJcpztuXYT4iTj9
 duuaN9d+fIMfaA8FGofvKURgydrFL3c08uaPoC+FrwF2Rs4ReSck54V5zySPh78RK2u1BnioWMj75
 pMb8NiNKwKYeOWMB3WsPYrpuSWJuqBADihgl3xj9Gf2sMfStt3L7c3KfVYuRRRRLHdWGzXzrcZ1x5
 F2guF6Lg==;
Received: from sslproxy07.your-server.de ([78.47.199.104])
 by www191.your-server.de with esmtpsa  (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96.2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vZZq3-00028B-25; Sat, 27 Dec 2025 20:20:31 +0100
Received: from localhost ([127.0.0.1])
 by sslproxy07.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vZZq2-0003PK-24; Sat, 27 Dec 2025 20:20:31 +0100
Message-Id: <e082d50a5b6c95521329371bcfa9cc50@HIDDEN>
From: Alexander Adolf <alexander.adolf@HIDDEN>
To: =?utf-8?Q?St=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
 <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
In-reply-to: <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
Date: Sat, 27 Dec 2025 20:20:30 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: Clear (ClamAV 1.0.9/27862/Sat Dec 27 08:25:41 2025)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

St=C3=A9phane Marks <shipmints@HIDDEN> writes:

> [...]
> Processing a single event for the entire running Emacs process seems
> superior to processing an event per window.
> [...]

I fully concur. I did also read Rudy's comments to imply this.

Let's allow a couple of more days for Rudy to respond amidst all the
holidays going on in some places these days.


Cheers,

  --alexander




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 25 Dec 2025 17:09:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 25 12:09:51 2025
Received: from localhost ([127.0.0.1]:42053 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vYoqU-0001m9-TQ
	for submit <at> debbugs.gnu.org; Thu, 25 Dec 2025 12:09:51 -0500
Received: from mail-vs1-xe33.google.com ([2607:f8b0:4864:20::e33]:42475)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vYoqR-0001le-S7
 for 80001 <at> debbugs.gnu.org; Thu, 25 Dec 2025 12:09:48 -0500
Received: by mail-vs1-xe33.google.com with SMTP id
 ada2fe7eead31-5dbd8bb36fcso5442807137.1
 for <80001 <at> debbugs.gnu.org>; Thu, 25 Dec 2025 09:09:47 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1766682582; x=1767287382; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=JHPfipQshGJAMltJCXgXqAXufVOCfwAhNFYYqqTfEPE=;
 b=GBLPhKf53cSxUNS/yin/6ReD4MBCbVcBzyTivQ4T8KZbfMLQCIqO6YjrxxuC9A2k4h
 8xY+hxLoSE+WhqIA/8F8hvfPUZFaSqIy8fXSrwa6kQ/tIefMi6VrjR9uJjodh24J99AB
 /MsBMcam7uLNmGaepejoTaBk17Xfq5tJUR98U+TwOmPy03czMqhQP4FzHqEc07V49tHH
 3EEdQcPMlATVmX0uBQr6xMeSABdjG+W+HlhBIhN01+3XLquo8r//1rqXBV4DrK4aXT61
 87y/RLfhBWO/Lgb0I47S7nX/cS8Wjt/p6gScwA07bS1lyppffDeEl7a6d0ctEy2mwkSm
 fb6w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1766682582; x=1767287382;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=JHPfipQshGJAMltJCXgXqAXufVOCfwAhNFYYqqTfEPE=;
 b=dK8iKx5o53tQUqHwLoU2DXx+ySCiV3ivl6znNZKFnpla0o4hec8sbkBUM5OR2V0AvI
 3m59D51lyb15BJdv1mbU145dSUmrqZ4egi/Iv9WR4DHb+v5sXfQa8VaLG/MRLNRgh7ac
 xEWzxUfR5PVlg7+VKVVy9h7tc48Pd/1HQ7d3oDtYlIIxyOKA0nnInsa2RABNUkGCmmlq
 Ea163O/kYYbPh4Q/KXB06sNCH6SVeGchoJj9ziqFigpI58eIP8/scXmojud8KK8a8nak
 936xkMqNQTBOivESjwxGVVH0lr/zpPLdPQj/O4N7wWK3+0DeMZ2m0m0bLXellofLKc/r
 DyFg==
X-Forwarded-Encrypted: i=1;
 AJvYcCU0Ixk2HYo2m9kvIa+FFYYe4a/wsnWWXW+6zujoS6gh/FMLkHtBUVUFaB6vPgLEdgCUc3lDgQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzU8Hys+qE5UFv+HpxZRIOZV1p8Iy8qIF1dzsAZ+ZKptXx1f5f6
 CuujSvr+XMEhKfZFebD7U/zzT97jr+4Sk3WHXhGxAxkldbsXDfRFsbTe0R2LkUZFBgEVW7vzi+1
 sfcIXeoyx+BOwGLs9DbKS2bDFfAKhriHj2A==
X-Gm-Gg: AY/fxX5D5Cmd1uXyI8S1HqnRkf4Cy7c1h4K70ZWJpgy1mud8oHte6jH4MvsmFs1xkaI
 +cZzm+f/e5vF84dL4gEaQ6cmPZd9RtA4YuPkgBhRV6y3LHpTp/SgIoNUOkgqxZ2t51f+FI+ZSaO
 KtHbDQP8ObOZbNTWZgDukd3O77iPuj2nZb/Y5rWumQ7LRND2GcY9J+q9jntHDEcvjn/Ari7YMh/
 TIQnGpmenaYmTuVBtLj+FRCmMyNvuHIOWFwNGMlDCz+k6Urx5KWnZVGXtFcEvDWZF4Z/SBKIp6G
 zEqo3A==
X-Google-Smtp-Source: AGHT+IFokJWZEXnyDaXUN2u/QwWePfaTOyQBb62BU8C05vFIDm0gjiQbB1yJQ/3M7vXAX1IBr6oYNwcoudHI3W9wzLY=
X-Received: by 2002:a05:6102:1608:b0:5df:d4c5:15ee with SMTP id
 ada2fe7eead31-5eb023cb2c8mr8537550137.9.1766682582079; Thu, 25 Dec 2025
 09:09:42 -0800 (PST)
MIME-Version: 1.0
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
 <25a2a975370de57e22e6492f8162313d@HIDDEN>
In-Reply-To: <25a2a975370de57e22e6492f8162313d@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Thu, 25 Dec 2025 12:09:30 -0500
X-Gm-Features: AQt7F2pxF5y2zv4_PGHSnjYolzQHco5rtB4wxuGCFrsRm0FwsG9NF9ez22Y_tTs
Message-ID: <CAN+1HbqWyB_YQawKVBjetn-7q7DjSWR-EEzbVs00XBUEvwiktg@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
To: Alexander Adolf <alexander.adolf@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000bc5e560646c9d74e"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: =?UTF-8?Q?Rudolf_Adamkovi=C4=8D?= <rudolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000bc5e560646c9d74e
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Thu, Dec 25, 2025 at 11:27=E2=80=AFAM Alexander Adolf <
alexander.adolf@HIDDEN> wrote:

> St=C3=A9phane Marks <shipmints@HIDDEN> writes:
>
> > [...]
> > Perhaps use the KVO callback indicating that appearance changed as a
> > semaphore to query NSApp effectiveAppearance and then process the
> results?
>
> St=C3=A9phane, you seem to be going great lengths to suggest a somewhat
> specific solution you appear to be having in mind?
>
> What is it you are trying to suggest, and what are you trying to achieve
> with it? Where are its technical advantages?
>
> Apologies for asking dumb questions; just showing off my lack of
> understanding of what you are trying to get at here.
>

Processing a single event for the entire running Emacs process seems
superior to processing an event per window.  My cursory reading of the
Chromium implementation is that they do similar: wait for the notification
of theme change, probe the theme, change the Chromium theme, if necessary.

--000000000000bc5e560646c9d74e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Thu, Dec 25, 2025 at 11:27=E2=80=AFAM Alexander Adolf &lt;<a href=3D"mai=
lto:alexander.adolf@HIDDEN">alexander.adolf@HIDDEN=
m</a>&gt; wrote:</span></div></div><div class=3D"gmail_quote gmail_quote_co=
ntainer"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e=
x;border-left:1px solid rgb(204,204,204);padding-left:1ex">St=C3=A9phane Ma=
rks &lt;<a href=3D"mailto:shipmints@HIDDEN" target=3D"_blank">shipmints@=
gmail.com</a>&gt; writes:<br>
<br>
&gt; [...]<br>
&gt; Perhaps use the KVO callback indicating that appearance changed as a<b=
r>
&gt; semaphore to query NSApp effectiveAppearance and then process the resu=
lts?<br>
<br>
St=C3=A9phane, you seem to be going great lengths to suggest a somewhat<br>
specific solution you appear to be having in mind?<br>
<br>
What is it you are trying to suggest, and what are you trying to achieve<br=
>
with it? Where are its technical advantages?<br>
<br>
Apologies for asking dumb questions; just showing off my lack of<br>
understanding of what you are trying to get at here.<br></blockquote><div><=
br></div><div class=3D"gmail_default" style=3D"font-family:monospace">Proce=
ssing a single event for the entire running Emacs process seems superior to=
 processing an event per window.=C2=A0 My cursory reading of the Chromium i=
mplementation is that they do similar: wait for the notification of theme c=
hange, probe the theme, change the=C2=A0Chromium theme,=C2=A0if necessary.<=
/div></div></div>

--000000000000bc5e560646c9d74e--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 25 Dec 2025 16:27:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 25 11:27:14 2025
Received: from localhost ([127.0.0.1]:41912 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vYoBG-00089x-0E
	for submit <at> debbugs.gnu.org; Thu, 25 Dec 2025 11:27:14 -0500
Received: from www191.your-server.de ([188.40.2.11]:38144)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vYoBC-00089g-OX
 for 80001 <at> debbugs.gnu.org; Thu, 25 Dec 2025 11:27:11 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=condition-alpha.com; s=default2503; h=Content-Transfer-Encoding:
 Content-Type:MIME-Version:Date:In-reply-to:References:Subject:Cc:To:From:
 Message-Id:Sender:Reply-To:Content-ID:Content-Description:Resent-Date:
 Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
 bh=18d7sKTV8Kme36HVkTIf3PDmkf2xeSfHxWeGVjTIlmk=; b=ivok+Ce+JbYa7wL1G+f35R6Wv5
 RL2r1Ds69+dJauiaDnjX1ndPQtILv34BQvJ+6//HHQw+RTYZ8RbEuxffFBF3CfKmMbVsfLcXGnk2T
 VYmp/7ZXEIT46xc+4A8SK/x/INW/f2dOO86CaxxBWfEOJ6saXU3RLfd3AtZqtooVvrAwq/1utyccu
 XzQVY0OJ1WObc5UEIrDW/Y+86D7B+5TCa5kz5D8xVOO+XaWpkXVkgFvxDJfe+PaQtIPhLdoFfbh59
 xZmQVCgutHwO+lM2EQJ1CT4638XQI6cts0DiKDt1cUsdTdpzqdhY+AkL+Hgf808BTCpjkBCMRX56F
 RhlYwfEA==;
Received: from sslproxy02.your-server.de ([78.47.166.47])
 by www191.your-server.de with esmtpsa  (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96.2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vYoB6-000AJq-04; Thu, 25 Dec 2025 17:27:04 +0100
Received: from localhost ([127.0.0.1])
 by sslproxy02.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vYoB5-000Pfz-0u; Thu, 25 Dec 2025 17:27:03 +0100
Message-Id: <25a2a975370de57e22e6492f8162313d@HIDDEN>
From: Alexander Adolf <alexander.adolf@HIDDEN>
To: =?utf-8?Q?St=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
 <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
In-reply-to: <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
Date: Thu, 25 Dec 2025 17:27:03 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: Clear (ClamAV 1.0.9/27860/Wed Dec 24 08:25:36 2025)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

St=C3=A9phane Marks <shipmints@HIDDEN> writes:

> [...]
> Perhaps use the KVO callback indicating that appearance changed as a
> semaphore to query NSApp effectiveAppearance and then process the results?

St=C3=A9phane, you seem to be going great lengths to suggest a somewhat
specific solution you appear to be having in mind?

What is it you are trying to suggest, and what are you trying to achieve
with it? Where are its technical advantages?

Apologies for asking dumb questions; just showing off my lack of
understanding of what you are trying to get at here.


Many thanks in advance for your clarifications and cheers,

  --alexander




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 23 Dec 2025 19:17:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 23 14:17:40 2025
Received: from localhost ([127.0.0.1]:58767 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vY7t5-00026b-Pg
	for submit <at> debbugs.gnu.org; Tue, 23 Dec 2025 14:17:40 -0500
Received: from mail-vs1-xe2d.google.com ([2607:f8b0:4864:20::e2d]:53482)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vY7t3-00026J-4S
 for 80001 <at> debbugs.gnu.org; Tue, 23 Dec 2025 14:17:37 -0500
Received: by mail-vs1-xe2d.google.com with SMTP id
 ada2fe7eead31-5eae7bb8018so2025182137.2
 for <80001 <at> debbugs.gnu.org>; Tue, 23 Dec 2025 11:17:37 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1766517451; x=1767122251; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=RCyeO9pqhzPqhrSlo2dynnh0ydQMXX1ZpjFGxmbZDDM=;
 b=LB7yhB4EhmoNsvUt4/mIWUaLSpTUviWTAqOV2J8weVpLSqYYTHNU7eREdxvGL6OvE4
 /n9fadj/RUWDCk56zC6Dw6rplCDq33vID2xrfYfY5/Pgo2s1EkkejuXNJkJocRd4ZVx+
 UitFKZ1O4O+4qZmlwBn85ef0Yrec09nkPmRiD/ubiJn+YIGW9Ev3T7e/c+VEi8XSUvFu
 bnJ/Bs4mZvUhB6D5Z0XYf18SIRN6sqy/WrWxQ8c/fMDYFU52PszjFqYIxP/coyiT3s7o
 3Nf+uO6yea1Fa5R8+PkNa6AlRygOH1l0xcst/HiZSQltwhhm0gcHEqL1TWkftYx7IUax
 wL2Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1766517451; x=1767122251;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=RCyeO9pqhzPqhrSlo2dynnh0ydQMXX1ZpjFGxmbZDDM=;
 b=RjfhQJt8D1dKPJ6D3mXUset3Gh11bj1aSjdWxxkbmbSyUxeXE7SnzPxkHUorC/SUKb
 Vrvut/LEC+OGlpMFR9g2NpLKPgYrt4CGIvtgon6i5dQt0ePR5pCJPLaXyMz2frN3i7/F
 IMKCHfg6f4vFT6fhXs06B1OarZr9KZ96qf02BItRVGSomXiK4EeNTbYtU5KFy0sd2HL8
 N1AjytshY08nJgZj9MnzDUlDrTS7937ALT17mIMlrIKYfpoYtlVrTap7YRrbFOyzjysA
 N5iDtGKlu/MJ0TmFZiNOetuMs/S9GHUK/Jizg+4bc/pm6YlqmU1ix9i0y7j7yscVN+IT
 Ydyg==
X-Forwarded-Encrypted: i=1;
 AJvYcCUXWTrkX9eFThq3waFtYOXlj3jCmCs1CKcD0xZWexvmMScpbCSkK4BcA2uBkcXQPDi76DgEGA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwujAhKp36iH/kN9CM78u8y3Fmqq0NK5tQKPIPnyilrEApb3lke
 dFazU2H6eId2dSeBprtruK8OXieTG8AWQrbF0qgpzU+xFhoDakLfkNEUBKKRzWr3T34dtvCxFOl
 nlHSw91DmPQhxsxxX+ncXbgSUVnSFk1E3ww==
X-Gm-Gg: AY/fxX5rPwd+HtOK//OOpxvr3CCMu2omXPnMOIMhgFLXM3JAiTk/vP08DBPTThdq/Nq
 muhxt/uTtS8veGDmywXrENFkTekYpzBa6+3EPOmQ4TEC+PauWs0DJQLapIZ709gNmN8oxic/1Ki
 +5kpA9hOV66szuefoCucaaww0N8Wq6z0lZbwqCTHHlZf+HIcLoLa7wEoQFDaZIVstia45NP2Oz1
 gViAtCF3ruV793jbBjRvoJQzs4K7suLnjTGV/T0g8icDr3R416NxI8oIaUnTa0+vB+TU0frY5fY
 YoMUwg==
X-Google-Smtp-Source: AGHT+IE9elTZbGS/3TCQr560qoc0+AvR4iD+7auTSSBEFr6fYt0z7odABEgi19pqLyVolGDfZ/Un/eWzhkYGtZqm2Dw=
X-Received: by 2002:a05:6102:3f93:b0:5df:a069:4f79 with SMTP id
 ada2fe7eead31-5eb1a7d19a6mr4943868137.20.1766517451354; Tue, 23 Dec 2025
 11:17:31 -0800 (PST)
MIME-Version: 1.0
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
 <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
In-Reply-To: <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Tue, 23 Dec 2025 14:17:19 -0500
X-Gm-Features: AQt7F2pkHnoih9-5lL8sxmO2Z9_h0chJkB4U2_bQwE30QVDA2RGWdB8niCjBtXM
Message-ID: <CAN+1HbpmtMvs4BA6A=kudG3OYK=R7a0a=wudzzQRjH_RbQra0w@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
To: Alexander Adolf <alexander.adolf@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000002d74e40646a3650f"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: =?UTF-8?Q?Rudolf_Adamkovi=C4=8D?= <rudolf@HIDDEN>,
 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--0000000000002d74e40646a3650f
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, Dec 23, 2025 at 11:22=E2=80=AFAM Alexander Adolf <
alexander.adolf@HIDDEN> wrote:

> Hello Rudy,
>
> Rudolf Adamkovi=C4=8D <rudolf@HIDDEN> writes:
>
> > [...]
> > Thank you for working on this, Alexander!
>
> Thanks for chiming in, and for sharing your experience!
>
> > Me, I am familiar with Apple APIs but not with Emacs NS port, so I woul=
d
> > like to ask about the following.  If EmacsView is not a singleton,
>
> It is not.
>
> > then each EmacsView will be called by Cocoa, creating multiple Emacs
> > events. Should it not always be a single event?
>
> You are right in that the callback method is called on each NSView, that
> is once per Emacs buffer window.
>
> I concur with your view that editorially speaking, it's a single event.
> And for the purpose we are looking at (toolkit-theme-set-functions), it
> should be a single one only.
>
> OTOH, I can see that technically, each view might have individual
> resources (and/or be in a different state) and might want to react
> differently to an appearance change. I guess that could have been why
> Apple put the appearance callback on NSView, but not on NSApplication?
>
> But speculations aside.
>
> I experimented a little more with the KVO implementation. As I
> previously discovered, [[NSApp effectiveAppearance] name] does not
> return something matching the current appearance inside the
> observeValueForKeyPath method; it rather always returns one and the same
> appearance name.
>

Perhaps use the KVO callback indicating that appearance changed as a
semaphore to query NSApp effectiveAppearance and then process the results?

--0000000000002d74e40646a3650f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Tue, Dec 23, 2025 at 11:22=E2=80=AFAM Alexander Adolf &lt;<a href=3D"mai=
lto:alexander.adolf@HIDDEN">alexander.adolf@HIDDEN=
m</a>&gt; wrote:</span></div></div><div class=3D"gmail_quote gmail_quote_co=
ntainer"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e=
x;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello Rudy,<br>
<br>
Rudolf Adamkovi=C4=8D &lt;<a href=3D"mailto:rudolf@HIDDEN" target=3D=
"_blank">rudolf@HIDDEN</a>&gt; writes:<br>
<br>
&gt; [...]<br>
&gt; Thank you for working on this, Alexander!<br>
<br>
Thanks for chiming in, and for sharing your experience!<br>
<br>
&gt; Me, I am familiar with Apple APIs but not with Emacs NS port, so I wou=
ld<br>
&gt; like to ask about the following.=C2=A0 If EmacsView is not a singleton=
,<br>
<br>
It is not.<br>
<br>
&gt; then each EmacsView will be called by Cocoa, creating multiple Emacs<b=
r>
&gt; events. Should it not always be a single event?<br>
<br>
You are right in that the callback method is called on each NSView, that<br=
>
is once per Emacs buffer window.<br>
<br>
I concur with your view that editorially speaking, it&#39;s a single event.=
<br>
And for the purpose we are looking at (toolkit-theme-set-functions), it<br>
should be a single one only.<br>
<br>
OTOH, I can see that technically, each view might have individual<br>
resources (and/or be in a different state) and might want to react<br>
differently to an appearance change. I guess that could have been why<br>
Apple put the appearance callback on NSView, but not on NSApplication?<br>
<br>
But speculations aside.<br>
<br>
I experimented a little more with the KVO implementation. As I<br>
previously discovered, [[NSApp effectiveAppearance] name] does not<br>
return something matching the current appearance inside the<br>
observeValueForKeyPath method; it rather always returns one and the same<br=
>
appearance name.<br></blockquote><div><br></div><div><div class=3D"gmail_de=
fault" style=3D"font-family:monospace">Perhaps use the KVO callback indicat=
ing that appearance changed as a semaphore to query NSApp effectiveAppearan=
ce and then process the results?</div></div></div></div>

--0000000000002d74e40646a3650f--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 23 Dec 2025 16:22:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 23 11:22:36 2025
Received: from localhost ([127.0.0.1]:57546 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vY59f-00005n-Tv
	for submit <at> debbugs.gnu.org; Tue, 23 Dec 2025 11:22:36 -0500
Received: from www191.your-server.de ([188.40.2.11]:53526)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vY59c-00005H-Tj
 for 80001 <at> debbugs.gnu.org; Tue, 23 Dec 2025 11:22:34 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=condition-alpha.com; s=default2503; h=Content-Transfer-Encoding:
 Content-Type:MIME-Version:Date:In-reply-to:References:Subject:Cc:To:From:
 Message-Id:Sender:Reply-To:Content-ID:Content-Description:Resent-Date:
 Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
 bh=1wL08meUABSEf/wdxrRT0myjV998L0Y21TIodZtw+xQ=; b=qOPjSpLkMeIucHewobkIcfsHcn
 GRGjjnYnAxhXeE3Xg6nw9gHJMZS9OKv4vihpvbEZBAaw/al3HrMrmF1BaYgsQEDuO7DJQ6Z9GQy2o
 94PNYik+nsE3p4Jh+uE89qJFyjzZSo6h6lJnC3SylEopmOWBzI7pIA2dOD8iwPUsyI8BUYJUwbY2W
 4EUdIfVKvw/FfE1pMGtsrczHCaDGqyNeX6F17QInLh4aQY4636zD58MwAipOD2N+FkYiAsJxvN9Q1
 aBtAjQSnwQR3Eyk6LyvM4Ke3eEjpmvw3un6VdPuDv+sHnWrfFd0C0BzxHh+754O3if2I9RyJwCz4u
 mQZR5ZOw==;
Received: from sslproxy07.your-server.de ([78.47.199.104])
 by www191.your-server.de with esmtpsa  (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96.2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vY59W-0002k0-1J; Tue, 23 Dec 2025 17:22:26 +0100
Received: from localhost ([127.0.0.1])
 by sslproxy07.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vY59V-000EVa-1F; Tue, 23 Dec 2025 17:22:26 +0100
Message-Id: <f3347438878e4d7c8b9ecbf23243a6d8@HIDDEN>
From: Alexander Adolf <alexander.adolf@HIDDEN>
To: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>, =?utf-8?Q?St?=
 =?utf-8?Q?=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <m2tsxo92rj.fsf@HIDDEN>
In-reply-to: <m2tsxo92rj.fsf@HIDDEN>
Date: Tue, 23 Dec 2025 17:22:25 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: Clear (ClamAV 1.0.9/27859/Tue Dec 23 08:25:59 2025)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello Rudy,

Rudolf Adamkovi=C4=8D <rudolf@HIDDEN> writes:

> [...]
> Thank you for working on this, Alexander!

Thanks for chiming in, and for sharing your experience!

> Me, I am familiar with Apple APIs but not with Emacs NS port, so I would
> like to ask about the following.  If EmacsView is not a singleton,

It is not.

> then each EmacsView will be called by Cocoa, creating multiple Emacs
> events. Should it not always be a single event?

You are right in that the callback method is called on each NSView, that
is once per Emacs buffer window.

I concur with your view that editorially speaking, it's a single event.
And for the purpose we are looking at (toolkit-theme-set-functions), it
should be a single one only.

OTOH, I can see that technically, each view might have individual
resources (and/or be in a different state) and might want to react
differently to an appearance change. I guess that could have been why
Apple put the appearance callback on NSView, but not on NSApplication?

But speculations aside.

I experimented a little more with the KVO implementation. As I
previously discovered, [[NSApp effectiveAppearance] name] does not
return something matching the current appearance inside the
observeValueForKeyPath method; it rather always returns one and the same
appearance name.

The object parameter to observeValueForKeyPath OTOH does contain an
instance of type NSSystemAppearanceProxy when the appearance changes.
This does sound promising, but is not documented as a class. I tried
both, [[object effectiveAppearance] name], and [[object appearance]
name] in the observeValueForKeyPath method. Results were consistently
reflecting the current appearance. That said, despite
NSSystemAppearanceProxy being undocumented, this could be a way of
generating a single event for an appearance change only.

Another way could be to add a global variable storing the last effectice
appearance, and have the viewDidChangeEffectiveAppearance callback fire
an Emacs event only if the appearance actually changed. That would allow
for the callback to be called on each view, but send out an Emacs event
from the first one only. OTOH, global variables are nothing I would
lightheartedly be suggesting.

What's your take?


> P.S. You probably want to update the docstring for the `toolkit-theme'
> variable as well, because it currently states: "This variable is only
> set on PGTK, Android, and MS-Windows builds."
> [...]

Well spotted! Consider it fixed.


Many thanks and looking forward to your thoughts,

  --alexander




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 17 Dec 2025 22:12:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 17 17:12:28 2025
Received: from localhost ([127.0.0.1]:46854 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vVzky-0000ic-5w
	for submit <at> debbugs.gnu.org; Wed, 17 Dec 2025 17:12:28 -0500
Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]:50613)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rudolf@HIDDEN>)
 id 1vVzkv-0000i7-L2
 for 80001 <at> debbugs.gnu.org; Wed, 17 Dec 2025 17:12:26 -0500
Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51])
 by mailfout.phl.internal (Postfix) with ESMTP id 4ABE0EC00D2;
 Wed, 17 Dec 2025 17:12:20 -0500 (EST)
Received: from phl-frontend-04 ([10.202.2.163])
 by phl-compute-11.internal (MEProxy); Wed, 17 Dec 2025 17:12:20 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamkovic.org;
 h=cc:cc:content-transfer-encoding:content-type:content-type
 :date:date:from:from:in-reply-to:in-reply-to:message-id
 :mime-version:references:reply-to:subject:subject:to:to; s=fm2;
 t=1766009540; x=1766095940; bh=m90K4p+kAjqivzzk/mFMPeTKercDYbpS
 bMxZO6Aypno=; b=DibaPegqBWIBSjRnZtJ0yCv4fgZuouN1V/2cJXUmSnmP7Oam
 ZojAzwaFUyeDTKEPeiK/F00mkBq2uuKz4Fi98FeWHmFq5H7UJryl4kNrZvLdo1AQ
 JAj8O9v4P3DuvxjApFwXxRPyIo2o6PAvY425R5LX/B3/YC1cGk4LfejoLyOzf8yy
 q5qGyELW5C5m0GM60vea5B0mnG4q8jRTDjmsvK304at5UAUpzCSD+9d1G6S5dqVK
 A0AAvtDkvk1IGPHcUithr1oXuNzWtr1FfjHzjqskw8rM74umrIG1sgM9wGAhdysx
 tacDHndXekklfIzVUyJgSB1h1lBeNUpFFzW6Yg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1766009540; x=
 1766095940; bh=m90K4p+kAjqivzzk/mFMPeTKercDYbpSbMxZO6Aypno=; b=c
 M1Lq1ZeNJO86T1E6eAKOISTcLB8YXpkTHBKo4z74fuXxNQjYrpYMU5uYFvR7cqP6
 Z306gqQ5nUzMPP+BoktEsfWrGSvw6GV/fOP7AXZyYl1BJ7cjObRgSSo4dHnaMMiX
 3ms+A75EYnHDRPs1E14A33aDFMPCnutSIWBWCark4Kas4MWa3he/IpRnwuOvHLjw
 zhhYXNDmpqNF+dVzokMmFC6VClaiuQf6ZmpGRilDBCQFIVDrBWE0I5Y/X6jdSHoE
 uyq/XD6b2pTFWTpSEZugukhN9rjSHWU8ygKAYn0QWB2eNcRGCbKZwxWro83Su2kh
 rmHI6LaZ2sS8uUcrE9F+g==
X-ME-Sender: <xms:wypDaW_m7ax8ecJxo4GP6G90JXUIZItvvnBdjnhO8vfFL8Gh8L3ICQ>
 <xme:wypDaeLOeMDVVe-PkQvKtAtVVNEIOlIjVRbCfQWASTC5zBamKTlF96pqjomv4buAE
 G9D95nbXylcqsYqMaRzu3Ix3fC5xSzI4rvkZnzMK4aUQhGxJxrISQ>
X-ME-Received: <xmr:wypDaZYqJWY6Yrpj_-I79K2mNw46RpTWmLBMuGUa25DWgbMdZ-sXUY8mvGyPWvhJfdN_uerXxWslOR9KY0OMt3djTPuvL-w>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdegfeejfecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr
 ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug
 hrpefhvfevufgjfhffkfggtgfgsehtqhertddttdejnecuhfhrohhmpeftuhguohhlfhcu
 tegurghmkhhovhhitgcuoehruhguohhlfhesrggurghmkhhovhhitgdrohhrgheqnecugg
 ftrfgrthhtvghrnhepieeuteehffdugffhgeegveehvedvtdekffelhfeuledugfetgfff
 ledthfdujeegnecuffhomhgrihhnpegruggrmhhkohhvihgtrdhorhhgnecuvehluhhsth
 gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhhuugholhhfsegruggr
 mhhkohhvihgtrdhorhhgpdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuth
 dprhgtphhtthhopeektddttdduseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthht
 ohepshhhihhpmhhinhhtshesghhmrghilhdrtghomhdprhgtphhtthhopegrlhgvgigrnh
 guvghrrdgrugholhhfsegtohhnughithhiohhnqdgrlhhphhgrrdgtohhm
X-ME-Proxy: <xmx:wypDaYJpKCGHWwiZlwjbceRxnJg8FwIdnTBXHDSkoaIk0o4s9drT1w>
 <xmx:wypDafAzOdcs1H-RDmBPwDegp-2t-qWP7uOEAhP6-BYdkoL2Smu0Mw>
 <xmx:wypDaVo-1hNeForMj0XYmq8VkrJfQKX1qkTwRmJ0NHA5Hn_hzdmXoA>
 <xmx:wypDaShyCOMvWZdDegnU407v42zu-RaEMFhzUBMEykGIB6XleJMg1w>
 <xmx:xCpDaaPizYIbYQqiGR4yCqc4fA9KzWf2p3KmBSGULM2iVX_VNVN8mM4z>
Feedback-ID: i88214938:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed,
 17 Dec 2025 17:12:19 -0500 (EST)
From: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>
To: Alexander Adolf <alexander.adolf@HIDDEN>, =?utf-8?Q?St?=
 =?utf-8?Q?=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
In-Reply-To: <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
Date: Wed, 17 Dec 2025 23:12:16 +0100
Message-ID: <m2tsxo92rj.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Alexander Adolf via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

> St=C3=A9phane Marks <shipmints@HIDDEN> writes:
>
>> [...]
>> I think you'd add an observer to the effectiveAppearance property via the
>> notification center.

To St=C3=A9phane:

NotificationCenter is orthogonal to KVO on NSObject, and the kind of
override Alexander is suggesting is 100% idiomatic and preferred over
KVO.  I say this not as "Google search result" but as someone who has
been programming professionally for Apple OSes for ~15 years.

> Thus, my conclusion is that my initial patch is the only approach
> which works reliably for me.

Thank you for working on this, Alexander!

Me, I am familiar with Apple APIs but not with Emacs NS port, so I would
like to ask about the following.  If EmacsView is not a singleton, then
each EmacsView will be called by Cocoa, creating multiple Emacs events.
Should it not always be a single event?

P.S. You probably want to update the docstring for the `toolkit-theme'
variable as well, because it currently states: "This variable is only
set on PGTK, Android, and MS-Windows builds."

Rudy
--=20
"All of humanity's problems stem from man's inability to sit quietly in
a room alone."

--- Blaise Pascal, Pens=C3=A9es, 1670

Rudolf Adamkovi=C4=8D <rudolf@HIDDEN> [he/him]
http://adamkovic.org




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 17 Dec 2025 00:05:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 16 19:05:09 2025
Received: from localhost ([127.0.0.1]:33386 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vVf2S-0007G5-IK
	for submit <at> debbugs.gnu.org; Tue, 16 Dec 2025 19:05:09 -0500
Received: from mail-vs1-xe32.google.com ([2607:f8b0:4864:20::e32]:59469)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vVf2P-0007DM-PV
 for 80001 <at> debbugs.gnu.org; Tue, 16 Dec 2025 19:05:07 -0500
Received: by mail-vs1-xe32.google.com with SMTP id
 ada2fe7eead31-5e5697a2cfcso1814341137.2
 for <80001 <at> debbugs.gnu.org>; Tue, 16 Dec 2025 16:05:05 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1765929900; x=1766534700; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=2mLKHqVtlP7xoVglsxBF0UNC2b1zXtRy2H5P2Q5obDw=;
 b=QTl+VBLtHBnoy4HLc3vK2xTjY71oshBuolN3xB52VtiefKP3MPmL7KA7BPoxsHIpAy
 Z3mBKio4kQc915mBBiQOwWz9Yq8pHyAarduk1i6zdANei5z51AWqn1NvqQXeBkw4eVhY
 CiCh4ff/ny/GWjDSKTqEHD95r7BJcfdlvQpk9DHyz6/cOyRp1pP0m7oTC1+TrZeofNTA
 YMaCbJJpTsu5ycmmHFshw1dnW2Ty1bfSwasJrLHMhEjrrck2rOyb7bHKf5VwxSR1XIEF
 ZDtsVA0WCNYyoi9BQNs7O4Jt0ielUjC7ZeAEX6C/SoeFiqdZfYzGYeHz7dk9ruk3ASiH
 TGyA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1765929900; x=1766534700;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=2mLKHqVtlP7xoVglsxBF0UNC2b1zXtRy2H5P2Q5obDw=;
 b=anhpUMjms1FpbdsUA1hMBNqDexBcvRL2LUARO21juh/RXMOnwovJU29xevdnsbBe7M
 VsNGB9MrKCYYGAi6pGH5tq9ozy7rTag/BV4tfwcNKEB0Kl/GhUqvQRs3bCdXT7ifGg/r
 2c0uEiy33YpINrWELLM3cwDxgOk7JuO6FrKAT16pz78+6HNwA/4XTlvhXbFUWXv7AbzV
 DUTGkdncMSVNXBcbjCEcdeg1q6j9SMxcMPbN2/PO+uizEhrse0jiVAUZvtn3lM0/4fpV
 t5A2uWfu91qeDaY1XUn7fBO3ZskbdOBkZQq1BguqCnGhQDihGl83hhYV3S5mZobjDEOw
 HRZA==
X-Gm-Message-State: AOJu0Yz3ycRtG3iqKitmJWGsOh+8clb3h5i05zY2Qmh4Jll/Efzel+Yx
 M/nnkSAWmzC47RI1rOG1jvniH10Xd0mrX1WmArJn69dRq91w1HangenzfEkq5ew6RJFc/UN4Krt
 bLgSTZWSLQp3QU3mH6BS/FQwQsvYL614=
X-Gm-Gg: AY/fxX7BXkmebkhrbVLxFuXQ4WNJLXphECrF8EEnSHfJAAu57+iFuyBit9CrT1N1VkC
 4NybijshFWmeTkz3Lx1ED+kxXzdacAuGUB/DneYznE8u80IkDvue4rkzLPIG5EE0+ORcDaBZcwk
 Fym4rDPWXA9/q0knad/cFBeZ2nJMLuCkxfHtd41L6cvJgIVKG5fPDeQg/moBQWpejJY8t42VxB4
 Gci2jXUlkDGDr/EHF1ZkXcr/IL5GJKd/z43EQczach3d665EhZWuccoPaHFO1VCCRssrUQ=
X-Google-Smtp-Source: AGHT+IGLQJ+ss5Yf1IpJbnIEv/Ek18xB6rqkxPij/PmW1RWiXjJWk6/MpD2BinfWGM8q4c/3nOO7yasvKHv/sMPowS4=
X-Received: by 2002:a05:6102:2c0f:b0:519:534a:6c5e with SMTP id
 ada2fe7eead31-5e8277e7490mr5123208137.33.1765929899841; Tue, 16 Dec 2025
 16:04:59 -0800 (PST)
MIME-Version: 1.0
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <CAN+1Hbr9SpNS00FePHQLOJK4kgm0vcxC4B1y8V4XPieaVZ2cfQ@HIDDEN>
 <CAN+1Hbq2_dWg-_eiywdNn6TVBhDa9Mdyhs0oumXnNX8C=JRK-A@HIDDEN>
In-Reply-To: <CAN+1Hbq2_dWg-_eiywdNn6TVBhDa9Mdyhs0oumXnNX8C=JRK-A@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Tue, 16 Dec 2025 19:04:47 -0500
X-Gm-Features: AQt7F2rb7Hs9-aDTMLwH-0G7HRKF52qa9ErXBCJikPnspq70i8aGDagz8jZlFP0
Message-ID: <CAN+1Hboe02viKQRF-3nw3+ybX0+hJupF0K644GEqd7f-c+X1JA@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
To: Alexander Adolf <alexander.adolf@HIDDEN>
Content-Type: multipart/alternative; boundary="00000000000060db5506461a98a8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--00000000000060db5506461a98a8
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, Dec 16, 2025 at 6:59=E2=80=AFPM St=C3=A9phane Marks <shipmints@gmai=
l.com> wrote:

> On Tue, Dec 16, 2025 at 4:42=E2=80=AFPM St=C3=A9phane Marks <shipmints@gm=
ail.com>
> wrote:
>
>> On Tue, Dec 16, 2025 at 4:34=E2=80=AFPM Alexander Adolf <
>> alexander.adolf@HIDDEN> wrote:
>>
>>> St=C3=A9phane Marks <shipmints@HIDDEN> writes:
>>>
>>> > [...]
>>> > I think you'd add an observer to the effectiveAppearance property via
>>> the
>>> > notification center.  See
>>> >
>>> https://developer.apple.com/documentation/objectivec/nsobject-swift.cla=
ss/addobserver(_:forkeypath:options:context:)?language=3Dobjc
>>> > and
>>> > also in nsterm.m look for addObserver which I think you already found=
.
>>> > It's the same concept but the key would be something
>>> > like forKeyPath:NSStringFromSelector(@selector(effectiveAppearance)).
>>>
>>> I think we might be confused by similar sounding things here?
>>>
>>> The first things is the NSNotificationCenter methods
>>>
>>>     addObserverForName:object:queue:usingBlock:
>>>     addObserver:selector:name:object:
>>>
>>> These cause the observer to be sent messages when NSNotificationCenter
>>> receives a specific notification. There is no notification for
>>> light/dark appearance change, however. Hence, for the purposes of
>>> reacting to light/dark appearance changes, these NSNotificationCenter
>>> methods will not be able to help us.
>>>
>>>
>>> The second thing is the NSObject method
>>>
>>>     observeValueForKeyPath:ofObject:change:context:
>>>
>>> which could seem usable to observe the effectiveAppearance property of
>>> the NSApp singleton at first glance. This appears to be what you have i=
n
>>> mind? And the documentation I referenced in my previous message does
>>> suggest this method.
>>>
>>> However, I just realised that said documentation is for UIKIt, not
>>> AppKit (as is used by Emacs's NS port). Some experiments I did today
>>> show indeed that the KVO method does not work reliably when not using
>>> UIKit.
>>>
>>> Revisiting the AppKit documentation confirmed to me that the one and
>>> only official AppKit way for reacting to light/dark appearance
>>> changes, is the NSView method viewDidChangeEffectiveAppearance.
>>>
>>> Thus, my conclusion is that my initial patch is the only approach which
>>> works reliably for me.
>>>
>>
>> Did you try it?  I see observers for effectiveAppearance in the wild.
>>
>> Here's an example from Chromium
>> https://github.com/chromium/chromium/blob/8a16b70db3565e50d784baf762251b=
f3e8282e00/ui/native_theme/os_settings_provider_mac.mm#L24 You
>> can google for more.
>>
>
> And, not to taint your intellectual property, but here's a long-standing
> NS appearance patch that appears to observe changes in the
> effectiveAppearance property
> https://github.com/d12frosted/homebrew-emacs-plus/blob/master/patches/ema=
cs-31/system-appearance.patch
>

I just took a look at emacs-mac, the non-NS "Mitsuharu" Emacs build and it,
too, uses observers, though its implementation is even more clever,
abstracting the interface to key-value observers to Elisp so stanzas like
this work

  (define-key mac-apple-event-map [application-kvo effectiveAppearance]
    'mac-handle-application-effective-appearance-change)

Hope that all helps.

--00000000000060db5506461a98a8
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Tue, Dec 16, 2025 at 6:59=E2=80=AFPM St=C3=A9phane Marks &lt;<a href=3D"=
mailto:shipmints@HIDDEN">shipmints@HIDDEN</a>&gt; wrote:</span></div>=
</div><div class=3D"gmail_quote gmail_quote_container"><blockquote class=3D=
"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(2=
04,204,204);padding-left:1ex"><div dir=3D"ltr"><div dir=3D"ltr"><div style=
=3D"font-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-=
serif">On Tue, Dec 16, 2025 at 4:42=E2=80=AFPM St=C3=A9phane Marks &lt;<a h=
ref=3D"mailto:shipmints@HIDDEN" target=3D"_blank">shipmints@HIDDEN</a=
>&gt; wrote:</span></div></div><div class=3D"gmail_quote"><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div dir=3D"ltr"><div sty=
le=3D"font-family:monospace"><span style=3D"font-family:Arial,Helvetica,san=
s-serif">On Tue, Dec 16, 2025 at 4:34=E2=80=AFPM Alexander Adolf &lt;<a hre=
f=3D"mailto:alexander.adolf@HIDDEN" target=3D"_blank">alexande=
r.adolf@HIDDEN</a>&gt; wrote:</span></div></div><div class=3D"=
gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px =
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">St=C3=A9phan=
e Marks &lt;<a href=3D"mailto:shipmints@HIDDEN" target=3D"_blank">shipmi=
nts@HIDDEN</a>&gt; writes:<br>
<br>
&gt; [...]<br>
&gt; I think you&#39;d add an observer to the effectiveAppearance property =
via the<br>
&gt; notification center.=C2=A0 See<br>
&gt; <a href=3D"https://developer.apple.com/documentation/objectivec/nsobje=
ct-swift.class/addobserver(_:forkeypath:options:context:)?language=3Dobjc" =
rel=3D"noreferrer" target=3D"_blank">https://developer.apple.com/documentat=
ion/objectivec/nsobject-swift.class/addobserver(_:forkeypath:options:contex=
t:)?language=3Dobjc</a><br>
&gt; and<br>
&gt; also in nsterm.m look for addObserver which I think you already found.=
<br>
&gt; It&#39;s the same concept but the key would be something<br>
&gt; like forKeyPath:NSStringFromSelector(@selector(effectiveAppearance)).<=
br>
<br>
I think we might be confused by similar sounding things here?<br>
<br>
The first things is the NSNotificationCenter methods<br>
<br>
=C2=A0 =C2=A0 addObserverForName:object:queue:usingBlock:<br>
=C2=A0 =C2=A0 addObserver:selector:name:object:<br>
<br>
These cause the observer to be sent messages when NSNotificationCenter<br>
receives a specific notification. There is no notification for<br>
light/dark appearance change, however. Hence, for the purposes of<br>
reacting to light/dark appearance changes, these NSNotificationCenter<br>
methods will not be able to help us.<br>
<br>
<br>
The second thing is the NSObject method<br>
<br>
=C2=A0 =C2=A0 observeValueForKeyPath:ofObject:change:context:<br>
<br>
which could seem usable to observe the effectiveAppearance property of<br>
the NSApp singleton at first glance. This appears to be what you have in<br=
>
mind? And the documentation I referenced in my previous message does<br>
suggest this method.<br>
<br>
However, I just realised that said documentation is for UIKIt, not<br>
AppKit (as is used by Emacs&#39;s NS port). Some experiments I did today<br=
>
show indeed that the KVO method does not work reliably when not using<br>
UIKit.<br>
<br>
Revisiting the AppKit documentation confirmed to me that the one and<br>
only official AppKit way for reacting to light/dark appearance<br>
changes, is the NSView method viewDidChangeEffectiveAppearance.<br>
<br>
Thus, my conclusion is that my initial patch is the only approach which<br>
works reliably for me.<br></blockquote><div><br></div><div style=3D"font-fa=
mily:monospace">Did you try it?=C2=A0 I see observers for effectiveAppearan=
ce in the wild.</div><div style=3D"font-family:monospace"><br></div><div st=
yle=3D"font-family:monospace">Here&#39;s an example from Chromium=C2=A0<a h=
ref=3D"https://github.com/chromium/chromium/blob/8a16b70db3565e50d784baf762=
251bf3e8282e00/ui/native_theme/os_settings_provider_mac.mm#L24" target=3D"_=
blank">https://github.com/chromium/chromium/blob/8a16b70db3565e50d784baf762=
251bf3e8282e00/ui/native_theme/os_settings_provider_mac.mm#L24</a>=C2=A0You=
 can google for more.</div></div></div></blockquote><div><br></div><div sty=
le=3D"font-family:monospace">And, not to taint your intellectual property, =
but here&#39;s a long-standing NS appearance patch that appears to observe =
changes in the effectiveAppearance property=C2=A0<a href=3D"https://github.=
com/d12frosted/homebrew-emacs-plus/blob/master/patches/emacs-31/system-appe=
arance.patch" target=3D"_blank">https://github.com/d12frosted/homebrew-emac=
s-plus/blob/master/patches/emacs-31/system-appearance.patch</a></div></div>=
</div></blockquote><div><br></div><div class=3D"gmail_default" style=3D""><=
font face=3D"monospace">I just took a look at emacs-mac, the non-NS &quot;M=
itsuharu&quot; Emacs build and it, too, uses observers, though its implemen=
tation is even more clever, abstracting the interface to key-value observer=
s to Elisp so stanzas like this work</font></div><div class=3D"gmail_defaul=
t" style=3D""><font face=3D"monospace"><br></font></div><div class=3D"gmail=
_default" style=3D""><font face=3D"monospace">=C2=A0 (define-key mac-apple-=
event-map [application-kvo effectiveAppearance]</font></div><font face=3D"m=
onospace"><span class=3D"gmail_default" style=3D"">=C2=A0=C2=A0</span>=C2=
=A0 &#39;mac-handle-application-effective-appearance-change)</font></div><d=
iv class=3D"gmail_quote gmail_quote_container"><font face=3D"monospace"><br=
></font></div><div class=3D"gmail_quote gmail_quote_container"><font face=
=3D"monospace"><span class=3D"gmail_default" style=3D"font-family:monospace=
">Hope that all helps.</span><br></font></div></div>

--00000000000060db5506461a98a8--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 16 Dec 2025 23:59:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 16 18:59:55 2025
Received: from localhost ([127.0.0.1]:33343 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vVexP-0006tf-03
	for submit <at> debbugs.gnu.org; Tue, 16 Dec 2025 18:59:55 -0500
Received: from mail-vs1-xe2d.google.com ([2607:f8b0:4864:20::e2d]:52670)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vVexM-0006tN-Mq
 for 80001 <at> debbugs.gnu.org; Tue, 16 Dec 2025 18:59:53 -0500
Received: by mail-vs1-xe2d.google.com with SMTP id
 ada2fe7eead31-5dd6fbe5091so2028720137.1
 for <80001 <at> debbugs.gnu.org>; Tue, 16 Dec 2025 15:59:52 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1765929587; x=1766534387; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=0KcyWXTUQ0Qp1RVQ/GN7b0XxTeGSV2yBg1cggulmRv0=;
 b=nmcZhT7YsxhiqdHnQKnvr/LMEXQXGy15ClckkWTKtKhI+O50LFEkp/Sn29rgLz/MEF
 uQDtiLDNbU57bEj2DMqjLjOoQwYcpz7vCStC2EtKZdwlxByMe/NIP15YsPj5eB7Y3N7j
 8np280GwaYnCi65cqPape8kuPTDNKLC0+qThaVh3HXtWsX0Gq+mn1mpItcFvCRuDX09q
 WzvlT3zpToapj7Cs0wV1QGvE/MsrAbIi2G2L2q6Z9vSPWVHWiFOstXlq5Er9/CFxgra4
 ohLFCRq3BQ7c81tjua4VdmYshBoaQPz5KtMb5vXLK961c3Cppq+XjtAiKIYjyzmPy06r
 X7rA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1765929587; x=1766534387;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=0KcyWXTUQ0Qp1RVQ/GN7b0XxTeGSV2yBg1cggulmRv0=;
 b=nywf+M3EMxuvsqnxjgl+qWwZVxgAlspXK7v+PDObY+cdoXAJ17OQQdjmGejyiMif9u
 NZob8QFzNGyJ7uIlhySfsbppRRK0vDhGPGr2LkemyaLrYfsFfkuBpEvILl3XIPLiHqj0
 IxNdoJzBiq3wZJD9H96dhUvVAGGt+6bESKcSfSDsSeMtKr2K1HwcTDEUGrEdmzCeOJto
 lu1IQkf1LkhD4tnvfrxq9UyrHvpEiPWDz2/Rxko/fOQ4A3PBpssoN8fKFSuVdOb8oEZ1
 skwiV2y/dh5Y3DV4s/DHqFcfZ+M3joa5UrGSCnv7FOoV56n9FJSNCb27d5CLdCNBeD5N
 ZMfg==
X-Gm-Message-State: AOJu0YxcaxWpiD9hKF8MEDxSrwFk0YRpx7g99EonhtHG3OeyuopeOtsk
 i0EFOsFmd5JdCu0tWipt3Oxh+IhDK1XqnS+0h8qDJSOJYNKNT8RFKxHg6w49U/jrv66ibuSMKRo
 GBOP4oUYwox69LAopxgZPFClenbWUZYQLNQ==
X-Gm-Gg: AY/fxX7rWdwOGIztx3X6DNwDD0o6jXVoGt+gDD3GTfWev62Y6zxm9rGOR9wNBX7QqYZ
 3mraf3HA2Pgwf5NxwaDlreuvS/LmQBNAHNOpC9abaPvDFRDbEkYBYdjxJAnHKjJG1JQvQZ9jIM4
 OIrMATKHXykf/misJaG48Yjfn+UjUJshh+AYbIhMHoP+ckIhFpxnBorScNZ4vc3Wa/nDFYNNJ6Q
 hAoeGrHzGyun7G9fxaMyc21ETF60Js5My5btAupSE0wvmeZln++mL2qF3LVZ1D9BXnTn4g=
X-Google-Smtp-Source: AGHT+IH5JjBmDUrU9ga05iVLjlKVIrGTq9nU3wE4FduijXv0sh4gAZzPgyIDu1YU9EsbE9/mn02PFKJ6R64R1XBW/2U=
X-Received: by 2002:a05:6102:6cb:b0:5e1:866c:4f8b with SMTP id
 ada2fe7eead31-5e827835ae4mr4257441137.44.1765929586853; Tue, 16 Dec 2025
 15:59:46 -0800 (PST)
MIME-Version: 1.0
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
 <CAN+1Hbr9SpNS00FePHQLOJK4kgm0vcxC4B1y8V4XPieaVZ2cfQ@HIDDEN>
In-Reply-To: <CAN+1Hbr9SpNS00FePHQLOJK4kgm0vcxC4B1y8V4XPieaVZ2cfQ@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Tue, 16 Dec 2025 18:59:35 -0500
X-Gm-Features: AQt7F2ovozAvos4Vscg22Kmch1vgfDnts6ZoSSv8_db6DHbtUUjyOoImUKEDySM
Message-ID: <CAN+1Hbq2_dWg-_eiywdNn6TVBhDa9Mdyhs0oumXnNX8C=JRK-A@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
To: Alexander Adolf <alexander.adolf@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000b90c4206461a85eb"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000b90c4206461a85eb
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, Dec 16, 2025 at 4:42=E2=80=AFPM St=C3=A9phane Marks <shipmints@gmai=
l.com> wrote:

> On Tue, Dec 16, 2025 at 4:34=E2=80=AFPM Alexander Adolf <
> alexander.adolf@HIDDEN> wrote:
>
>> St=C3=A9phane Marks <shipmints@HIDDEN> writes:
>>
>> > [...]
>> > I think you'd add an observer to the effectiveAppearance property via
>> the
>> > notification center.  See
>> >
>> https://developer.apple.com/documentation/objectivec/nsobject-swift.clas=
s/addobserver(_:forkeypath:options:context:)?language=3Dobjc
>> > and
>> > also in nsterm.m look for addObserver which I think you already found.
>> > It's the same concept but the key would be something
>> > like forKeyPath:NSStringFromSelector(@selector(effectiveAppearance)).
>>
>> I think we might be confused by similar sounding things here?
>>
>> The first things is the NSNotificationCenter methods
>>
>>     addObserverForName:object:queue:usingBlock:
>>     addObserver:selector:name:object:
>>
>> These cause the observer to be sent messages when NSNotificationCenter
>> receives a specific notification. There is no notification for
>> light/dark appearance change, however. Hence, for the purposes of
>> reacting to light/dark appearance changes, these NSNotificationCenter
>> methods will not be able to help us.
>>
>>
>> The second thing is the NSObject method
>>
>>     observeValueForKeyPath:ofObject:change:context:
>>
>> which could seem usable to observe the effectiveAppearance property of
>> the NSApp singleton at first glance. This appears to be what you have in
>> mind? And the documentation I referenced in my previous message does
>> suggest this method.
>>
>> However, I just realised that said documentation is for UIKIt, not
>> AppKit (as is used by Emacs's NS port). Some experiments I did today
>> show indeed that the KVO method does not work reliably when not using
>> UIKit.
>>
>> Revisiting the AppKit documentation confirmed to me that the one and
>> only official AppKit way for reacting to light/dark appearance
>> changes, is the NSView method viewDidChangeEffectiveAppearance.
>>
>> Thus, my conclusion is that my initial patch is the only approach which
>> works reliably for me.
>>
>
> Did you try it?  I see observers for effectiveAppearance in the wild.
>
> Here's an example from Chromium
> https://github.com/chromium/chromium/blob/8a16b70db3565e50d784baf762251bf=
3e8282e00/ui/native_theme/os_settings_provider_mac.mm#L24 You
> can google for more.
>

And, not to taint your intellectual property, but here's a long-standing NS
appearance patch that appears to observe changes in the effectiveAppearance
property
https://github.com/d12frosted/homebrew-emacs-plus/blob/master/patches/emacs=
-31/system-appearance.patch

--000000000000b90c4206461a85eb
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Tue, Dec 16, 2025 at 4:42=E2=80=AFPM St=C3=A9phane Marks &lt;<a href=3D"=
mailto:shipmints@HIDDEN">shipmints@HIDDEN</a>&gt; wrote:</span></div>=
</div><div class=3D"gmail_quote gmail_quote_container"><blockquote class=3D=
"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(2=
04,204,204);padding-left:1ex"><div dir=3D"ltr"><div dir=3D"ltr"><div style=
=3D"font-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-=
serif">On Tue, Dec 16, 2025 at 4:34=E2=80=AFPM Alexander Adolf &lt;<a href=
=3D"mailto:alexander.adolf@HIDDEN" target=3D"_blank">alexander=
.adolf@HIDDEN</a>&gt; wrote:</span></div></div><div class=3D"g=
mail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0=
.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">St=C3=A9phane=
 Marks &lt;<a href=3D"mailto:shipmints@HIDDEN" target=3D"_blank">shipmin=
ts@HIDDEN</a>&gt; writes:<br>
<br>
&gt; [...]<br>
&gt; I think you&#39;d add an observer to the effectiveAppearance property =
via the<br>
&gt; notification center.=C2=A0 See<br>
&gt; <a href=3D"https://developer.apple.com/documentation/objectivec/nsobje=
ct-swift.class/addobserver(_:forkeypath:options:context:)?language=3Dobjc" =
rel=3D"noreferrer" target=3D"_blank">https://developer.apple.com/documentat=
ion/objectivec/nsobject-swift.class/addobserver(_:forkeypath:options:contex=
t:)?language=3Dobjc</a><br>
&gt; and<br>
&gt; also in nsterm.m look for addObserver which I think you already found.=
<br>
&gt; It&#39;s the same concept but the key would be something<br>
&gt; like forKeyPath:NSStringFromSelector(@selector(effectiveAppearance)).<=
br>
<br>
I think we might be confused by similar sounding things here?<br>
<br>
The first things is the NSNotificationCenter methods<br>
<br>
=C2=A0 =C2=A0 addObserverForName:object:queue:usingBlock:<br>
=C2=A0 =C2=A0 addObserver:selector:name:object:<br>
<br>
These cause the observer to be sent messages when NSNotificationCenter<br>
receives a specific notification. There is no notification for<br>
light/dark appearance change, however. Hence, for the purposes of<br>
reacting to light/dark appearance changes, these NSNotificationCenter<br>
methods will not be able to help us.<br>
<br>
<br>
The second thing is the NSObject method<br>
<br>
=C2=A0 =C2=A0 observeValueForKeyPath:ofObject:change:context:<br>
<br>
which could seem usable to observe the effectiveAppearance property of<br>
the NSApp singleton at first glance. This appears to be what you have in<br=
>
mind? And the documentation I referenced in my previous message does<br>
suggest this method.<br>
<br>
However, I just realised that said documentation is for UIKIt, not<br>
AppKit (as is used by Emacs&#39;s NS port). Some experiments I did today<br=
>
show indeed that the KVO method does not work reliably when not using<br>
UIKit.<br>
<br>
Revisiting the AppKit documentation confirmed to me that the one and<br>
only official AppKit way for reacting to light/dark appearance<br>
changes, is the NSView method viewDidChangeEffectiveAppearance.<br>
<br>
Thus, my conclusion is that my initial patch is the only approach which<br>
works reliably for me.<br></blockquote><div><br></div><div style=3D"font-fa=
mily:monospace">Did you try it?=C2=A0 I see observers for effectiveAppearan=
ce in the wild.</div><div style=3D"font-family:monospace"><br></div><div st=
yle=3D"font-family:monospace">Here&#39;s an example from Chromium=C2=A0<a h=
ref=3D"https://github.com/chromium/chromium/blob/8a16b70db3565e50d784baf762=
251bf3e8282e00/ui/native_theme/os_settings_provider_mac.mm#L24" target=3D"_=
blank">https://github.com/chromium/chromium/blob/8a16b70db3565e50d784baf762=
251bf3e8282e00/ui/native_theme/os_settings_provider_mac.mm#L24</a>=C2=A0You=
 can google for more.</div></div></div></blockquote><div><br></div><div cla=
ss=3D"gmail_default" style=3D"font-family:monospace">And, not to taint your=
 intellectual property, but here&#39;s a long-standing NS appearance patch =
that appears to observe changes in the effectiveAppearance property=C2=A0<a=
 href=3D"https://github.com/d12frosted/homebrew-emacs-plus/blob/master/patc=
hes/emacs-31/system-appearance.patch">https://github.com/d12frosted/homebre=
w-emacs-plus/blob/master/patches/emacs-31/system-appearance.patch</a></div>=
<div class=3D"gmail_default" style=3D"font-family:monospace"><br></div></di=
v></div>

--000000000000b90c4206461a85eb--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 16 Dec 2025 21:42:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 16 16:42:21 2025
Received: from localhost ([127.0.0.1]:60200 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vVcoG-0006PV-RX
	for submit <at> debbugs.gnu.org; Tue, 16 Dec 2025 16:42:21 -0500
Received: from mail-vk1-xa2c.google.com ([2607:f8b0:4864:20::a2c]:45363)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vVcoE-0006Oy-Ja
 for 80001 <at> debbugs.gnu.org; Tue, 16 Dec 2025 16:42:19 -0500
Received: by mail-vk1-xa2c.google.com with SMTP id
 71dfb90a1353d-55ab217bb5eso745192e0c.3
 for <80001 <at> debbugs.gnu.org>; Tue, 16 Dec 2025 13:42:18 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1765921333; x=1766526133; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=krqww4UPMxWks0OSbO5rlRtP2hs+2duuKZ3LtjdtlIo=;
 b=jUQwKzXTUztj1SnbnO67ukoV+iJxO7ukOFAJXh5tBbsBk/mjwu7Brct2tmda/5ik5K
 Vb0BT7p4zE/gR9Wqupl49HkinhYLVuoe21R3Q181mycmZMEqvhKXlLHz6CwuUa9grMr0
 d+YZ9dRWWZpZn9rybkWvkW3A2IHkkiTZEVpRsObMStvLmWdV2mxrWv3mP0NLpqedusWc
 8bYBRCzTrPU6v23+mACLi9ZgdI94s9A8F/nEP1RO+2MBqR/WZD5kceRzl0UGCczcd4io
 aIrgJa6uecZ78JE3W9O0BCDEsk9TW30KMNuFXd1r80roXuAeriAu9U6sztYyOYapCiS0
 LGGA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1765921333; x=1766526133;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=krqww4UPMxWks0OSbO5rlRtP2hs+2duuKZ3LtjdtlIo=;
 b=s/ZuvW3oCrkVjcLuA1Fxz0za4N5H6NlTINSe/OZWgv+x8/gp+PFZZDoJhkDkkjm81N
 j1LiMhWT5sRDc/njW7MY/vvHWvyoryqvv+xJ9moaTeyUDsUK55hbj8Uqfsh9f3bHDSYi
 imqr2fFdABG4eijH65t8aMS97UDTEhMVpAmroJIO+lKsFyJo2VXlYvleDTJia3Y5vZI5
 KBiW2Q95Jg5lNfHzTXPhsREgjA9YuJZJBp5a9sss8Tz99+aU1S4A9hKT/xpt/d6aUVxX
 Nc7uHR1ybOYTCDylMgiyF7LTBEPJd3BIINfc+/+F6NvU1Lv4fcXjuf1tAA/9kkjpR42V
 FhUQ==
X-Gm-Message-State: AOJu0YwecjBFIsaYo7tFMbIkzIlzg6lrd2NpPUgjM3JIkuVb1CB0+0Jx
 C9VVVC3ZUTXxnF2eh05Y3lu2QNxnLk2zzBSkcrMJhMKaXNwtsuirNF01bfrnS48N6hETZ+qxYU8
 ciMcbsos6Hh028ndAFvbMSv/sJLupk03w6sF7
X-Gm-Gg: AY/fxX64gwVBVHSt9vRWEzscUBkDqtGcCvxT2f3OALS7WBGu6Jt9+xI9/BiOWtQTkNK
 lIHvYDY9P1EF89yhkRj3w8b+7ogMyxdb7cDTYyHj9xEWxBNyWzjZG4o1P8Dy2DTmNuGbjYKH0Md
 IYw6c01FiH622hc1TRU3V4jXBp76z2HsmHqP7Htl9238jg8R5LYMf/k2f8+RN8Wq7Dx7dFXMZBt
 5dBNpCryc+kCP5iEV8+AfDC7XtI1c31tvbO1q2QrH4MuKl8a2I+murUS29vLS0dxpXUAsQ=
X-Google-Smtp-Source: AGHT+IHO1cGYP1QQm5lLO1jPBJhQd36Ej3Lj6iHtIrA3wajTyOPocE4WEIDrjaoLKTxQQL1EQvVnQKqRDXFjvQ9o1bQ=
X-Received: by 2002:a05:6102:8014:b0:5dd:f9c2:551c with SMTP id
 ada2fe7eead31-5e8277cd5e7mr4648636137.27.1765921332524; Tue, 16 Dec 2025
 13:42:12 -0800 (PST)
MIME-Version: 1.0
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
 <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
In-Reply-To: <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Tue, 16 Dec 2025 16:42:01 -0500
X-Gm-Features: AQt7F2rSfygJDV02CXXopIpH1JSA3OcqkDQJpYrNJaqLC4Rx38WSNYaNCyJp2mA
Message-ID: <CAN+1Hbr9SpNS00FePHQLOJK4kgm0vcxC4B1y8V4XPieaVZ2cfQ@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
To: Alexander Adolf <alexander.adolf@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000b9f9a30646189975"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000b9f9a30646189975
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, Dec 16, 2025 at 4:34=E2=80=AFPM Alexander Adolf <
alexander.adolf@HIDDEN> wrote:

> St=C3=A9phane Marks <shipmints@HIDDEN> writes:
>
> > [...]
> > I think you'd add an observer to the effectiveAppearance property via t=
he
> > notification center.  See
> >
> https://developer.apple.com/documentation/objectivec/nsobject-swift.class=
/addobserver(_:forkeypath:options:context:)?language=3Dobjc
> > and
> > also in nsterm.m look for addObserver which I think you already found.
> > It's the same concept but the key would be something
> > like forKeyPath:NSStringFromSelector(@selector(effectiveAppearance)).
>
> I think we might be confused by similar sounding things here?
>
> The first things is the NSNotificationCenter methods
>
>     addObserverForName:object:queue:usingBlock:
>     addObserver:selector:name:object:
>
> These cause the observer to be sent messages when NSNotificationCenter
> receives a specific notification. There is no notification for
> light/dark appearance change, however. Hence, for the purposes of
> reacting to light/dark appearance changes, these NSNotificationCenter
> methods will not be able to help us.
>
>
> The second thing is the NSObject method
>
>     observeValueForKeyPath:ofObject:change:context:
>
> which could seem usable to observe the effectiveAppearance property of
> the NSApp singleton at first glance. This appears to be what you have in
> mind? And the documentation I referenced in my previous message does
> suggest this method.
>
> However, I just realised that said documentation is for UIKIt, not
> AppKit (as is used by Emacs's NS port). Some experiments I did today
> show indeed that the KVO method does not work reliably when not using
> UIKit.
>
> Revisiting the AppKit documentation confirmed to me that the one and
> only official AppKit way for reacting to light/dark appearance
> changes, is the NSView method viewDidChangeEffectiveAppearance.
>
> Thus, my conclusion is that my initial patch is the only approach which
> works reliably for me.
>

Did you try it?  I see observers for effectiveAppearance in the wild.

Here's an example from Chromium
https://github.com/chromium/chromium/blob/8a16b70db3565e50d784baf762251bf3e=
8282e00/ui/native_theme/os_settings_provider_mac.mm#L24
You
can google for more.

--000000000000b9f9a30646189975
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Tue, Dec 16, 2025 at 4:34=E2=80=AFPM Alexander Adolf &lt;<a href=3D"mail=
to:alexander.adolf@HIDDEN">alexander.adolf@HIDDEN=
</a>&gt; wrote:</span></div></div><div class=3D"gmail_quote gmail_quote_con=
tainer"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex=
;border-left:1px solid rgb(204,204,204);padding-left:1ex">St=C3=A9phane Mar=
ks &lt;<a href=3D"mailto:shipmints@HIDDEN" target=3D"_blank">shipmints@g=
mail.com</a>&gt; writes:<br>
<br>
&gt; [...]<br>
&gt; I think you&#39;d add an observer to the effectiveAppearance property =
via the<br>
&gt; notification center.=C2=A0 See<br>
&gt; <a href=3D"https://developer.apple.com/documentation/objectivec/nsobje=
ct-swift.class/addobserver(_:forkeypath:options:context:)?language=3Dobjc" =
rel=3D"noreferrer" target=3D"_blank">https://developer.apple.com/documentat=
ion/objectivec/nsobject-swift.class/addobserver(_:forkeypath:options:contex=
t:)?language=3Dobjc</a><br>
&gt; and<br>
&gt; also in nsterm.m look for addObserver which I think you already found.=
<br>
&gt; It&#39;s the same concept but the key would be something<br>
&gt; like forKeyPath:NSStringFromSelector(@selector(effectiveAppearance)).<=
br>
<br>
I think we might be confused by similar sounding things here?<br>
<br>
The first things is the NSNotificationCenter methods<br>
<br>
=C2=A0 =C2=A0 addObserverForName:object:queue:usingBlock:<br>
=C2=A0 =C2=A0 addObserver:selector:name:object:<br>
<br>
These cause the observer to be sent messages when NSNotificationCenter<br>
receives a specific notification. There is no notification for<br>
light/dark appearance change, however. Hence, for the purposes of<br>
reacting to light/dark appearance changes, these NSNotificationCenter<br>
methods will not be able to help us.<br>
<br>
<br>
The second thing is the NSObject method<br>
<br>
=C2=A0 =C2=A0 observeValueForKeyPath:ofObject:change:context:<br>
<br>
which could seem usable to observe the effectiveAppearance property of<br>
the NSApp singleton at first glance. This appears to be what you have in<br=
>
mind? And the documentation I referenced in my previous message does<br>
suggest this method.<br>
<br>
However, I just realised that said documentation is for UIKIt, not<br>
AppKit (as is used by Emacs&#39;s NS port). Some experiments I did today<br=
>
show indeed that the KVO method does not work reliably when not using<br>
UIKit.<br>
<br>
Revisiting the AppKit documentation confirmed to me that the one and<br>
only official AppKit way for reacting to light/dark appearance<br>
changes, is the NSView method viewDidChangeEffectiveAppearance.<br>
<br>
Thus, my conclusion is that my initial patch is the only approach which<br>
works reliably for me.<br></blockquote><div><br></div><div class=3D"gmail_d=
efault" style=3D"font-family:monospace">Did you try it?=C2=A0 I see observe=
rs for effectiveAppearance in the wild.</div><div class=3D"gmail_default" s=
tyle=3D"font-family:monospace"><br></div><div class=3D"gmail_default" style=
=3D"font-family:monospace">Here&#39;s an example from Chromium=C2=A0<a href=
=3D"https://github.com/chromium/chromium/blob/8a16b70db3565e50d784baf762251=
bf3e8282e00/ui/native_theme/os_settings_provider_mac.mm#L24">https://github=
.com/chromium/chromium/blob/8a16b70db3565e50d784baf762251bf3e8282e00/ui/nat=
ive_theme/os_settings_provider_mac.mm#L24</a>=C2=A0You can google for more.=
</div><div class=3D"gmail_default" style=3D"font-family:monospace"><br></di=
v></div></div>

--000000000000b9f9a30646189975--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 16 Dec 2025 21:34:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 16 16:34:29 2025
Received: from localhost ([127.0.0.1]:60143 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vVcgf-0005v2-96
	for submit <at> debbugs.gnu.org; Tue, 16 Dec 2025 16:34:29 -0500
Received: from www191.your-server.de ([188.40.2.11]:44394)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vVcgc-0005um-BS
 for 80001 <at> debbugs.gnu.org; Tue, 16 Dec 2025 16:34:27 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=condition-alpha.com; s=default2503; h=Content-Transfer-Encoding:
 Content-Type:MIME-Version:Date:In-reply-to:References:Subject:Cc:To:From:
 Message-Id:Sender:Reply-To:Content-ID:Content-Description:Resent-Date:
 Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
 bh=xGMNwhi1NdlrW+SViRxiLIH7GK5h124nufC5rmjvv1Q=; b=H9EAWaMTzngA3IVtDqqnffumJ5
 vVQq/hYhHIHlHezxjoC8BltJ5xzEPKSfPBchxEpUOj/yipZih601kUY1zdudxzDkyYHfLR9YSTU75
 f/+tnAjZH7TM11g7UoWQaEgtFF5EcOY7xISJ6ddDl4LZmiT22rutYQJbJlqlDFgOH0DiceNakm3jq
 nop9Y55nSnKhyxAuRKl4EHLm5njvhnZj3GF/Ey+K28xgnVQH/s6Yx1HYIXQ4g4hbyMTS5Uv5HPSPb
 gfKkvLrjI+uqEwnJxy6/+D0SPRpnH5v0C9tSMtLVnLphTuyPRq8gjQQg7Tbf3IQf/ssdVyyhHpnLr
 eudgxe8Q==;
Received: from sslproxy08.your-server.de ([78.47.166.52])
 by www191.your-server.de with esmtpsa  (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96.2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vVcgV-0002vv-1A; Tue, 16 Dec 2025 22:34:19 +0100
Received: from localhost ([127.0.0.1])
 by sslproxy08.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vVcgU-000Kmh-2L; Tue, 16 Dec 2025 22:34:19 +0100
Message-Id: <6f2bb1992264ad68f8c9a504a331bff9@HIDDEN>
From: Alexander Adolf <alexander.adolf@HIDDEN>
To: =?utf-8?Q?St=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
 <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
In-reply-to: <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
Date: Tue, 16 Dec 2025 22:34:18 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: Clear (ClamAV 1.0.9/27852/Tue Dec 16 18:24:27 2025)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

St=C3=A9phane Marks <shipmints@HIDDEN> writes:

> [...]
> I think you'd add an observer to the effectiveAppearance property via the
> notification center.  See
> https://developer.apple.com/documentation/objectivec/nsobject-swift.class=
/addobserver(_:forkeypath:options:context:)?language=3Dobjc
> and
> also in nsterm.m look for addObserver which I think you already found.
> It's the same concept but the key would be something
> like forKeyPath:NSStringFromSelector(@selector(effectiveAppearance)).

I think we might be confused by similar sounding things here?

The first things is the NSNotificationCenter methods

    addObserverForName:object:queue:usingBlock:
    addObserver:selector:name:object:

These cause the observer to be sent messages when NSNotificationCenter
receives a specific notification. There is no notification for
light/dark appearance change, however. Hence, for the purposes of
reacting to light/dark appearance changes, these NSNotificationCenter
methods will not be able to help us.


The second thing is the NSObject method

    observeValueForKeyPath:ofObject:change:context:

which could seem usable to observe the effectiveAppearance property of
the NSApp singleton at first glance. This appears to be what you have in
mind? And the documentation I referenced in my previous message does
suggest this method.

However, I just realised that said documentation is for UIKIt, not
AppKit (as is used by Emacs's NS port). Some experiments I did today
show indeed that the KVO method does not work reliably when not using
UIKit.

Revisiting the AppKit documentation confirmed to me that the one and
only official AppKit way for reacting to light/dark appearance
changes, is the NSView method viewDidChangeEffectiveAppearance.

Thus, my conclusion is that my initial patch is the only approach which
works reliably for me.


Many thanks and looking forward to your thoughts,

  --alexander




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 15 Dec 2025 22:24:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 15 17:24:45 2025
Received: from localhost ([127.0.0.1]:45179 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vVGzk-0003td-Vu
	for submit <at> debbugs.gnu.org; Mon, 15 Dec 2025 17:24:45 -0500
Received: from mail-vs1-xe35.google.com ([2607:f8b0:4864:20::e35]:51226)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vVGzh-0003sl-9t
 for 80001 <at> debbugs.gnu.org; Mon, 15 Dec 2025 17:24:42 -0500
Received: by mail-vs1-xe35.google.com with SMTP id
 ada2fe7eead31-5dbcd54d2d8so3450842137.2
 for <80001 <at> debbugs.gnu.org>; Mon, 15 Dec 2025 14:24:41 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1765837475; x=1766442275; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=07u3OnrstRSgxe+EwAb/eKZJG9VVz43BSD8ljaVhSKs=;
 b=cdaHCu4b+ZnSj1euFgo+YvxT7j+PLmTD0BOVqhsTAirRPFptW1NdWzCrF7RB/ezi62
 MWijaJjTSPnT1THSo4D3XHFFYZO9H5SKLL/DG/JRo0ml/9ZCaWs2QoumgCm6/LaqDXbA
 PkjAAHu8AGJyzEb1S0HQpun0zG9OQoXZX2j+AfuONxKmnJem1qSXCE5Mk6fvJpu3MqYD
 s6x96ur6zSAXuDOqXFl43OGr+w2Kts5C1JxwFDDvNS2P75GxVAblcU7uvZKzpdqHEXk6
 +27PGnyop9U5F6JvO8BKpc4nRo19sMs1dE/spW3MQ55QmafDH7Oa+I1dG8WhrBwCDbEa
 EEgg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1765837475; x=1766442275;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=07u3OnrstRSgxe+EwAb/eKZJG9VVz43BSD8ljaVhSKs=;
 b=r1lYBuYZGmt+4Z8owURdlo7F6LqemyPiGaJDjn+MzJX/OsBKkHZAUJnVfuRs5lUy9A
 YFFI/mPBA+5/4BPHGbUL4xG/6FDuIYlRj9S0yaePNP7Xa4uJlrTVFmvsvynYLz90d938
 sU1Ex923ZZbECpnOF3wSH6FE+eRycsxBQff3BqevKv5vBy87t7egRuULGWN2k+l3BZcH
 22njX3L+li5I4mcs+azI9CJIp+SBRdHSmzHH905hW0eVAfntWv/76wsATtK6Xumvmbfa
 IZJ5jpfidg3/ckwE/jeYl+HRXyUw0N9h/RmWAjTwbMJ/FGgjulac7Bn7ShxLF7YndEvc
 Dy/w==
X-Gm-Message-State: AOJu0YxiZvoI3no0e1TqYnWf5LNYMGfwsQ4vOrLHyj8pB83CSQGYiaL2
 +H/ZFNOtU4jlXreucIdQCOxfC+bwLzp5cTWXkZF+3F1uHEvh7+PoBwdzbgW+n47ZUG9113ztjps
 bNZmAH2tJ0xHBbbPxlLLTK8KKVROhkZoyvD54
X-Gm-Gg: AY/fxX4xQf+/8BY2mQh34Pns7MxLR5nsb4Mhy0C4tXOOoh4sIrtyW2Y86aF8Ogwk5cc
 qtlyC7lmWQ6aJvDqCE3i/1w8XyHi0GuTk1TunWmG9U2VcghPpo3QHHsr/s81WZKtNAXkFoqx7Xb
 wuxS4aymBcD/fzbaAuiGOrzzWOQqvTbreuYNVq955O41p3/Waa4bfu1kld46Kb98kHtjxihP9TO
 V74G8WdT+Jx2LURnXvpzzoq+BC8pRJwfgpDsml9jPr1GxcGL8pFmVbTGmJfNrefkymYHr4=
X-Google-Smtp-Source: AGHT+IEV+EYbQp/0behgJE4pAIUxTdt+5baD9KU5oaqOf7M+HJ1yJEEO2R1qcNXKLMIOF9o9ct1wyn8MjQdKZd8ITXc=
X-Received: by 2002:a05:6102:dd2:b0:5db:deb6:b261 with SMTP id
 ada2fe7eead31-5e82768a2c5mr4167844137.13.1765837475314; Mon, 15 Dec 2025
 14:24:35 -0800 (PST)
MIME-Version: 1.0
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
 <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
In-Reply-To: <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Mon, 15 Dec 2025 17:24:22 -0500
X-Gm-Features: AQt7F2p14_KU00zN0ArmbpNKZ8zvE4GPmyYcv6AeS83ORFVtAHVZAvlRjDMG7mw
Message-ID: <CAN+1Hbpr=QUqr=mYMuEHOMMJ43-m2eTndb_d9iYZayu2Qxjmuw@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
To: Alexander Adolf <alexander.adolf@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000727e9b0646051351"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000727e9b0646051351
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, Dec 15, 2025 at 4:58=E2=80=AFPM Alexander Adolf <
alexander.adolf@HIDDEN> wrote:

> Hello St=C3=A9phane,
>
> many thanks for your mindful comment.
>
> St=C3=A9phane Marks <shipmints@HIDDEN> writes:
>
> > [...]
> > One thing I might change is to use notifications since this is a
> > system-wide effect.  For an example, look for
> > NSApplicationDidChangeScreenParametersNotification in nsterm.m.
>
> This notification is under a "#ifdef NS_IMPL_GNUSTEP" in nsterm.m. I
> checked the docs to see whether it could be used for this purpose. It os
> mentioned in the GNUStep GUI library API docs [1]:
>
> ---------------------------- Begin Quote -----------------------------
> NSApplicationDidChangeScreenParametersNotification
>
> NSString* NSApplicationDidChangeScreenParametersNotification;
> Availability: OpenStep
>
> Description forthcoming.
> ----------------------------- End Quote ------------------------------
>
> Hm, a bit terse, isn't it?
>
> The OpenStep docs [2] don't seem to mention it at all?
>
> Apple's documentation for the notification [3] describes it as "Posted
> when the configuration of the displays attached to the computer is
> changed." And goes on to further explain: "The configuration change can
> be made either programmatically or when the user changes settings in the
> Displays control panel." Building an Emacs with this notification
> enabled on macOS confirms this description; the notification is posted
> when a screen is added to, or removed from the system, or when the size
> or resolution of a screen changes. It is not posted when the appearance
> toggles between light and dark.
>
> I looked through the GNUStep, and macOS docs for another notification
> that indicates a light/dark appearance change, but could not seem to
> find one. Have I missed it?
>
> The method I am using in my patch (callback on EmacsView) is one of
> Apple's officially suggested ways of reacting to appearance changes as
> per their docs [4].
>
> Inspired by your comment, I tried the other method described in [4],
> which is using a key-value-observer on the effectiveAppearance property
> of the EmacsApp. The code is slightly wordier than the view callback,
> but not much.
>
> Both approaches cause the functions on the Lisp hook to be called
> exactly once per appearance change.
>
> For illustration of what the KVO method implementation looks like, I am
> attaching a new patch, too.
>
>
> Many thanks and looking forward to your thoughts,
>
>   --alexander
>
> [1]
> https://www.gnustep.org/resources/documentation/Developer/Gui/Reference/T=
ypesAndConstants.html#variable$NSApplicationDidChangeScreenParametersNotifi=
cation
> [2] https://www.gnustep.org/resources/OpenStepSpec/OpenStepSpec.html
> [3]
> https://developer.apple.com/documentation/appkit/nsapplication/didchanges=
creenparametersnotification
> [4]
> https://developer.apple.com/documentation/uikit/supporting-dark-mode-in-y=
our-interface?language=3Dobjc#Update-custom-views-using-specific-methods
>

I think you'd add an observer to the effectiveAppearance property via the
notification center.  See
https://developer.apple.com/documentation/objectivec/nsobject-swift.class/a=
ddobserver(_:forkeypath:options:context:)?language=3Dobjc
and
also in nsterm.m look for addObserver which I think you already found.
It's the same concept but the key would be something
like forKeyPath:NSStringFromSelector(@selector(effectiveAppearance)).

--000000000000727e9b0646051351
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Mon, Dec 15, 2025 at 4:58=E2=80=AFPM Alexander Adolf &lt;<a href=3D"mail=
to:alexander.adolf@HIDDEN">alexander.adolf@HIDDEN=
</a>&gt; wrote:</span></div></div><div class=3D"gmail_quote gmail_quote_con=
tainer"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex=
;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello St=C3=A9pha=
ne,<br>
<br>
many thanks for your mindful comment.<br>
<br>
St=C3=A9phane Marks &lt;<a href=3D"mailto:shipmints@HIDDEN" target=3D"_b=
lank">shipmints@HIDDEN</a>&gt; writes:<br>
<br>
&gt; [...]<br>
&gt; One thing I might change is to use notifications since this is a<br>
&gt; system-wide effect.=C2=A0 For an example, look for<br>
&gt; NSApplicationDidChangeScreenParametersNotification in nsterm.m.<br>
<br>
This notification is under a &quot;#ifdef NS_IMPL_GNUSTEP&quot; in nsterm.m=
. I<br>
checked the docs to see whether it could be used for this purpose. It os<br=
>
mentioned in the GNUStep GUI library API docs [1]:<br>
<br>
---------------------------- Begin Quote -----------------------------<br>
NSApplicationDidChangeScreenParametersNotification<br>
<br>
NSString* NSApplicationDidChangeScreenParametersNotification;<br>
Availability: OpenStep<br>
<br>
Description forthcoming.<br>
----------------------------- End Quote ------------------------------<br>
<br>
Hm, a bit terse, isn&#39;t it?<br>
<br>
The OpenStep docs [2] don&#39;t seem to mention it at all?<br>
<br>
Apple&#39;s documentation for the notification [3] describes it as &quot;Po=
sted<br>
when the configuration of the displays attached to the computer is<br>
changed.&quot; And goes on to further explain: &quot;The configuration chan=
ge can<br>
be made either programmatically or when the user changes settings in the<br=
>
Displays control panel.&quot; Building an Emacs with this notification<br>
enabled on macOS confirms this description; the notification is posted<br>
when a screen is added to, or removed from the system, or when the size<br>
or resolution of a screen changes. It is not posted when the appearance<br>
toggles between light and dark.<br>
<br>
I looked through the GNUStep, and macOS docs for another notification<br>
that indicates a light/dark appearance change, but could not seem to<br>
find one. Have I missed it?<br>
<br>
The method I am using in my patch (callback on EmacsView) is one of<br>
Apple&#39;s officially suggested ways of reacting to appearance changes as<=
br>
per their docs [4].<br>
<br>
Inspired by your comment, I tried the other method described in [4],<br>
which is using a key-value-observer on the effectiveAppearance property<br>
of the EmacsApp. The code is slightly wordier than the view callback,<br>
but not much.<br>
<br>
Both approaches cause the functions on the Lisp hook to be called<br>
exactly once per appearance change.<br>
<br>
For illustration of what the KVO method implementation looks like, I am<br>
attaching a new patch, too.<br>
<br>
<br>
Many thanks and looking forward to your thoughts,<br>
<br>
=C2=A0 --alexander<br>
<br>
[1] <a href=3D"https://www.gnustep.org/resources/documentation/Developer/Gu=
i/Reference/TypesAndConstants.html#variable$NSApplicationDidChangeScreenPar=
ametersNotification" rel=3D"noreferrer" target=3D"_blank">https://www.gnust=
ep.org/resources/documentation/Developer/Gui/Reference/TypesAndConstants.ht=
ml#variable$NSApplicationDidChangeScreenParametersNotification</a><br>
[2] <a href=3D"https://www.gnustep.org/resources/OpenStepSpec/OpenStepSpec.=
html" rel=3D"noreferrer" target=3D"_blank">https://www.gnustep.org/resource=
s/OpenStepSpec/OpenStepSpec.html</a><br>
[3] <a href=3D"https://developer.apple.com/documentation/appkit/nsapplicati=
on/didchangescreenparametersnotification" rel=3D"noreferrer" target=3D"_bla=
nk">https://developer.apple.com/documentation/appkit/nsapplication/didchang=
escreenparametersnotification</a><br>
[4] <a href=3D"https://developer.apple.com/documentation/uikit/supporting-d=
ark-mode-in-your-interface?language=3Dobjc#Update-custom-views-using-specif=
ic-methods" rel=3D"noreferrer" target=3D"_blank">https://developer.apple.co=
m/documentation/uikit/supporting-dark-mode-in-your-interface?language=3Dobj=
c#Update-custom-views-using-specific-methods</a><br></blockquote><div><br><=
/div><div class=3D"gmail_default" style=3D"font-family:monospace">I think y=
ou&#39;d add an observer to the effectiveAppearance property via the notifi=
cation center.=C2=A0 See=C2=A0<a href=3D"https://developer.apple.com/docume=
ntation/objectivec/nsobject-swift.class/addobserver(_:forkeypath:options:co=
ntext:)?language=3Dobjc">https://developer.apple.com/documentation/objectiv=
ec/nsobject-swift.class/addobserver(_:forkeypath:options:context:)?language=
=3Dobjc</a>=C2=A0and also in nsterm.m look for addObserver which I think yo=
u already found.=C2=A0 It&#39;s the same concept but the key would be somet=
hing like=C2=A0forKeyPath:NSStringFromSelector(@selector(effectiveAppearanc=
e)).</div></div></div>

--000000000000727e9b0646051351--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 15 Dec 2025 21:58:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 15 16:58:50 2025
Received: from localhost ([127.0.0.1]:44935 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vVGaf-0002LG-Qz
	for submit <at> debbugs.gnu.org; Mon, 15 Dec 2025 16:58:50 -0500
Received: from www191.your-server.de ([188.40.2.11]:60432)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vVGab-0002Ky-Rc
 for 80001 <at> debbugs.gnu.org; Mon, 15 Dec 2025 16:58:48 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=condition-alpha.com; s=default2503; h=Content-Type:MIME-Version:Date:
 In-reply-to:References:Subject:Cc:To:From:Message-Id:Sender:Reply-To:
 Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:
 Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
 bh=Uq5y9Y0AjOwkBQxgA2+3mMP0FynxssVBFDlbCUaihiQ=; b=MqTiDwBFls+WQVIiNfi76FFS/F
 y1C1PEG/DIL6pfmMXPUDY+dS4k9Tc/vsztwtTE4YwO0KmhV2q9g8Uew7aa8OvKTPBACuyr4+zE93S
 2SZiLXFU971VXsqzoaFnjj9g9yqon+H0nKq61AKFg2wotO9zgvPJhS8x0Y+9czKcs8UGQQr4VO21N
 E9f9gMIP0yGHyb5+G0Sm8huNfd7jpDqJ76eBA2+WVF64cqC+l6ChwN6PMvqsu6TvGSvo4fToCDqaS
 bp6Wv1u/VXYBxpVJg//kANQpMgcopb7NCUtUwW6UDeg7b9AJ0bl8EGS/Ca8POLIWAgn6IYDIjmg8m
 fDJmXrMw==;
Received: from sslproxy07.your-server.de ([78.47.199.104])
 by www191.your-server.de with esmtpsa  (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96.2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vVGaV-0005nN-0s; Mon, 15 Dec 2025 22:58:39 +0100
Received: from localhost ([127.0.0.1])
 by sslproxy07.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vVGaU-000BAM-11; Mon, 15 Dec 2025 22:58:39 +0100
Message-Id: <48b076098cb5b69ba3d7188980c2839b@HIDDEN>
From: Alexander Adolf <alexander.adolf@HIDDEN>
To: =?utf-8?Q?St=C3=A9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
 <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
In-reply-to: <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
Date: Mon, 15 Dec 2025 22:58:38 +0100
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Virus-Scanned: Clear (ClamAV 1.0.9/27851/Mon Dec 15 10:20:33 2025)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hello St=C3=A9phane,

many thanks for your mindful comment.

St=C3=A9phane Marks <shipmints@HIDDEN> writes:

> [...]
> One thing I might change is to use notifications since this is a
> system-wide effect.  For an example, look for
> NSApplicationDidChangeScreenParametersNotification in nsterm.m.

This notification is under a "#ifdef NS_IMPL_GNUSTEP" in nsterm.m. I
checked the docs to see whether it could be used for this purpose. It os
mentioned in the GNUStep GUI library API docs [1]:

---------------------------- Begin Quote -----------------------------
NSApplicationDidChangeScreenParametersNotification

NSString* NSApplicationDidChangeScreenParametersNotification;
Availability: OpenStep

Description forthcoming.
----------------------------- End Quote ------------------------------

Hm, a bit terse, isn't it?

The OpenStep docs [2] don't seem to mention it at all?

Apple's documentation for the notification [3] describes it as "Posted
when the configuration of the displays attached to the computer is
changed." And goes on to further explain: "The configuration change can
be made either programmatically or when the user changes settings in the
Displays control panel." Building an Emacs with this notification
enabled on macOS confirms this description; the notification is posted
when a screen is added to, or removed from the system, or when the size
or resolution of a screen changes. It is not posted when the appearance
toggles between light and dark.

I looked through the GNUStep, and macOS docs for another notification
that indicates a light/dark appearance change, but could not seem to
find one. Have I missed it?

The method I am using in my patch (callback on EmacsView) is one of
Apple's officially suggested ways of reacting to appearance changes as
per their docs [4].

Inspired by your comment, I tried the other method described in [4],
which is using a key-value-observer on the effectiveAppearance property
of the EmacsApp. The code is slightly wordier than the view callback,
but not much.

Both approaches cause the functions on the Lisp hook to be called
exactly once per appearance change.

For illustration of what the KVO method implementation looks like, I am
attaching a new patch, too.


Many thanks and looking forward to your thoughts,

  --alexander

[1] https://www.gnustep.org/resources/documentation/Developer/Gui/Reference=
/TypesAndConstants.html#variable$NSApplicationDidChangeScreenParametersNoti=
fication
[2] https://www.gnustep.org/resources/OpenStepSpec/OpenStepSpec.html
[3] https://developer.apple.com/documentation/appkit/nsapplication/didchang=
escreenparametersnotification
[4] https://developer.apple.com/documentation/uikit/supporting-dark-mode-in=
-your-interface?language=3Dobjc#Update-custom-views-using-specific-methods



--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
 filename="master-7821fb5-KVO Method Implementation.patch"

From 7821fb59569c1cc373b5c7c8143479ac245cda91 Mon Sep 17 00:00:00 2001
From: Alexander Adolf <alexander.adolf@HIDDEN>
Date: Mon, 15 Dec 2025 22:57:24 +0100
Subject: [PATCH] KVO Method Implementation

---
 src/nsterm.m | 67 +++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 53 insertions(+), 14 deletions(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index 5f47dbffc51..35952cd5ffc 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6354,7 +6354,16 @@ - (void)applicationDidFinishLaunching: (NSNotification *)notification
 	       allocInitFromFile:
 		 build_string("icons/hicolor/128x128/apps/emacs.png")]];
   }
-#endif
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+  /* Add a key-value-observer for the app's effective appearance
+     property.  This is used to generate a TOOLKIT_THEME_CHANGED_EVENT
+     when the UI appearance changes. */
+  [self addObserver:self
+	 forKeyPath:@"effectiveAppearance"
+	    options:NSKeyValueObservingOptionNew
+	    context:nil];
+#endif /* MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 */
+#endif /* NS_IMPL_COCOA */
 
   ns_send_appdefined (-2);
 }
@@ -6538,6 +6547,36 @@ - (void)applicationDidResignActive: (NSNotification *)notification
   ns_send_appdefined (-1);
 }
 
+#if (defined NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101400)
+- (void)observeValueForKeyPath:(NSString *)keyPath
+                      ofObject:(id)object
+                        change:(NSDictionary *)change
+                       context:(void *)context
+{
+  if ([keyPath isEqualToString:@"effectiveAppearance"])
+    {
+      if (! ([[change valueForKey:@"notificationIsPrior"] intValue] == 1))
+	{
+	  NSAppearanceName appearance = [[self effectiveAppearance] name];
+	  struct input_event inev;
+
+	  EVENT_INIT (inev);
+	  inev.kind = TOOLKIT_THEME_CHANGED_EVENT;
+	  inev.arg = [appearance localizedStandardContainsString:@"Dark"] ? Qdark : Qlight;
+	  kbd_buffer_store_event (&inev);
+	  ns_send_appdefined (-1);
+	}
+    }
+  else
+    {
+      /* Any unrecognized key path must belong to super */
+      [super observeValueForKeyPath:keyPath
+			   ofObject:object
+			     change:change
+			    context:context];
+    }
+}
+#endif /* (defined NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) */
 
 
 /* ==========================================================================
@@ -8141,19 +8180,19 @@ - (void)viewDidEndLiveResize
 }
 #endif /* NS_IMPL_COCOA */
 
-#if (defined NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101400)
-- (void)viewDidChangeEffectiveAppearance
-{
-  NSAppearanceName appearance = [[NSApp effectiveAppearance] name];
-  struct input_event inev;
-
-  EVENT_INIT (inev);
-  inev.kind = TOOLKIT_THEME_CHANGED_EVENT;
-  inev.arg = [appearance localizedStandardContainsString:@"Dark"] ? Qdark : Qlight;
-  kbd_buffer_store_event (&inev);
-  ns_send_appdefined (-1);
-}
-#endif /* (defined NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) */
+// #if (defined NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101400)
+// - (void)viewDidChangeEffectiveAppearance
+// {
+//   NSAppearanceName appearance = [[NSApp effectiveAppearance] name];
+//   struct input_event inev;
+//
+//   EVENT_INIT (inev);
+//   inev.kind = TOOLKIT_THEME_CHANGED_EVENT;
+//   inev.arg = [appearance localizedStandardContainsString:@"Dark"] ? Qdark : Qlight;
+//   kbd_buffer_store_event (&inev);
+//   ns_send_appdefined (-1);
+// }
+// #endif /* (defined NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) */
 
 - (void)resizeWithOldSuperviewSize: (NSSize)oldSize
 {
-- 
2.50.1


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at 80001 <at> debbugs.gnu.org:


Received: (at 80001) by debbugs.gnu.org; 13 Dec 2025 21:31:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 13 16:31:45 2025
Received: from localhost ([127.0.0.1]:43602 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vUXDM-0002zi-PE
	for submit <at> debbugs.gnu.org; Sat, 13 Dec 2025 16:31:45 -0500
Received: from mail-vs1-xe33.google.com ([2607:f8b0:4864:20::e33]:58787)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1vUXDJ-0002zU-Tn
 for 80001 <at> debbugs.gnu.org; Sat, 13 Dec 2025 16:31:42 -0500
Received: by mail-vs1-xe33.google.com with SMTP id
 ada2fe7eead31-5dfb5fcf063so777011137.1
 for <80001 <at> debbugs.gnu.org>; Sat, 13 Dec 2025 13:31:41 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1765661496; x=1766266296; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=fWRZtx2xztQCfkYbTYKzSehGa5K3RVkCVvqgPgynrgA=;
 b=dBTuVfSWHBKqjWnBrXw47jh14rN1z9yPiovkrY8NKS4JVuCdsQdawMhxv5OkI3cwE8
 GLoXuDIxih1gj1qW70Cu4LEUCfo/VADqwLxqd0cx8e+uP43eYkOa5kulllYWBGpqzdeD
 eCyLks8LrQ+icG3Enjz+HeJGRL9NpSfKN5JUIBPP14ucT4bwJFGEmVofPCrp3KwSraA3
 h82lmkNClIokML1H96svQRb+0b2zx29tXoao2i82GTggR58a62oWjqQgHmcFZUmhBcqs
 0P9XhRjTXDxyWawK0aDk1BgrXV2VIS07YDJ4LZmXb29ccK5x7Z+46zUDkc4z3Hzv+Cn2
 fMzA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1765661496; x=1766266296;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=fWRZtx2xztQCfkYbTYKzSehGa5K3RVkCVvqgPgynrgA=;
 b=j81ujMDSrDBWFfKIw/P1bJbDSh1OTADD2h2GcIp5B0WZp/HLRv30MvlC5yuJiSQI3d
 DUiu4BzcNH+YIUNG8SQfACiSaq1u5+Y3KLxa0jabDgcZVIux+5sqMQpAQaoljxjiNe5E
 wfgQG4+jVWbiWkvbXr0xsAEqKB1Y2xXtxVBLQ4sATuwWQf4uXd37G4QU/B2lUe6uvmu+
 hbQlDNcwyfu8NQ0v9iqH4pATqkaEBI3VNWZmLGuTX3VPK0JgCrcSczdldeelgUnRj1de
 KYvHWep3F8WQe02XkSGl1VBPRazDkhzSt+xsHWleJm1N5ZClYiXk8JfwPmeG1TLOsU7Z
 durQ==
X-Gm-Message-State: AOJu0YxN7nfp8LqMzY8oF5n3bSzJAu8XKP4K2B5StIrxs/EvIPSm0chn
 t2lVkyhe5U8VxHpSejI49lrDE9ZmZzYd1F8+0vFldLXuPUG8bjUxpjPR/Lg8dgP01P3TZlfh+Q6
 77hl7ULm6WWtO1b4txMAV93eVQEgec5JS5/wU
X-Gm-Gg: AY/fxX4Gol0+F2xYvZAco0e1tu0wzpLrOU1Xe7r5FDhY+QVBPcZ79OcaFR3BZC+vIvh
 f2fPVtssAHLESEH/CQ6T7SA2aJr4CEJuXPtK3Y6NPTYo86SNw934uiJ+OE7lGBly4qPBlu237we
 KxCWJKQZVW+w7UJWilh7+TjqqzX1ecQxj7IOYQvqQqXjrcc64zRE0qz8mgiIw+hB7a/gfdV+JMc
 WU4NXqaZK4gizqll4Ne/alAVDqo2elF7rpGPJ2hYXcdafdRgowxmv5gyUcrJLQndk23GsED
X-Google-Smtp-Source: AGHT+IHtrX6cbXlGCH2tcKy6BeanpgHyONjEkyW+j0VS+CHdydfYPNWNzHVW18PqRMomgNDDo5q2w933OvMmozTjgrA=
X-Received: by 2002:a05:6102:cd2:b0:5dd:89ad:1100 with SMTP id
 ada2fe7eead31-5e827474e16mr1753747137.6.1765661496092; Sat, 13 Dec 2025
 13:31:36 -0800 (PST)
MIME-Version: 1.0
References: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
In-Reply-To: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Sat, 13 Dec 2025 16:31:25 -0500
X-Gm-Features: AQt7F2pXgmZShmVtClCc0hZ4QnovUHOWzVH340eTXl-KtM5K5pFeOV0rvOQ4kl8
Message-ID: <CAN+1HbqeheCoEnt36zOcq73UGn7Km9M0=sM1GiH0LpEwUwFLaQ@HIDDEN>
Subject: Re: bug#80001: [PATCH 1/1] Support `toolkit-theme-set-functions' on
 macOS
To: Alexander Adolf <alexander.adolf@HIDDEN>
Content-Type: multipart/alternative; boundary="00000000000044aa290645dc1a93"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80001
Cc: 80001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--00000000000044aa290645dc1a93
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Sat, Dec 13, 2025 at 4:08=E2=80=AFPM Alexander Adolf via Bug reports for=
 GNU
Emacs, the Swiss army knife of text editors <bug-gnu-emacs@HIDDEN> wrote:

> Hello,
>
> this is a follow-up to bug#79776 (patch by Ahmed Khanzada, merged into
> master with commit bc0f662573684919af7440b41531e9861a86ce6f), and the
> improvements to it by Po Lu (commit
> 7550791287503ebc582c92841f6483032aa0b050).
>
> The attached patch enables the `toolkit-theme-set-functions'
> functionality on macOS 10.14+, too.
>
>
> Hoping to have helped, and looking forward to your thoughts,
>

I have a vague recollection of this coming up in the last year or so.
Might be worth searching through the archives.

One thing I might change is to use notifications since this is a
system-wide effect.  For an example, look for
NSApplicationDidChangeScreenParametersNotification in nsterm.m.

--00000000000044aa290645dc1a93
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Sat, Dec 13, 2025 at 4:08=E2=80=AFPM Alexander Adolf via Bug reports for=
 GNU Emacs, the Swiss army knife of text editors &lt;<a href=3D"mailto:bug-=
gnu-emacs@HIDDEN">bug-gnu-emacs@HIDDEN</a>&gt; wrote:</span></div></div><=
div class=3D"gmail_quote gmail_quote_container"><blockquote class=3D"gmail_=
quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,=
204);padding-left:1ex">Hello,<br>
<br>
this is a follow-up to bug#79776 (patch by Ahmed Khanzada, merged into<br>
master with commit bc0f662573684919af7440b41531e9861a86ce6f), and the<br>
improvements to it by Po Lu (commit<br>
7550791287503ebc582c92841f6483032aa0b050).<br>
<br>
The attached patch enables the `toolkit-theme-set-functions&#39;<br>
functionality on macOS 10.14+, too.<br>
<br>
<br>
Hoping to have helped, and looking forward to your thoughts,<br></blockquot=
e><div><br></div><div class=3D"gmail_default" style=3D"font-family:monospac=
e">I have a vague recollection of this coming up in the last year or so.=C2=
=A0 Might be worth searching through the archives.</div><div class=3D"gmail=
_default" style=3D"font-family:monospace"><br></div><div class=3D"gmail_def=
ault" style=3D"font-family:monospace">One thing I might change is to use no=
tifications since this is a system-wide effect.=C2=A0 For an example, look =
for NSApplicationDidChangeScreenParametersNotification in nsterm.m.</div></=
div></div>

--00000000000044aa290645dc1a93--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 13 Dec 2025 21:07:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 13 16:07:37 2025
Received: from localhost ([127.0.0.1]:43393 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vUWq0-0001I1-Sk
	for submit <at> debbugs.gnu.org; Sat, 13 Dec 2025 16:07:37 -0500
Received: from lists.gnu.org ([2001:470:142::17]:57452)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vUWpy-0001Ho-Nx
 for submit <at> debbugs.gnu.org; Sat, 13 Dec 2025 16:07:35 -0500
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 <alexander.adolf@HIDDEN>)
 id 1vUWpt-0004p5-CW
 for bug-gnu-emacs@HIDDEN; Sat, 13 Dec 2025 16:07:29 -0500
Received: from www191.your-server.de ([188.40.2.11])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vUWpr-0000ES-1F
 for bug-gnu-emacs@HIDDEN; Sat, 13 Dec 2025 16:07:29 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=condition-alpha.com; s=default2503; h=Content-Type:MIME-Version:Date:
 Subject:To:From:Message-Id:Sender:Reply-To:Cc:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References;
 bh=tfNrinwQMhUuPilaGjdLs7kCEAeNFmd/ORttL1N/feM=; b=a44j4X9cDZVNKzScNaXnuofv+B
 peVWG1ZMajz532FpE+DTRUCFX8zjotxzfMGupkWbnDx8FO/WdPgk99NN2YBAZP+1pxp4MHREfYtxj
 gQbp5JXxsxneZPE+dgXwlrJChVaTyBHfvQP6M8cb/vdY8/lgeA9UVUd4FghOUrzgs7VcYc8QAi6pP
 6bmcs5YHtGgttwpieW6tUJzypnAWTPwnOH/tMzq5bSlfuEYA/GCAG2KYNCq0bR4qXqVpOWYpoXsBJ
 P5hb42WBfNt0GeR328oM42ao+0djEXGuc3PO+Hdry5wA08PhL++avFrW99RXRBEBbO2EKREBgy+7H
 AL+343dw==;
Received: from sslproxy03.your-server.de ([88.198.220.132])
 by www191.your-server.de with esmtpsa  (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96.2) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vUWpi-000HXI-1Q for bug-gnu-emacs@HIDDEN;
 Sat, 13 Dec 2025 22:07:18 +0100
Received: from localhost ([127.0.0.1])
 by sslproxy03.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384
 (Exim 4.96) (envelope-from <alexander.adolf@HIDDEN>)
 id 1vUWph-0008zb-2t for bug-gnu-emacs@HIDDEN;
 Sat, 13 Dec 2025 22:07:18 +0100
Message-Id: <848e423933b9a9d97c5c4834da5b739b@HIDDEN>
From: Alexander Adolf <alexander.adolf@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH 1/1] Support `toolkit-theme-set-functions' on macOS
Date: Sat, 13 Dec 2025 22:07:17 +0100
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Virus-Scanned: Clear (ClamAV 1.0.9/27849/Sat Dec 13 10:10:38 2025)
Received-SPF: pass client-ip=188.40.2.11;
 envelope-from=alexander.adolf@HIDDEN; helo=www191.your-server.de
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 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,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

--=-=-=
Content-Type: text/plain

Hello,

this is a follow-up to bug#79776 (patch by Ahmed Khanzada, merged into
master with commit bc0f662573684919af7440b41531e9861a86ce6f), and the
improvements to it by Po Lu (commit
7550791287503ebc582c92841f6483032aa0b050).

The attached patch enables the `toolkit-theme-set-functions'
functionality on macOS 10.14+, too.


Hoping to have helped, and looking forward to your thoughts,

  --alexander



--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Support--toolkit-theme-set-functions'-on-macOS.patch
Content-Description: [PATCH 1/1] Support `toolkit-theme-set-functions' on macOS

From 9ed07cf0997a1ba783ac701dc551137b3ae67fb5 Mon Sep 17 00:00:00 2001
From: Alexander Adolf <alexander.adolf@HIDDEN>
Date: Sat, 13 Dec 2025 21:25:13 +0100
Subject: [PATCH 1/1] Support `toolkit-theme-set-functions' on macOS

* src/nsterm.m: ([EmacsView viewDidChangeEffectiveAppearance]):
New method generating special toolkit theme events when the
macOS appearance changes.
* etc/NEWS (toolkit-theme-set-functions): Add macOS 10.14+ to the list
of supported systems, and try to improve the wording of the entry.
---
 etc/NEWS     | 10 ++++++----
 src/nsterm.m | 13 +++++++++++++
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 27204393f7a..2ce605fe5d7 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3656,10 +3656,12 @@ automatically toggling between them.
 
 ---
 *** 'toolkit-theme-set-functions' called when the toolkit theme is set for Emacs.
-When the theme is set on PGTK, Android, or MS-Windows systems,
-'toolkit-theme-set-functions' is called.  The result is stored in the
-variable 'toolkit-theme' as either symbol 'dark' or 'light', but may be
-extended to encompass other toolkit-specific symbols in the future.
+When the theme is set on PGTK, Android, MS-Windows, or macOS 10.14+
+systems, functions on 'toolkit-theme-set-functions' will be called with
+the new theme.  The toolkit theme is also stored in the variable
+'toolkit-theme'.  Currently the toolkit theme is conveyed as either
+symbol 'dark' or 'light', but may be extended to encompass other
+toolkit-specific symbols in the future.
 
 
 * Changes in Emacs 31.1 on Non-Free Operating Systems
diff --git a/src/nsterm.m b/src/nsterm.m
index 66b4a3c82e7..5f47dbffc51 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -8141,6 +8141,19 @@ - (void)viewDidEndLiveResize
 }
 #endif /* NS_IMPL_COCOA */
 
+#if (defined NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101400)
+- (void)viewDidChangeEffectiveAppearance
+{
+  NSAppearanceName appearance = [[NSApp effectiveAppearance] name];
+  struct input_event inev;
+
+  EVENT_INIT (inev);
+  inev.kind = TOOLKIT_THEME_CHANGED_EVENT;
+  inev.arg = [appearance localizedStandardContainsString:@"Dark"] ? Qdark : Qlight;
+  kbd_buffer_store_event (&inev);
+  ns_send_appdefined (-1);
+}
+#endif /* (defined NS_IMPL_COCOA) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) */
 
 - (void)resizeWithOldSuperviewSize: (NSSize)oldSize
 {
-- 
2.50.1 (Apple Git-155)


--=-=-=--




Acknowledgement sent to Alexander Adolf <alexander.adolf@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#80001; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 7 Jan 2026 20:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.