patches: fix all safe pre-submission issues

- Blocker #1: add BOOL emacsMovedCursor = YES in patch 0005 so series
  compiles standalone; patch 0008 replaces it with !voiceoverSetPoint
- Blocker #3: change all Daneel authorship to Martin Sukany
- Zoom gate: remove ns_accessibility_enabled guards from Zoom code
  paths (0005 no longer adds them; 0008 retains the clarifying comment)
- eassert: remove redundant BUFFER_LIVE_P eassert with contradictory
  comment in patch 0008
- macos.texi: integrate orphan 'Block-style cursors' paragraph as
  @item in the Known Limitations list
- cindex: restore @cindex Zoom, cursor tracking (macOS) removed in 0008
- ChangeLog 0002: list only functions actually added in that patch
- ChangeLog 0008: accurate description (remove wrong BUF_CHARS_MODIFF
  claim for ensureTextCache; ns_ax_buffer_text block_input was in 0001)
- git apply --check: all 9 patches apply cleanly on fresh base

Remaining open issue: BUF_MODIFF regression in patch 0007 (ensureTextCache
O(N) rebuild per font-lock pass) requires design decision before
submission.
This commit is contained in:
2026-03-03 17:50:18 +01:00
parent 3a3fbbac19
commit 70f0cb9a86
9 changed files with 270 additions and 247 deletions

View File

@@ -1,7 +1,7 @@
From 6c075e29fccc7dc6e9df693c4123ce0001a2dbfc Mon Sep 17 00:00:00 2001
From 488b91178be9a2dfd022533fce6b4adcd5c2ead0 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 1/8] ns: add accessibility base classes and text extraction
Subject: [PATCH 2/9] ns: add accessibility base classes and text extraction
Add the foundation for macOS VoiceOver accessibility in the NS (Cocoa)
port. No existing code paths are modified.
@@ -33,7 +33,7 @@ set non-nil automatically when an AT is detected at startup.
2 files changed, 585 insertions(+)
diff --git a/src/nsterm.h b/src/nsterm.h
index ea6e7ba4f5..5746e9e9bd 100644
index ea6e7ba4f5..f245675513 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -453,6 +453,124 @@ enum ns_return_frame_mode
@@ -44,7 +44,7 @@ index ea6e7ba4f5..5746e9e9bd 100644
+
+ Accessibility virtual elements (macOS / Cocoa only)
+
+ ========================================================================= */
+ ========================================================================== */
+
+#ifdef NS_IMPL_COCOA
+@class EmacsView;
@@ -52,11 +52,11 @@ index ea6e7ba4f5..5746e9e9bd 100644
+/* Base class for virtual accessibility elements attached to EmacsView. */
+@interface EmacsAccessibilityElement : NSAccessibilityElement
+@property (nonatomic, unsafe_unretained) EmacsView *emacsView;
+/* Lisp window object --- safe across GC cycles.
+/* Lisp window object safe across GC cycles.
+ GC safety: these Lisp_Objects are NOT visible to GC via staticpro
+ or the specpdl stack. This is safe because:
+ (1) Emacs GC runs only on the main thread, at well-defined safe
+ points during Lisp evaluation --- never during redisplay.
+ points during Lisp evaluation never during redisplay.
+ (2) Accessibility elements are owned by EmacsView which belongs to
+ an active frame; windows referenced here are always reachable
+ from the frame's window tree until rebuildAccessibilityTree
@@ -81,7 +81,7 @@ index ea6e7ba4f5..5746e9e9bd 100644
+ NSUInteger ax_length; /* Length in accessibility string (UTF-16 units). */
+} ns_ax_visible_run;
+
+/* Virtual AXTextArea element --- one per visible Emacs window (buffer). */
+/* Virtual AXTextArea element one per visible Emacs window (buffer). */
+@interface EmacsAccessibilityBuffer
+ : EmacsAccessibilityElement <NSAccessibility>
+{
@@ -119,12 +119,12 @@ index ea6e7ba4f5..5746e9e9bd 100644
+- (void)invalidateInteractiveSpans;
+@end
+
+/* Virtual AXStaticText element --- one per mode line. */
+/* Virtual AXStaticText element one per mode line. */
+@interface EmacsAccessibilityModeLine : EmacsAccessibilityElement
+@end
+
+/* Span types for interactive AX child elements. */
+typedef NS_ENUM (NSInteger, EmacsAXSpanType)
+typedef NS_ENUM(NSInteger, EmacsAXSpanType)
+{
+ EmacsAXSpanTypeNone = -1,
+ EmacsAXSpanTypeButton = 0,
@@ -200,7 +200,7 @@ index 88c9251c18..9d36de66f9 100644
#include "systime.h"
#include "character.h"
#include "xwidget.h"
@@ -7201,6 +7202,436 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg
@@ -7201,6 +7202,432 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg
}
#endif
@@ -208,7 +208,7 @@ index 88c9251c18..9d36de66f9 100644
+
+ Accessibility virtual elements (macOS / Cocoa only)
+
+ ========================================================================= */
+ ========================================================================== */
+
+#ifdef NS_IMPL_COCOA
+
@@ -249,12 +249,8 @@ index 88c9251c18..9d36de66f9 100644
+
+ specpdl_ref count = SPECPDL_INDEX ();
+ record_unwind_current_buffer ();
+ /* block_input must precede record_unwind_protect_void (unblock_input):
+ if anything between SPECPDL_INDEX and block_input were to throw,
+ the unwind handler would call unblock_input without a matching
+ block_input, corrupting the input-blocking reference count. */
+ block_input ();
+ record_unwind_protect_void (unblock_input);
+ block_input ();
+ if (b != current_buffer)
+ set_buffer_internal_1 (b);
+
@@ -295,7 +291,7 @@ index 88c9251c18..9d36de66f9 100644
+
+ /* Extract this visible run's text. Use
+ Fbuffer_substring_no_properties which correctly handles the
+ buffer gap --- raw BUF_BYTE_ADDRESS reads across the gap would
+ buffer gap raw BUF_BYTE_ADDRESS reads across the gap would
+ include garbage bytes when the run spans the gap position. */
+ Lisp_Object lstr = Fbuffer_substring_no_properties (
+ make_fixnum (pos), make_fixnum (run_end));
@@ -376,7 +372,7 @@ index 88c9251c18..9d36de66f9 100644
+ return NSZeroRect;
+
+ /* charpos_start and charpos_len are already in buffer charpos
+ space --- the caller maps AX string indices through
+ space the caller maps AX string indices through
+ charposForAccessibilityIndex which handles invisible text. */
+ ptrdiff_t cp_start = charpos_start;
+ ptrdiff_t cp_end = cp_start + charpos_len;
@@ -518,7 +514,7 @@ index 88c9251c18..9d36de66f9 100644
+}
+
+/* Build label for span [START, END) in BUF_OBJ.
+ Priority: completion--string -> buffer text -> help-echo. */
+ Priority: completion--string buffer text help-echo. */
+static NSString *
+ns_ax_get_span_label (ptrdiff_t start, ptrdiff_t end,
+ Lisp_Object buf_obj)