From f108952af1d3ddf667dadef5be5ea9c07c414e48 Mon Sep 17 00:00:00 2001 From: Daneel Date: Sun, 1 Mar 2026 10:05:49 +0100 Subject: [PATCH] patches: fix remaining line-length violations and doc string corruption - Correct three pre-existing DEFVAR_BOOL doc strings (ns-use-native- fullscreen, ns-use-mwheel-acceleration, ns-use-mwheel-momentum) that were accidentally modified by an earlier rebase; restore original text - Break @property line in nsterm.h to 79 chars - Replace em-dash with --- and break 80-char comment line in patch 0004 --- ...lity-base-classes-and-text-extractio.patch | 46 +++++-------------- ...fer-accessibility-element-core-proto.patch | 4 +- ...tification-dispatch-and-mode-line-el.patch | 4 +- ...ive-span-elements-for-Tab-navigation.patch | 13 +++--- ...essibility-with-EmacsView-and-redisp.patch | 12 ++--- ...r-accessibility-section-to-macOS-app.patch | 6 +-- ...lay-completion-candidates-for-VoiceO.patch | 18 ++++---- ...d-frame-completion-candidates-for-Vo.patch | 18 ++++---- 8 files changed, 50 insertions(+), 71 deletions(-) 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 b1559eb..1354460 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 63788743619d25f4f41cb90b2eea5b48e0fcbc15 Mon Sep 17 00:00:00 2001 +From 18e509b9307d232559549da448be008bed11d03c 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 @@ -28,15 +28,15 @@ rect via glyph matrix. ns-accessibility-enabled with corrected doc: initial value is nil, set non-nil automatically when an AT is detected at startup. --- - src/nsterm.h | 130 +++++++++++++++ - src/nsterm.m | 462 ++++++++++++++++++++++++++++++++++++++++++++++++++- - 2 files changed, 589 insertions(+), 3 deletions(-) + src/nsterm.h | 131 +++++++++++++++ + src/nsterm.m | 456 +++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 587 insertions(+) diff --git a/src/nsterm.h b/src/nsterm.h -index ea6e7ba..7adbb92 100644 +index ea6e7ba..5746e9e 100644 --- a/src/nsterm.h +++ b/src/nsterm.h -@@ -453,6 +453,123 @@ enum ns_return_frame_mode +@@ -453,6 +453,124 @@ enum ns_return_frame_mode @end @@ -144,7 +144,8 @@ index ea6e7ba..7adbb92 100644 +@property (nonatomic, assign) EmacsAXSpanType spanType; +@property (nonatomic, copy) NSString *spanLabel; +@property (nonatomic, copy) NSString *spanValue; -+@property (nonatomic, unsafe_unretained) EmacsAccessibilityBuffer *parentBuffer; ++@property (nonatomic, unsafe_unretained) ++ EmacsAccessibilityBuffer *parentBuffer; + +- (NSAccessibilityRole) accessibilityRole; +- (NSString *) accessibilityLabel; @@ -160,7 +161,7 @@ index ea6e7ba..7adbb92 100644 /* ========================================================================== The main Emacs view -@@ -471,6 +588,12 @@ enum ns_return_frame_mode +@@ -471,6 +589,12 @@ enum ns_return_frame_mode #ifdef NS_IMPL_COCOA char *old_title; BOOL maximizing_resize; @@ -173,7 +174,7 @@ index ea6e7ba..7adbb92 100644 #endif BOOL font_panel_active; NSFont *font_panel_result; -@@ -534,6 +657,13 @@ enum ns_return_frame_mode +@@ -534,6 +658,13 @@ enum ns_return_frame_mode - (void)windowWillExitFullScreen; - (void)windowDidExitFullScreen; - (void)windowDidBecomeKey; @@ -188,7 +189,7 @@ index ea6e7ba..7adbb92 100644 diff --git a/src/nsterm.m b/src/nsterm.m -index fc75910..e9ebac0 100644 +index fc75910..852e7f9 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -46,6 +46,7 @@ Updated by Christian Limpach (chris@nice.ch) @@ -659,16 +660,7 @@ index fc75910..e9ebac0 100644 Fput (Qalt, Qmodifier_value, make_fixnum (alt_modifier)); Fput (Qhyper, Qmodifier_value, make_fixnum (hyper_modifier)); Fput (Qmeta, Qmodifier_value, make_fixnum (meta_modifier)); -@@ -11797,7 +12244,7 @@ Convert an X font name (XLFD) to an NS font name. - doc: /* Non-nil means to use native fullscreen on Mac OS X 10.7 and later. - Nil means use fullscreen the old (< 10.7) way. The old way works better with - multiple monitors, but lacks tool bar. This variable is ignored on --Mac OS X < 10.7. Default is t. */); -+Mac OS X < 10.7. Default is nil. Set to t to enable VoiceOver support. */); - ns_use_native_fullscreen = YES; - ns_last_use_native_fullscreen = ns_use_native_fullscreen; - -@@ -11813,10 +12260,19 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with +@@ -11813,6 +12260,15 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with This variable is ignored on Mac OS X < 10.7 and GNUstep. */); ns_use_srgb_colorspace = YES; @@ -684,20 +676,6 @@ index fc75910..e9ebac0 100644 DEFVAR_BOOL ("ns-use-mwheel-acceleration", ns_use_mwheel_acceleration, doc: /* Non-nil means use macOS's standard mouse wheel acceleration. --This variable is ignored on macOS < 10.7 and GNUstep. Default is t. */); -+This variable is ignored on macOS < 10.7 and GNUstep. Default is nil. Set to t to enable VoiceOver support. */); - ns_use_mwheel_acceleration = YES; - - DEFVAR_LISP ("ns-mwheel-line-height", ns_mwheel_line_height, -@@ -11827,7 +12283,7 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with - - DEFVAR_BOOL ("ns-use-mwheel-momentum", ns_use_mwheel_momentum, - doc: /* Non-nil means mouse wheel scrolling uses momentum. --This variable is ignored on macOS < 10.7 and GNUstep. Default is t. */); -+This variable is ignored on macOS < 10.7 and GNUstep. Default is nil. Set to t to enable VoiceOver support. */); - ns_use_mwheel_momentum = YES; - - /* TODO: Move to common code. */ -- 2.43.0 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 0890caa..f964263 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 5273b52fe8e4c596574eff4392416d30c2942b7d Mon Sep 17 00:00:00 2001 +From 53141d7302932cdf7b4141c9617dd5eca68a14b6 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 @@ -27,7 +27,7 @@ loop is safe: it runs only on actual character modifications. 1 file changed, 1127 insertions(+) diff --git a/src/nsterm.m b/src/nsterm.m -index e9ebac0..64a6011 100644 +index 852e7f9..3e1ac74 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -7631,6 +7631,1133 @@ - (id)accessibilityTopLevelUIElement 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 0ea92b6..786ebf4 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 5f8b5394ec9bfdd344dbc10aee7514b1891b00d8 Mon Sep 17 00:00:00 2001 +From 5d1917d141ffb41a7d4e0c2d17633466cf8e506f 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 @@ -26,7 +26,7 @@ mode line. 1 file changed, 546 insertions(+) diff --git a/src/nsterm.m b/src/nsterm.m -index 64a6011..350111a 100644 +index 3e1ac74..d3015e2 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -8758,6 +8758,552 @@ - (NSRect)accessibilityFrame 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 6d17e25..1fb32b1 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 9c7e408085f52f1e44b6cb71e64448162e5c3e68 Mon Sep 17 00:00:00 2001 +From 45e436cf80b9adb67972bd1f5953ced3c90c0b61 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 @@ -14,14 +14,14 @@ elements with an AXPress action that sends a synthetic TAB keystroke. (accessibilityChildrenInNavigationOrder): Return cached span array, rebuilding lazily when interactiveSpansDirty is set. --- - src/nsterm.m | 286 +++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 286 insertions(+) + src/nsterm.m | 287 +++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 287 insertions(+) diff --git a/src/nsterm.m b/src/nsterm.m -index 350111a..992a5ce 100644 +index d3015e2..6d3b87a 100644 --- a/src/nsterm.m +++ b/src/nsterm.m -@@ -9304,6 +9304,292 @@ - (NSRect)accessibilityFrame +@@ -9304,6 +9304,293 @@ - (NSRect)accessibilityFrame @end @@ -219,7 +219,8 @@ index 350111a..992a5ce 100644 +- (BOOL) isAccessibilityFocused +{ + /* Read the cached point stored by EmacsAccessibilityBuffer on the main -+ thread — safe to read from any thread (plain ptrdiff_t, no Lisp calls). */ ++ thread --- safe to read from any thread (plain ptrdiff_t, ++ no Lisp calls). */ + EmacsAccessibilityBuffer *pb = self.parentBuffer; + if (!pb) + return NO; 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 ed07556..a17d1ee 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 0e8d5540c8993b2e91c437d20e47e7abeb12543f Mon Sep 17 00:00:00 2001 +From bd3036ae2bd5740e8275637bb32c674ed11c210f 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 @@ -51,7 +51,7 @@ index 80661a9..2b1f9e6 100644 ** Re-introduced dictation, lost in Emacs v30 (macOS). We lost macOS dictation in v30 when migrating to NSTextInputClient. diff --git a/src/nsterm.m b/src/nsterm.m -index 992a5ce..d9b8ecd 100644 +index 6d3b87a..7574da4 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1275,7 +1275,7 @@ If a completion candidate is selected (overlay or child frame), @@ -173,7 +173,7 @@ index 992a5ce..d9b8ecd 100644 /* =================================================================== EmacsAccessibilityInteractiveSpan — helpers and implementation =================================================================== */ -@@ -9635,6 +9683,7 @@ - (void)dealloc +@@ -9636,6 +9684,7 @@ - (void)dealloc [layer release]; #endif @@ -181,7 +181,7 @@ index 992a5ce..d9b8ecd 100644 [[self menu] release]; [super dealloc]; } -@@ -10983,6 +11032,32 @@ - (void)windowDidBecomeKey /* for direct calls */ +@@ -10984,6 +11033,32 @@ - (void)windowDidBecomeKey /* for direct calls */ XSETFRAME (event.frame_or_window, emacsframe); kbd_buffer_store_event (&event); ns_send_appdefined (-1); // Kick main loop @@ -214,7 +214,7 @@ index 992a5ce..d9b8ecd 100644 } -@@ -12220,6 +12295,332 @@ - (int) fullscreenState +@@ -12221,6 +12296,332 @@ - (int) fullscreenState return fs_state; } @@ -547,7 +547,7 @@ index 992a5ce..d9b8ecd 100644 @end /* EmacsView */ -@@ -14220,12 +14621,17 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with +@@ -14221,12 +14622,17 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with ns_use_srgb_colorspace = YES; DEFVAR_BOOL ("ns-accessibility-enabled", ns_accessibility_enabled, 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 a42c7b6..7cd1a16 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 4b77c5a182863322da1d42b4f4f2ba5a2ce7179d Mon Sep 17 00:00:00 2001 +From c30855d5c11e33c954fb055f97be4bafccee2576 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 @@ -110,10 +110,10 @@ index 6bd334f..6514dfc 100644 @section GNUstep Support diff --git a/src/nsterm.m b/src/nsterm.m -index d9b8ecd..7d48e6b 100644 +index 7574da4..426b029 100644 --- a/src/nsterm.m +++ b/src/nsterm.m -@@ -14622,9 +14622,13 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with +@@ -14623,9 +14623,13 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with DEFVAR_BOOL ("ns-accessibility-enabled", ns_accessibility_enabled, doc: /* Non-nil enables Zoom cursor tracking and VoiceOver support. 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 096e295..985024a 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 c383dc0e225d831283db7fdfccc22c12951a1077 Mon Sep 17 00:00:00 2001 +From 09734c4bdb06d7e683e166213ab02406692c3f21 Mon Sep 17 00:00:00 2001 From: Martin Sukany Date: Sat, 28 Feb 2026 14:46:25 +0100 Subject: [PATCH 7/8] ns: announce overlay completion candidates for VoiceOver @@ -22,7 +22,7 @@ race where an AX query consumes the change before notification. 2 files changed, 289 insertions(+), 42 deletions(-) diff --git a/src/nsterm.h b/src/nsterm.h -index 7adbb92..483fed3 100644 +index 5746e9e..21a93bc 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -510,6 +510,7 @@ typedef struct ns_ax_visible_run @@ -34,7 +34,7 @@ index 7adbb92..483fed3 100644 @property (nonatomic, assign) BOOL cachedMarkActive; @property (nonatomic, copy) NSString *cachedCompletionAnnouncement; diff --git a/src/nsterm.m b/src/nsterm.m -index 7d48e6b..20ba0b9 100644 +index 426b029..8d44b5f 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -7271,11 +7271,154 @@ Accessibility virtual elements (macOS / Cocoa only) @@ -486,7 +486,7 @@ index 7d48e6b..20ba0b9 100644 =================================================================== */ /* Scan visible range of window W for interactive spans. -@@ -9563,7 +9809,7 @@ - (void) setAccessibilityFocused: (BOOL) focused +@@ -9564,7 +9810,7 @@ - (void) setAccessibilityFocused: (BOOL) focused dispatch_async (dispatch_get_main_queue (), ^{ /* lwin is a Lisp_Object captured by value. This is GC-safe because Lisp_Objects are tagged integers/pointers that @@ -495,7 +495,7 @@ index 7d48e6b..20ba0b9 100644 Emacs. The WINDOW_LIVE_P check below guards against the window being deleted between capture and execution. */ if (!WINDOWP (lwin) || NILP (Fwindow_live_p (lwin))) -@@ -9589,7 +9835,7 @@ - (void) setAccessibilityFocused: (BOOL) focused +@@ -9590,7 +9836,7 @@ - (void) setAccessibilityFocused: (BOOL) focused @end @@ -504,7 +504,7 @@ index 7d48e6b..20ba0b9 100644 Methods are kept here (same .m file) so they access the ivars declared in the @interface ivar block. */ @implementation EmacsAccessibilityBuffer (InteractiveSpans) -@@ -12311,7 +12557,7 @@ - (int) fullscreenState +@@ -12312,7 +12558,7 @@ - (int) fullscreenState if (WINDOW_LEAF_P (w)) { @@ -513,7 +513,7 @@ index 7d48e6b..20ba0b9 100644 EmacsAccessibilityBuffer *elem = [existing objectForKey:[NSValue valueWithPointer:w]]; if (!elem) -@@ -12345,7 +12591,7 @@ - (int) fullscreenState +@@ -12346,7 +12592,7 @@ - (int) fullscreenState } else { @@ -522,7 +522,7 @@ index 7d48e6b..20ba0b9 100644 Lisp_Object child = w->contents; while (!NILP (child)) { -@@ -12457,7 +12703,7 @@ - (void)postAccessibilityUpdates +@@ -12458,7 +12704,7 @@ - (void)postAccessibilityUpdates accessibilityUpdating = YES; /* Detect window tree change (split, delete, new buffer). Compare @@ -531,7 +531,7 @@ index 7d48e6b..20ba0b9 100644 Lisp_Object curRoot = FRAME_ROOT_WINDOW (emacsframe); if (!EQ (curRoot, lastRootWindow)) { -@@ -12466,12 +12712,12 @@ - (void)postAccessibilityUpdates +@@ -12467,12 +12713,12 @@ - (void)postAccessibilityUpdates } /* If tree is stale, rebuild FIRST so we don't iterate freed 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 e79e889..26a9e5f 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 2f655a0fa3071046169011ecdc97f0a3f7c1105c Mon Sep 17 00:00:00 2001 +From 17cd7eabf984a7de09ac277b4831836a44c4cf81 Mon Sep 17 00:00:00 2001 From: Martin Sukany Date: Sat, 28 Feb 2026 16:01:29 +0100 Subject: [PATCH 8/8] ns: announce child frame completion candidates for @@ -63,10 +63,10 @@ index 2b1f9e6..8a40850 100644 for the *Completions* buffer. The implementation uses a virtual accessibility tree with per-window elements, hybrid SelectedTextChanged diff --git a/src/nsterm.h b/src/nsterm.h -index 483fed3..8bf867a 100644 +index 21a93bc..75c731f 100644 --- a/src/nsterm.h +++ b/src/nsterm.h -@@ -595,6 +595,10 @@ typedef NS_ENUM (NSInteger, EmacsAXSpanType) +@@ -596,6 +596,10 @@ typedef NS_ENUM (NSInteger, EmacsAXSpanType) Lisp_Object lastRootWindow; BOOL accessibilityTreeValid; BOOL accessibilityUpdating; @@ -77,7 +77,7 @@ index 483fed3..8bf867a 100644 #endif BOOL font_panel_active; NSFont *font_panel_result; -@@ -664,6 +668,7 @@ typedef NS_ENUM (NSInteger, EmacsAXSpanType) +@@ -665,6 +669,7 @@ typedef NS_ENUM (NSInteger, EmacsAXSpanType) - (void)rebuildAccessibilityTree; - (void)invalidateAccessibilityTree; - (void)postAccessibilityUpdates; @@ -86,7 +86,7 @@ index 483fed3..8bf867a 100644 @end diff --git a/src/nsterm.m b/src/nsterm.m -index 20ba0b9..f911d93 100644 +index 8d44b5f..8d88273 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -7415,6 +7415,112 @@ visual line index for Zoom (skip whitespace-only lines @@ -253,7 +253,7 @@ index 20ba0b9..f911d93 100644 specpdl_ref count2 = SPECPDL_INDEX (); record_unwind_current_buffer (); if (b != current_buffer) -@@ -9930,6 +10046,10 @@ - (void)dealloc +@@ -9931,6 +10047,10 @@ - (void)dealloc #endif [accessibilityElements release]; @@ -264,7 +264,7 @@ index 20ba0b9..f911d93 100644 [[self menu] release]; [super dealloc]; } -@@ -11379,6 +11499,9 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f +@@ -11380,6 +11500,9 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f windowClosing = NO; processingCompose = NO; @@ -274,7 +274,7 @@ index 20ba0b9..f911d93 100644 scrollbarsNeedingUpdate = 0; fs_state = FULLSCREEN_NONE; fs_before_fs = next_maximized = -1; -@@ -12687,6 +12810,80 @@ - (id)accessibilityFocusedUIElement +@@ -12688,6 +12811,80 @@ - (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. */ @@ -355,7 +355,7 @@ index 20ba0b9..f911d93 100644 - (void)postAccessibilityUpdates { NSTRACE ("[EmacsView postAccessibilityUpdates]"); -@@ -12697,11 +12894,59 @@ - (void)postAccessibilityUpdates +@@ -12698,11 +12895,59 @@ - (void)postAccessibilityUpdates /* Re-entrance guard: VoiceOver callbacks during notification posting can trigger redisplay, which calls ns_update_end, which calls us