GNU bug report logs - #47291
[PATCH] Auto-detect ns-appearance of frames and call a hook when it changes

Previous Next

Package: emacs;

Reported by: Daphne Preston-Kendal <dpk <at> nonceword.org>

Date: Sun, 21 Mar 2021 12:56:02 UTC

Severity: wishlist

Tags: patch

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Daphne Preston-Kendal <dpk <at> nonceword.org>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Auto-detect ns-appearance of frames and call a hook when it
 changes
Date: Sun, 21 Mar 2021 11:48:10 +0100
[Message part 1 (text/plain, inline)]
This is a slightly cleaned-up version of the patch I initially posted for
commentary on emacs-devel.
<https://lists.gnu.org/archive/html/emacs-devel/2021-03/msg00482.html>

The patch makes two closely related changes: when a new frame is
created, the ns-appearance parameter (which was already in Emacs) is
bound to 'light or 'dark depending on the system theme. (Previously,
it could be set explicitly and Emacs would respect that change on a
per-frame basis, but if it wasn't explicitly set it was unbound.)
Secondly, it registers an event handler for changes to the system-wide
theme, and when the system theme changes, it changes the ns-appearance
parameter of all frames to match the new system theme, and runs a new
hook, ns-dark-mode-changed-hook so that users can e.g. set a new Emacs
theme to match the new system theme or whatever.

The patch is against Emacs HEAD as of time of writing. (3cbf92323c)

As mentioned on emacs-devel, this is my first Emacs patch and my first
time programming Objective-C in a long while, so I’d definitely
appreciate feedback!


Daphne Preston-Kendal

[0001-Auto-detect-ns-appearance-of-frames-and-call-a-hook-.patch (application/octet-stream, attachment)]
[Message part 3 (text/plain, inline)]


This bug report was last modified 3 years and 220 days ago.

Previous Next


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