Last active
April 3, 2024 17:10
-
-
Save ngquerol/33e099eceae527b368bdf196c95d1ba3 to your computer and use it in GitHub Desktop.
Patch to make emacs (emacs-28 branch) aware of the macOS 10.14+ system appearance changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 2fd6ee35bbcdd0a07e882e07706edaa01815853b Mon Sep 17 00:00:00 2001 | |
From: "Nicolas G. Querol" <[email protected]> | |
Date: Wed, 11 Nov 2020 12:35:47 +0100 | |
Subject: [PATCH] Add `ns-system-appearance-change-functions' hook | |
This implements a new hook, effective only on macOS >= 10.14 (Mojave), | |
that is called when the system changes its appearance (e.g. from light | |
to dark). Users can then implement functions that take this change | |
into account, for instance to load a particular theme. | |
Minor changes are also made to select the right "dark" appearance | |
(NSAppearanceNameDarkAqua) on macOS versions >= 10.14, the previous one | |
(NSAppearanceNameVibrantDark) being deprecated. | |
* src/frame.h (enum ns_appearance_type): Add new | |
"ns_appearance_dark_aqua" case. | |
* src/nsfns.m (defun x-create-frame): Use "dark aqua" appearance on | |
macOS >= 10.14. | |
* src/nsterm.m: | |
- (ns_set_appearance): Use "dark aqua" appearance on | |
macOS >= 10.14, reset appearance to the system one | |
if `ns-appearance' frame parameter is not set to | |
either `dark' or `light'. | |
- (initFrameFromEmacs): Use "dark aqua" appearance on | |
macOS >= 10.14. | |
- (EmacsApp) Add the `systemDidChangeAppearance' private method, | |
as well as the appropriate Key-Value Observing calls to update | |
the frame's appearance when the system (and thus the app's) | |
appearance changes. | |
- Add `ns-system-appearance-change-functions' hook variable and | |
symbol, to allow users to add functions that react to the | |
change of the system's appearance. | |
- Add `ns-system-appearance' variable, to allow users to consult | |
the current system appearance. | |
Here is an example on how to use this new feature: | |
(defun my/load-theme (appearance) | |
"Load theme, taking current system APPEARANCE into consideration." | |
(mapc #'disable-theme custom-enabled-themes) | |
(pcase appearance | |
('light (load-theme 'tango t)) | |
('dark (load-theme 'tango-dark t)))) | |
(add-hook 'ns-system-appearance-change-functions #'my/load-theme) | |
The hook being run on each system appearance change as well as at | |
startup time, Emacs should then always load the appropriate theme. | |
--- | |
src/frame.h | 3 +- | |
src/nsfns.m | 13 ++++- | |
src/nsterm.m | 153 ++++++++++++++++++++++++++++++++++++++++++++++----- | |
3 files changed, 153 insertions(+), 16 deletions(-) | |
diff --git a/src/frame.h b/src/frame.h | |
index b75ef79cff2..ebb992cbde9 100644 | |
--- a/src/frame.h | |
+++ b/src/frame.h | |
@@ -71,7 +71,8 @@ #define EMACS_FRAME_H | |
{ | |
ns_appearance_system_default, | |
ns_appearance_aqua, | |
- ns_appearance_vibrant_dark | |
+ ns_appearance_vibrant_dark, | |
+ ns_appearance_dark_aqua | |
}; | |
#endif | |
#endif /* HAVE_WINDOW_SYSTEM */ | |
diff --git a/src/nsfns.m b/src/nsfns.m | |
index d11d4146ebd..c06cf12d8b6 100644 | |
--- a/src/nsfns.m | |
+++ b/src/nsfns.m | |
@@ -1315,14 +1315,25 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. | |
store_frame_param (f, Qundecorated, FRAME_UNDECORATED (f) ? Qt : Qnil); | |
#ifdef NS_IMPL_COCOA | |
+#ifndef NSAppKitVersionNumber10_14 | |
+#define NSAppKitVersionNumber10_14 1671 | |
+#endif | |
tem = gui_display_get_arg (dpyinfo, parms, Qns_appearance, NULL, NULL, | |
RES_TYPE_SYMBOL); | |
if (EQ (tem, Qdark)) | |
- FRAME_NS_APPEARANCE (f) = ns_appearance_vibrant_dark; | |
+ if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_14) | |
+ { | |
+ FRAME_NS_APPEARANCE (f) = ns_appearance_dark_aqua; | |
+ } | |
+ else | |
+ { | |
+ FRAME_NS_APPEARANCE (f) = ns_appearance_vibrant_dark; | |
+ } | |
else if (EQ (tem, Qlight)) | |
FRAME_NS_APPEARANCE (f) = ns_appearance_aqua; | |
else | |
FRAME_NS_APPEARANCE (f) = ns_appearance_system_default; | |
+ | |
store_frame_param (f, Qns_appearance, | |
(!NILP (tem) && !EQ (tem, Qunbound)) ? tem : Qnil); | |
diff --git a/src/nsterm.m b/src/nsterm.m | |
index ea8770c93e9..3a4d9dca8ec 100644 | |
--- a/src/nsterm.m | |
+++ b/src/nsterm.m | |
@@ -1878,11 +1878,25 @@ Hide the window (X11 semantics) | |
return; | |
if (EQ (new_value, Qdark)) | |
- FRAME_NS_APPEARANCE (f) = ns_appearance_vibrant_dark; | |
- else if (EQ (new_value, Qlight)) | |
- FRAME_NS_APPEARANCE (f) = ns_appearance_aqua; | |
+ { | |
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 | |
+#ifndef NSAppKitVersionNumber10_14 | |
+#define NSAppKitVersionNumber10_14 1671 | |
+#endif | |
+ if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_14) | |
+ FRAME_NS_APPEARANCE(f) = ns_appearance_dark_aqua; | |
+ else | |
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 */ | |
+ FRAME_NS_APPEARANCE(f) = ns_appearance_vibrant_dark; | |
+ } | |
+ else if (EQ(new_value, Qlight)) | |
+ { | |
+ FRAME_NS_APPEARANCE (f) = ns_appearance_aqua; | |
+ } | |
else | |
- FRAME_NS_APPEARANCE (f) = ns_appearance_system_default; | |
+ { | |
+ FRAME_NS_APPEARANCE (f) = ns_appearance_system_default; | |
+ } | |
[window setAppearance]; | |
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 */ | |
@@ -5375,6 +5389,7 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes. | |
========================================================================== */ | |
+static const void *kEmacsAppKVOContext = &kEmacsAppKVOContext; | |
@implementation EmacsApp | |
@@ -5620,6 +5635,18 @@ - (void)applicationDidFinishLaunching: (NSNotification *)notification | |
object:nil]; | |
#endif | |
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 | |
+ [self addObserver:self | |
+ forKeyPath:NSStringFromSelector(@selector(effectiveAppearance)) | |
+ options:NSKeyValueObservingOptionInitial|NSKeyValueObservingOptionNew | |
+ context:&kEmacsAppKVOContext]; | |
+ | |
+ pending_funcalls = Fcons(list3(Qrun_hook_with_args, | |
+ Qns_system_appearance_change_functions, | |
+ Vns_system_appearance), | |
+ pending_funcalls); | |
+#endif | |
+ | |
#ifdef NS_IMPL_COCOA | |
/* Some functions/methods in CoreFoundation/Foundation increase the | |
maximum number of open files for the process in their first call. | |
@@ -5658,6 +5685,68 @@ - (void)antialiasThresholdDidChange:(NSNotification *)notification | |
#endif | |
} | |
+- (void)observeValueForKeyPath:(NSString *)keyPath | |
+ ofObject:(id)object | |
+ change:(NSDictionary *)change | |
+ context:(void *)context | |
+{ | |
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 | |
+ if (context == kEmacsAppKVOContext | |
+ && object == self | |
+ && [keyPath isEqualToString: | |
+ NSStringFromSelector (@selector(effectiveAppearance))]) | |
+ [self systemAppearanceDidChange: | |
+ [change objectForKey:NSKeyValueChangeNewKey]]; | |
+ else | |
+#endif /* (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 */ | |
+ [super observeValueForKeyPath:keyPath | |
+ ofObject:object | |
+ change:change | |
+ context:context]; | |
+} | |
+ | |
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 | |
+#ifndef NSAppKitVersionNumber10_14 | |
+#define NSAppKitVersionNumber10_14 1671 | |
+#endif | |
+- (void)systemAppearanceDidChange:(NSAppearance *)newAppearance | |
+{ | |
+ | |
+ if (NSAppKitVersionNumber < NSAppKitVersionNumber10_14) | |
+ return; | |
+ | |
+ NSAppearanceName appearance_name = | |
+ [newAppearance bestMatchFromAppearancesWithNames:@[ | |
+ NSAppearanceNameAqua, NSAppearanceNameDarkAqua | |
+ ]]; | |
+ | |
+ BOOL is_dark_appearance = | |
+ [appearance_name isEqualToString:NSAppearanceNameDarkAqua]; | |
+ Vns_system_appearance = is_dark_appearance ? Qdark : Qlight; | |
+ | |
+ run_system_appearance_change_hook (); | |
+} | |
+ | |
+static inline void run_system_appearance_change_hook (void) | |
+{ | |
+ if (NILP (Vns_system_appearance_change_functions)) | |
+ return; | |
+ | |
+ block_input (); | |
+ | |
+ bool owfi = waiting_for_input; | |
+ waiting_for_input = false; | |
+ | |
+ safe_call2 (Qrun_hook_with_args, | |
+ Qns_system_appearance_change_functions, | |
+ Vns_system_appearance); | |
+ Fredisplay(Qt); | |
+ | |
+ waiting_for_input = owfi; | |
+ | |
+ unblock_input (); | |
+} | |
+#endif /* (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 */ | |
/* Termination sequences: | |
C-x C-c: | |
@@ -5822,6 +5911,14 @@ - (void)applicationDidResignActive: (NSNotification *)notification | |
ns_send_appdefined (-1); | |
} | |
+- (void)applicationWillTerminate:(NSNotification *)notification | |
+{ | |
+ NSTRACE ("[EmacsApp applicationWillTerminate:]"); | |
+ | |
+ [self removeObserver:self | |
+ forKeyPath:NSStringFromSelector(@selector(effectiveAppearance)) | |
+ context:&kEmacsAppKVOContext]; | |
+} | |
/* ========================================================================== | |
@@ -8819,17 +8916,26 @@ - (void)setAppearance | |
#define NSAppKitVersionNumber10_10 1343 | |
#endif | |
- if (NSAppKitVersionNumber < NSAppKitVersionNumber10_10) | |
- return; | |
- | |
- if (FRAME_NS_APPEARANCE (f) == ns_appearance_vibrant_dark) | |
- appearance = | |
- [NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]; | |
- else if (FRAME_NS_APPEARANCE (f) == ns_appearance_aqua) | |
- appearance = | |
- [NSAppearance appearanceNamed:NSAppearanceNameAqua]; | |
+ if (NSAppKitVersionNumber < NSAppKitVersionNumber10_10) | |
+ return; | |
- [self setAppearance:appearance]; | |
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 | |
+#ifndef NSAppKitVersionNumber10_14 | |
+#define NSAppKitVersionNumber10_14 1671 | |
+#endif | |
+ if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_14 | |
+ && FRAME_NS_APPEARANCE(f) == ns_appearance_dark_aqua) | |
+ appearance = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]; | |
+ else | |
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 */ | |
+ if (FRAME_NS_APPEARANCE(f) == ns_appearance_vibrant_dark) | |
+ appearance = | |
+ [NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]; | |
+ else if (FRAME_NS_APPEARANCE (f) == ns_appearance_aqua) | |
+ appearance = | |
+ [NSAppearance appearanceNamed:NSAppearanceNameAqua]; | |
+ | |
+ [self setAppearance:appearance]; | |
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 */ | |
} | |
@@ -9996,6 +10102,25 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with | |
This variable is ignored on macOS < 10.7 and GNUstep. Default is t. */); | |
ns_use_mwheel_momentum = YES; | |
+ DEFVAR_LISP ("ns-system-appearance", Vns_system_appearance, | |
+ doc: /* Current system appearance, i.e. `dark' or `light'. | |
+ | |
+This variable is ignored on macOS < 10.14 and GNUstep. Default is nil. */); | |
+ Vns_system_appearance = Qnil; | |
+ DEFSYM(Qns_system_appearance, "ns-system-appearance"); | |
+ | |
+ DEFVAR_LISP ("ns-system-appearance-change-functions", | |
+ Vns_system_appearance_change_functions, | |
+ doc: /* List of functions to call when the system appearance changes. | |
+Each function is called with a single argument, which corresponds to the new | |
+system appearance (`dark' or `light'). | |
+ | |
+This hook is also run once at startup. | |
+ | |
+This variable is ignored on macOS < 10.14 and GNUstep. Default is nil. */); | |
+ Vns_system_appearance_change_functions = Qnil; | |
+ DEFSYM(Qns_system_appearance_change_functions, "ns-system-appearance-change-functions"); | |
+ | |
/* TODO: Move to common code. */ | |
DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars, | |
doc: /* SKIP: real doc in xterm.c. */); | |
-- | |
2.44.0 |
@ngquerol, glad to hear from you!
After quick testing of the new patch I can confirm is working as expected.
FYI While I'm was not able to catch the automatic dark/light mode switching during my workflow, Emacs change the theme on OS resume from sleep just perfectly!
From now I will stick with the updated patch.
Thanks!
After resuming from sleep:
Process: Emacs [12804]
Path: /Applications/Emacs.app/Contents/MacOS/Emacs
Identifier: org.gnu.Emacs
Version: Version 28.0.50 (9.0)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Emacs [12804]
User ID: 501
Date/Time: 2020-11-10 17:54:44.165 +0200
OS Version: Mac OS X 10.15.7 (19H2)
Report Version: 12
Anonymous UUID: 91C25591-E15C-1151-477D-A560DC709258
Sleep/Wake UUID: 70690975-396C-4F94-A378-5BB5D8183107
Time Awake Since Boot: 240000 seconds
Time Since Wake: 8 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff69d5533a __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff69e11e60 pthread_kill + 430
2 libsystem_c.dylib 0x00007fff69c6c93e raise + 26
3 org.gnu.Emacs 0x00000001067feded terminate_due_to_signal + 150
4 org.gnu.Emacs 0x00000001067ff4cd emacs_abort + 15
5 org.gnu.Emacs 0x00000001067cc482 ns_term_shutdown + 119
6 org.gnu.Emacs 0x00000001066ef19e shut_down_emacs + 339
7 org.gnu.Emacs 0x00000001067fedbb terminate_due_to_signal + 100
8 org.gnu.Emacs 0x00000001067ff4cd emacs_abort + 15
9 org.gnu.Emacs 0x000000010675defd signal_or_quit + 1246
10 org.gnu.Emacs 0x0000000106800c39 Fsignal + 32
11 org.gnu.Emacs 0x0000000106800c4f xsignal + 9
12 org.gnu.Emacs 0x0000000106800ac4 xsignal1 + 28
13 org.gnu.Emacs 0x00000001068013f6 invalid_syntax + 22
14 org.gnu.Emacs 0x0000000106781b52 read1 + 6516
15 org.gnu.Emacs 0x0000000106781bbe read0 + 20
16 org.gnu.Emacs 0x000000010677ffa6 read_list + 287
17 org.gnu.Emacs 0x00000001067809bf read1 + 2017
18 org.gnu.Emacs 0x0000000106781bbe read0 + 20
19 org.gnu.Emacs 0x00000001067809ab read1 + 1997
20 org.gnu.Emacs 0x000000010677feca read_list + 67
21 org.gnu.Emacs 0x00000001067809bf read1 + 2017
22 org.gnu.Emacs 0x0000000106781bbe read0 + 20
23 org.gnu.Emacs 0x000000010677d3e3 read_internal_start + 423
24 org.gnu.Emacs 0x000000010675f2ba funcall_subr + 272
25 org.gnu.Emacs 0x000000010675eb65 Ffuncall + 646
26 org.gnu.Emacs 0x0000000106793758 exec_byte_code + 1163
27 org.gnu.Emacs 0x000000010675eb03 Ffuncall + 548
28 org.gnu.Emacs 0x0000000106793758 exec_byte_code + 1163
29 org.gnu.Emacs 0x000000010675eb03 Ffuncall + 548
30 org.gnu.Emacs 0x000000010675eb65 Ffuncall + 646
31 org.gnu.Emacs 0x0000000106793758 exec_byte_code + 1163
32 org.gnu.Emacs 0x000000010675eb03 Ffuncall + 548
33 org.gnu.Emacs 0x000000010675ef4d call1 + 46
34 org.gnu.Emacs 0x00000001066f8c6d timer_check + 834
35 org.gnu.Emacs 0x00000001066f79a8 readable_events + 18
36 org.gnu.Emacs 0x00000001066f891d get_input_pending + 118
37 org.gnu.Emacs 0x00000001066f7803 swallow_events + 38
38 org.gnu.Emacs 0x0000000106654da6 Fredisplay + 20
39 org.gnu.Emacs 0x00000001067ccff9 -[EmacsApp systemAppearanceDidChange:] + 199
40 com.apple.Foundation 0x00007fff321dd470 NSKeyValueNotifyObserver + 335
41 com.apple.Foundation 0x00007fff322cc72c NSKeyValueDidChange + 437
42 com.apple.Foundation 0x00007fff3236e441 NSKeyValueDidChangeWithPerThreadPendingNotifications + 146
43 com.apple.AppKit 0x00007fff2d49cd36 -[NSApplication(NSApplicationAppearance_Internal) _observeValueForSystemAppearanceKeyPath:ofObject:change:] + 141
44 org.gnu.Emacs 0x00000001067ccf23 -[EmacsApp observeValueForKeyPath:ofObject:change:context:] + 184
45 com.apple.Foundation 0x00007fff321dd470 NSKeyValueNotifyObserver + 335
46 com.apple.Foundation 0x00007fff322cc72c NSKeyValueDidChange + 437
47 com.apple.Foundation 0x00007fff321d01bc -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 741
48 com.apple.Foundation 0x00007fff321fae65 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] + 68
49 com.apple.Foundation 0x00007fff32218e6f _NSSetObjectValueAndNotify + 269
50 com.apple.AppKit 0x00007fff2d3c04d8 -[NSSystemAppearanceProxy _systemAppearanceDidChange] + 256
51 com.apple.AppKit 0x00007fff2d3c06d4 -[NSSystemAppearanceProxy _menuBarAppearanceChanged:] + 27
52 com.apple.CoreFoundation 0x00007fff2fb6580f __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
53 com.apple.CoreFoundation 0x00007fff2fb657a3 ___CFXRegistrationPost1_block_invoke + 63
54 com.apple.CoreFoundation 0x00007fff2fb65718 _CFXRegistrationPost1 + 372
55 com.apple.CoreFoundation 0x00007fff2fb65384 ___CFXNotificationPost_block_invoke + 80
56 com.apple.CoreFoundation 0x00007fff2fb354fd -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1554
57 com.apple.CoreFoundation 0x00007fff2fb349a9 _CFXNotificationPost + 1351
58 com.apple.Foundation 0x00007fff321b2786 -[NSNotificationCenter postNotificationName:object:userInfo:] + 59
59 com.apple.AppKit 0x00007fff2d77ce30 -[NSWorkspaceNotificationCenter _menuBarDidChangeAppearance:] + 142
60 com.apple.CoreFoundation 0x00007fff2fb6580f __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
61 com.apple.CoreFoundation 0x00007fff2fb657a3 ___CFXRegistrationPost1_block_invoke + 63
62 com.apple.CoreFoundation 0x00007fff2fb65718 _CFXRegistrationPost1 + 372
63 com.apple.CoreFoundation 0x00007fff2fb65384 ___CFXNotificationPost_block_invoke + 80
64 com.apple.CoreFoundation 0x00007fff2fb354fd -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1554
65 com.apple.CoreFoundation 0x00007fff2fb349a9 _CFXNotificationPost + 1351
66 com.apple.CoreFoundation 0x00007fff2fb65885 CFNotificationCenterPostNotificationWithOptions + 110
67 com.apple.SkyLight 0x00007fff5efa0208 post_coordinated_distributed_notification + 205
68 com.apple.SkyLight 0x00007fff5ee02f8f CGSPostLocalNotification + 430
69 com.apple.SkyLight 0x00007fff5ee029cc (anonymous namespace)::notify_datagram_handler(unsigned int, CGSDatagramType, void*, unsigned long, void*) + 98
70 com.apple.SkyLight 0x00007fff5ee06ba2 CGSDatagramReadStream::dispatch_next_main_queue_datagram() + 242
71 com.apple.SkyLight 0x00007fff5f0378da invocation function for block in CGSDatagramReadStream::dispatch_main_queue_datagrams_async(dispatch_queue_s*, CGSDatagramReadStream*) + 54
72 libdispatch.dylib 0x00007fff69bb36c4 _dispatch_call_block_and_release + 12
73 libdispatch.dylib 0x00007fff69bb4658 _dispatch_client_callout + 8
74 libdispatch.dylib 0x00007fff69bbfcab _dispatch_main_queue_callback_4CF + 936
75 com.apple.CoreFoundation 0x00007fff2fbaee81 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
76 com.apple.CoreFoundation 0x00007fff2fb6ec87 __CFRunLoopRun + 2028
77 com.apple.CoreFoundation 0x00007fff2fb6de3e CFRunLoopRunSpecific + 462
78 com.apple.HIToolbox 0x00007fff2e79aabd RunCurrentEventLoopInMode + 292
79 com.apple.HIToolbox 0x00007fff2e79a7d5 ReceiveNextEventCommon + 584
80 com.apple.HIToolbox 0x00007fff2e79a579 _BlockUntilNextEventMatchingListInModeWithFilter + 64
81 com.apple.AppKit 0x00007fff2cde0039 _DPSNextEvent + 883
82 com.apple.AppKit 0x00007fff2cdde880 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
83 com.apple.AppKit 0x00007fff2cdd058e -[NSApplication run] + 658
84 org.gnu.Emacs 0x00000001067cc5fe -[EmacsApp run] + 317
85 org.gnu.Emacs 0x00000001067cb376 ns_select + 938
86 org.gnu.Emacs 0x000000010679b1bb wait_reading_process_output + 3405
87 org.gnu.Emacs 0x0000000106654d66 sit_for + 310
88 org.gnu.Emacs 0x00000001066f5924 read_char + 3269
89 org.gnu.Emacs 0x00000001066f35e0 read_key_sequence + 1250
90 org.gnu.Emacs 0x00000001066f2274 command_loop_1 + 865
91 org.gnu.Emacs 0x000000010675d6ef internal_condition_case + 84
92 org.gnu.Emacs 0x00000001066feeb2 command_loop_2 + 37
93 org.gnu.Emacs 0x000000010675d37a internal_catch + 74
94 org.gnu.Emacs 0x00000001067ff09b recursive_edit_1.cold.1 + 69
95 org.gnu.Emacs 0x00000001066f193b recursive_edit_1 + 217
96 org.gnu.Emacs 0x00000001066f1a45 Frecursive_edit + 226
97 org.gnu.Emacs 0x00000001066f0f6f main + 7543
98 libdyld.dylib 0x00007fff69c0dcc9 start + 1
@muffinmad, could you try the latest revision of this patch ? Hopefully that resolves your issues.
@muffinmad, could you try the latest revision of this patch ? Hopefully that resolves your issues.
Sure.
Just for the record, that was a single crash.
@muffinmad, any crashes to report? If not, I'll make a PR to the formulas that use it.
@ngquerol No crashes so far.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@muffinmad, you commenting this gist had me thinking I should do something about it 😀
So here is an updated version of the patch that works consistently when Emacs is in the background.
It also exposes the current system appearance through a new variable,
ns-system-appearance
.Let me know how that's working for you !