From a64d24cbd9051b79a226947d0a02bd97688c0379 Mon Sep 17 00:00:00 2001 From: Daneel Date: Mon, 2 Mar 2026 20:36:17 +0100 Subject: [PATCH] patches: fix two compile errors (stray unbind_to, voiceoverSetPoint scope) Two bugs introduced during rebase/amend: 1. Stray 'unbind_to (count, Qnil)' in ns_focus (P0000): A hunk was misplaced into ns_focus where 'count' is not declared. The comment and unbind_to belonged at the end of ns_zoom_track_completion, which already has a correct unbind_to. Remove the duplicate from ns_focus. 2. 'voiceoverSetPoint = NO' in EmacsView::initFrameFromEmacs: (P0008): voiceoverSetPoint is a BOOL ivar of EmacsAXBuffer, not EmacsView. Setting it in EmacsView's init method causes 'undeclared identifier'. ObjC BOOL ivars zero-initialize to NO automatically. Remove the line. voiceoverSetPoint is consumed/set in EmacsAXBuffer methods only. --- ...-with-macOS-Zoom-for-cursor-tracking.patch | 2 +- ...lity-base-classes-and-text-extractio.patch | 2 +- ...fer-accessibility-element-core-proto.patch | 2 +- ...tification-dispatch-and-mode-line-el.patch | 2 +- ...ive-span-elements-for-Tab-navigation.patch | 2 +- ...essibility-with-EmacsView-and-redisp.patch | 2 +- ...r-accessibility-section-to-macOS-app.patch | 2 +- ...lay-completion-candidates-for-VoiceO.patch | 2 +- ...d-frame-completion-candidates-for-Vo.patch | 56 +++++++------------ 9 files changed, 29 insertions(+), 43 deletions(-) diff --git a/patches/0000-ns-integrate-with-macOS-Zoom-for-cursor-tracking.patch b/patches/0000-ns-integrate-with-macOS-Zoom-for-cursor-tracking.patch index ad12f82..57ac230 100644 --- a/patches/0000-ns-integrate-with-macOS-Zoom-for-cursor-tracking.patch +++ b/patches/0000-ns-integrate-with-macOS-Zoom-for-cursor-tracking.patch @@ -1,4 +1,4 @@ -From 66e54b491f6158a160f2191e9549da7e9a666fa2 Mon Sep 17 00:00:00 2001 +From cac0509dbcd958d3bc71cac18c414af1543ca993 Mon Sep 17 00:00:00 2001 From: Martin Sukany Date: Sat, 28 Feb 2026 22:39:35 +0100 Subject: [PATCH 0/8] ns: integrate with macOS Zoom for cursor tracking diff --git a/patches/0001-ns-add-accessibility-base-classes-and-text-extractio.patch b/patches/0001-ns-add-accessibility-base-classes-and-text-extractio.patch index 4175197..df7659c 100644 --- a/patches/0001-ns-add-accessibility-base-classes-and-text-extractio.patch +++ b/patches/0001-ns-add-accessibility-base-classes-and-text-extractio.patch @@ -1,4 +1,4 @@ -From d58eefa46c7673eff2272ebcceea82c031152e10 Mon Sep 17 00:00:00 2001 +From af06bbe06123968e08a2ea81ec2c24995f0a91f6 Mon Sep 17 00:00:00 2001 From: Martin Sukany Date: Sat, 28 Feb 2026 12:58:11 +0100 Subject: [PATCH 1/8] ns: add accessibility base classes and text extraction diff --git a/patches/0002-ns-implement-buffer-accessibility-element-core-proto.patch b/patches/0002-ns-implement-buffer-accessibility-element-core-proto.patch index 77fc2db..429773e 100644 --- a/patches/0002-ns-implement-buffer-accessibility-element-core-proto.patch +++ b/patches/0002-ns-implement-buffer-accessibility-element-core-proto.patch @@ -1,4 +1,4 @@ -From 07e5007d2ad00a191339286c41ad12aa8439636f Mon Sep 17 00:00:00 2001 +From 60f0e223190b158679322411b4186b7a378114e7 Mon Sep 17 00:00:00 2001 From: Martin Sukany Date: Sat, 28 Feb 2026 12:58:11 +0100 Subject: [PATCH 2/8] ns: implement buffer accessibility element (core diff --git a/patches/0003-ns-add-buffer-notification-dispatch-and-mode-line-el.patch b/patches/0003-ns-add-buffer-notification-dispatch-and-mode-line-el.patch index c526236..6626840 100644 --- a/patches/0003-ns-add-buffer-notification-dispatch-and-mode-line-el.patch +++ b/patches/0003-ns-add-buffer-notification-dispatch-and-mode-line-el.patch @@ -1,4 +1,4 @@ -From 6df7e595967100a26599fd9a575f7f947238e2f1 Mon Sep 17 00:00:00 2001 +From 7bd0a761b78c1c05fe74e150d841bf15686efbb9 Mon Sep 17 00:00:00 2001 From: Martin Sukany Date: Sat, 28 Feb 2026 12:58:11 +0100 Subject: [PATCH 3/8] ns: add buffer notification dispatch and mode-line diff --git a/patches/0004-ns-add-interactive-span-elements-for-Tab-navigation.patch b/patches/0004-ns-add-interactive-span-elements-for-Tab-navigation.patch index 9cbfffd..894b537 100644 --- a/patches/0004-ns-add-interactive-span-elements-for-Tab-navigation.patch +++ b/patches/0004-ns-add-interactive-span-elements-for-Tab-navigation.patch @@ -1,4 +1,4 @@ -From e270501ae776e953e369fcfdaf5ba2237c3a44c3 Mon Sep 17 00:00:00 2001 +From e4d2760f5e99cb6015fb85e68db37fa766a4ab53 Mon Sep 17 00:00:00 2001 From: Martin Sukany Date: Sat, 28 Feb 2026 12:58:11 +0100 Subject: [PATCH 4/8] ns: add interactive span elements for Tab navigation diff --git a/patches/0005-ns-integrate-accessibility-with-EmacsView-and-redisp.patch b/patches/0005-ns-integrate-accessibility-with-EmacsView-and-redisp.patch index cf104e2..d24a87b 100644 --- a/patches/0005-ns-integrate-accessibility-with-EmacsView-and-redisp.patch +++ b/patches/0005-ns-integrate-accessibility-with-EmacsView-and-redisp.patch @@ -1,4 +1,4 @@ -From 0ac5f50dfe0a4111a6538e1106b6f4ac5259659e Mon Sep 17 00:00:00 2001 +From 7c042d446bddee16a83e4cd8f0050e24e262ef77 Mon Sep 17 00:00:00 2001 From: Martin Sukany Date: Sat, 28 Feb 2026 12:58:11 +0100 Subject: [PATCH 5/8] ns: integrate accessibility with EmacsView and redisplay diff --git a/patches/0006-doc-add-VoiceOver-accessibility-section-to-macOS-app.patch b/patches/0006-doc-add-VoiceOver-accessibility-section-to-macOS-app.patch index dfc0227..efd632c 100644 --- a/patches/0006-doc-add-VoiceOver-accessibility-section-to-macOS-app.patch +++ b/patches/0006-doc-add-VoiceOver-accessibility-section-to-macOS-app.patch @@ -1,4 +1,4 @@ -From 7e419d0b59c4d4cbec800306a61eecaaa1921500 Mon Sep 17 00:00:00 2001 +From b33ad461f56034270d8461ad48e838f5f36a98da Mon Sep 17 00:00:00 2001 From: Martin Sukany Date: Sat, 28 Feb 2026 12:58:11 +0100 Subject: [PATCH 6/8] doc: add VoiceOver accessibility section to macOS diff --git a/patches/0007-ns-announce-overlay-completion-candidates-for-VoiceO.patch b/patches/0007-ns-announce-overlay-completion-candidates-for-VoiceO.patch index ae02792..080b718 100644 --- a/patches/0007-ns-announce-overlay-completion-candidates-for-VoiceO.patch +++ b/patches/0007-ns-announce-overlay-completion-candidates-for-VoiceO.patch @@ -1,4 +1,4 @@ -From c1fa92dbf8caa6faffed7a0813c92bed2f983092 Mon Sep 17 00:00:00 2001 +From dd8b0911c8a690aa7110b881b6a88977e2fc67f1 Mon Sep 17 00:00:00 2001 From: Daneel Date: Mon, 2 Mar 2026 18:39:46 +0100 Subject: [PATCH 7/8] ns: announce overlay completion candidates for VoiceOver diff --git a/patches/0008-ns-announce-child-frame-completion-candidates-for-Vo.patch b/patches/0008-ns-announce-child-frame-completion-candidates-for-Vo.patch index 69c227f..f93076f 100644 --- a/patches/0008-ns-announce-child-frame-completion-candidates-for-Vo.patch +++ b/patches/0008-ns-announce-child-frame-completion-candidates-for-Vo.patch @@ -1,4 +1,4 @@ -From 2de5c652dbcc355549941cc9940bac9f31ab3ea6 Mon Sep 17 00:00:00 2001 +From 13da736610fc631a9ea420d6918eefd2791940d3 Mon Sep 17 00:00:00 2001 From: Daneel Date: Mon, 2 Mar 2026 18:49:13 +0100 Subject: [PATCH 8/8] ns: announce child frame completion candidates for @@ -33,8 +33,8 @@ area announcements. doc/emacs/macos.texi | 14 +- etc/NEWS | 18 +- src/nsterm.h | 20 ++ - src/nsterm.m | 515 ++++++++++++++++++++++++++++++++++++++++--- - 4 files changed, 519 insertions(+), 48 deletions(-) + src/nsterm.m | 508 ++++++++++++++++++++++++++++++++++++++++--- + 4 files changed, 512 insertions(+), 48 deletions(-) diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi index 8d4a7825d8..03a657f970 100644 @@ -149,7 +149,7 @@ index 21a93bc799..bdd40b8eb7 100644 @end diff --git a/src/nsterm.m b/src/nsterm.m -index 523f79d235..a885249f30 100644 +index 523f79d235..45f83f3ac6 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1126,24 +1126,19 @@ Uses CFAbsoluteTimeGetCurrent() (~5 ns, a VDSO read) for timing. */ @@ -187,20 +187,7 @@ index 523f79d235..a885249f30 100644 } /* Scan overlay before-string / after-string properties in the -@@ -1464,6 +1459,12 @@ so the visual offset is (ov_line + 1) * line_h from - #endif - gsaved = YES; - } -+ /* Unbind record_unwind_current_buffer for both overlay and child -+ frame paths. The overlay path calls unbind_to before return; -+ this call covers the child frame path and the no-candidate path. -+ unbind_to is idempotent if count equals the current specpdl -+ index (i.e. already unbound by the overlay path). */ -+ unbind_to (count, Qnil); - } - - -@@ -7407,6 +7408,112 @@ visual line index for Zoom (skip whitespace-only lines +@@ -7407,6 +7402,112 @@ visual line index for Zoom (skip whitespace-only lines return nil; } @@ -313,7 +300,7 @@ index 523f79d235..a885249f30 100644 /* Build accessibility text for window W, skipping invisible text. Populates *OUT_START with the buffer start charpos. Populates *OUT_RUNS with an array of visible runs and *OUT_NRUNS -@@ -8149,15 +8256,23 @@ - (void)ensureTextCache +@@ -8149,15 +8250,23 @@ - (void)ensureTextCache if (!b) return; @@ -343,7 +330,7 @@ index 523f79d235..a885249f30 100644 if (cachedText && cachedTextModiff == chars_modiff && cachedTextStart == BUF_BEGV (b) && pt >= cachedTextStart -@@ -8587,6 +8702,11 @@ - (void)setAccessibilitySelectedTextRange:(NSRange)range +@@ -8587,6 +8696,11 @@ - (void)setAccessibilitySelectedTextRange:(NSRange)range [self ensureTextCache]; @@ -355,7 +342,7 @@ index 523f79d235..a885249f30 100644 specpdl_ref count = SPECPDL_INDEX (); record_unwind_current_buffer (); /* Ensure block_input is always matched by unblock_input even if -@@ -9042,15 +9162,23 @@ - (void)postFocusedCursorNotification:(ptrdiff_t)point +@@ -9042,15 +9156,23 @@ - (void)postFocusedCursorNotification:(ptrdiff_t)point = @(ns_ax_text_state_change_selection_move); moveInfo[@"AXTextSelectionDirection"] = @(direction); moveInfo[@"AXTextChangeElement"] = self; @@ -385,7 +372,7 @@ index 523f79d235..a885249f30 100644 NSAccessibilitySelectedTextChangedNotification, moveInfo); -@@ -9148,12 +9276,17 @@ user expectation ("w" jumps to next word and reads it). */ +@@ -9148,12 +9270,17 @@ user expectation ("w" jumps to next word and reads it). */ } } @@ -408,7 +395,7 @@ index 523f79d235..a885249f30 100644 if (cachedText && granularity == ns_ax_text_selection_granularity_line) { -@@ -9218,6 +9351,11 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b +@@ -9218,6 +9345,11 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b block_input (); specpdl_ref count2 = SPECPDL_INDEX (); @@ -420,7 +407,7 @@ index 523f79d235..a885249f30 100644 record_unwind_protect_void (unblock_input); record_unwind_current_buffer (); if (b != current_buffer) -@@ -9394,12 +9532,29 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f +@@ -9394,12 +9526,29 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f if (!b) return; @@ -450,7 +437,7 @@ index 523f79d235..a885249f30 100644 if (modiff != self.cachedModiff) { self.cachedModiff = modiff; -@@ -9413,6 +9568,7 @@ Text property changes (e.g. face updates from +@@ -9413,6 +9562,7 @@ Text property changes (e.g. face updates from { self.cachedCharsModiff = chars_modiff; [self postTextChangedNotification:point]; @@ -458,7 +445,7 @@ index 523f79d235..a885249f30 100644 } } -@@ -9435,8 +9591,15 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property +@@ -9435,8 +9585,15 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property displayed in the minibuffer. In normal editing buffers, font-lock and other modes change BUF_OVERLAY_MODIFF on every redisplay, triggering O(overlays) work per keystroke. @@ -476,7 +463,7 @@ index 523f79d235..a885249f30 100644 goto skip_overlay_scan; int selected_line = -1; -@@ -9482,7 +9645,18 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property +@@ -9482,7 +9639,18 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property self.cachedPoint = point; self.cachedMarkActive = markActive; @@ -496,7 +483,7 @@ index 523f79d235..a885249f30 100644 NSInteger direction = ns_ax_text_selection_direction_discontiguous; if (point > oldPoint) direction = ns_ax_text_selection_direction_next; -@@ -9530,6 +9704,58 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property +@@ -9530,6 +9698,58 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property granularity = ns_ax_text_selection_granularity_line; } @@ -555,7 +542,7 @@ index 523f79d235..a885249f30 100644 /* Post notifications for focused and non-focused elements. */ if ([self isAccessibilityFocused]) [self postFocusedCursorNotification:point -@@ -9672,6 +9898,13 @@ - (NSRect)accessibilityFrame +@@ -9672,6 +9892,13 @@ - (NSRect)accessibilityFrame if (vis_start >= vis_end) return @[]; @@ -569,7 +556,7 @@ index 523f79d235..a885249f30 100644 block_input (); specpdl_ref blk_count = SPECPDL_INDEX (); record_unwind_protect_void (unblock_input); -@@ -9796,6 +10029,7 @@ than O(chars). Fall back to pos+1 as safety net. */ +@@ -9796,6 +10023,7 @@ than O(chars). Fall back to pos+1 as safety net. */ pos = span_end; } @@ -577,7 +564,7 @@ index 523f79d235..a885249f30 100644 return [[spans copy] autorelease]; } -@@ -9977,6 +10211,10 @@ - (void)dealloc +@@ -9977,6 +10205,10 @@ - (void)dealloc #endif [accessibilityElements release]; @@ -588,18 +575,17 @@ index 523f79d235..a885249f30 100644 [[self menu] release]; [super dealloc]; } -@@ -11426,6 +11664,10 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f +@@ -11426,6 +11658,9 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f windowClosing = NO; processingCompose = NO; +#ifdef NS_IMPL_COCOA + childFrameLastBuffer = Qnil; -+ voiceoverSetPoint = NO; +#endif scrollbarsNeedingUpdate = 0; fs_state = FULLSCREEN_NONE; fs_before_fs = next_maximized = -1; -@@ -12734,6 +12976,154 @@ - (id)accessibilityFocusedUIElement +@@ -12734,6 +12969,154 @@ - (id)accessibilityFocusedUIElement The existing elements carry cached state (modiff, point) from the previous redisplay cycle. Rebuilding first would create fresh elements with current values, making change detection impossible. */ @@ -754,7 +740,7 @@ index 523f79d235..a885249f30 100644 - (void)postAccessibilityUpdates { NSTRACE ("[EmacsView postAccessibilityUpdates]"); -@@ -12744,11 +13134,64 @@ - (void)postAccessibilityUpdates +@@ -12744,11 +13127,64 @@ - (void)postAccessibilityUpdates /* Re-entrance guard: VoiceOver callbacks during notification posting can trigger redisplay, which calls ns_update_end, which calls us