patches: review fixes — defvar, method extraction, GC safety, window_end_valid

Review-based improvements:
- ns-accessibility-enabled DEFVAR_BOOL (disable AX overhead)
- window_end_valid guard in ns_ax_window_end_charpos
- GC safety comments on Lisp_Object ObjC ivars
- postAccessibilityNotificationsForFrame split into 4 methods
- block_input in ns_ax_completion_text_for_span
- Fplist_get predicate comment
- macos.texi VoiceOver section with defvar docs
- README updated with USER OPTION + REVIEW CHANGES sections
This commit is contained in:
2026-02-27 17:51:39 +01:00
parent b83a061322
commit d408a542e5
3 changed files with 524 additions and 439 deletions

View File

@@ -1,24 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From ce3b2a8091c99f738ec59acd6f6ebf0d84826e34 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz> From: Martin Sukany <martin@sukany.cz>
Date: Fri, 27 Feb 2026 17:30:00 +0100 Date: Fri, 27 Feb 2026 17:49:51 +0100
Subject: [PATCH 2/2] doc: add VoiceOver accessibility section to macOS Subject: [PATCH 2/2] doc: add VoiceOver accessibility section to macOS
appendix appendix
Document the new VoiceOver accessibility support in the Emacs manual. Document the new VoiceOver accessibility support in the Emacs manual.
Add a new section to the macOS appendix covering screen reader usage, Add a new section to the macOS appendix covering screen reader usage,
keyboard navigation feedback, completion announcements, and Zoom keyboard navigation feedback, completion announcements, Zoom cursor
cursor tracking. tracking, and the ns-accessibility-enabled user option.
* doc/emacs/macos.texi (VoiceOver Accessibility): New section. * doc/emacs/macos.texi (VoiceOver Accessibility): New section.
--- ---
doc/emacs/macos.texi | 46 +++++++++++++++++++++++++++++++++++++++++++ doc/emacs/macos.texi | 53 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+) 1 file changed, 53 insertions(+)
diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi
index 1234567..abcdefg 100644 index 6bd334f..1d969f9 100644
--- a/doc/emacs/macos.texi --- a/doc/emacs/macos.texi
+++ b/doc/emacs/macos.texi +++ b/doc/emacs/macos.texi
@@ -31,6 +31,7 @@ Support}), but we hope to improve it in the future. @@ -36,6 +36,7 @@ Support}), but we hope to improve it in the future.
* Mac / GNUstep Basics:: Basic Emacs usage under GNUstep or macOS. * Mac / GNUstep Basics:: Basic Emacs usage under GNUstep or macOS.
* Mac / GNUstep Customization:: Customizations under GNUstep or macOS. * Mac / GNUstep Customization:: Customizations under GNUstep or macOS.
* Mac / GNUstep Events:: How window system events are handled. * Mac / GNUstep Events:: How window system events are handled.
@@ -26,10 +26,10 @@ index 1234567..abcdefg 100644
* GNUstep Support:: Details on status of GNUstep support. * GNUstep Support:: Details on status of GNUstep support.
@end menu @end menu
@@ -272,6 +273,51 @@ services and receive the results back. Note that you may need to @@ -272,6 +273,58 @@ and return the result as a string. You can also use the Lisp function
services and receive the results back. Note that you may need to
restart Emacs to access newly-available services. restart Emacs to access newly-available services.
+@node VoiceOver Accessibility +@node VoiceOver Accessibility
+@section VoiceOver Accessibility (macOS) +@section VoiceOver Accessibility (macOS)
+@cindex VoiceOver +@cindex VoiceOver
@@ -70,6 +70,12 @@ index 1234567..abcdefg 100644
+position is communicated via @code{UAZoomChangeFocus} and the +position is communicated via @code{UAZoomChangeFocus} and the
+@code{AXBoundsForRange} accessibility attribute. +@code{AXBoundsForRange} accessibility attribute.
+ +
+@vindex ns-accessibility-enabled
+ To disable the accessibility interface entirely (for instance, to
+eliminate overhead on systems where assistive technology is not in
+use), set @code{ns-accessibility-enabled} to @code{nil}. The default
+is @code{t}.
+
+ This support is available only on the Cocoa build; GNUstep has a + This support is available only on the Cocoa build; GNUstep has a
+different accessibility model and is not yet supported +different accessibility model and is not yet supported
+(@pxref{GNUstep Support}). Evil-mode block cursors are handled +(@pxref{GNUstep Support}). Evil-mode block cursors are handled
@@ -81,3 +87,4 @@ index 1234567..abcdefg 100644
-- --
2.43.0 2.43.0

View File

@@ -3,10 +3,10 @@ EMACS NS VOICEOVER ACCESSIBILITY PATCH
patch: 0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch patch: 0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch
0002-doc-add-VoiceOver-accessibility-section-to-macOS-app.patch 0002-doc-add-VoiceOver-accessibility-section-to-macOS-app.patch
author: Martin Sukany <martin@sukany.cz> author: Martin Sukany <martin@sukany.cz>
files: src/nsterm.h (+105 lines) files: src/nsterm.h (+119 lines)
src/nsterm.m (+2846 ins, -151 del, +2695 net) src/nsterm.m (+3024 ins, -147 del, +2877 net)
doc/emacs/macos.texi (+46 lines) doc/emacs/macos.texi (+53 lines)
etc/NEWS (+11 lines) etc/NEWS (+13 lines)
OVERVIEW OVERVIEW
@@ -114,6 +114,18 @@ ARCHITECTURE
accessibilityAttributeValue:forParameter: API. accessibilityAttributeValue:forParameter: API.
USER OPTION
-----------
ns-accessibility-enabled (DEFVAR_BOOL, default t):
When nil, the accessibility virtual element tree is not built, no
notifications are posted, and ns_draw_phys_cursor skips the Zoom
update. This eliminates accessibility overhead entirely on systems
where assistive technology is not in use. Guarded at three entry
points: postAccessibilityUpdates, ns_draw_phys_cursor, and
windowDidBecomeKey.
THREADING MODEL THREADING MODEL
--------------- ---------------
@@ -615,4 +627,38 @@ TESTING CHECKLIST
26. Open an org-mode file with many folded sections. Verify that 26. Open an org-mode file with many folded sections. Verify that
folded (invisible) text is not announced during navigation. folded (invisible) text is not announced during navigation.
REVIEW CHANGES (post initial implementation)
---------------------------------------------
The following changes were made based on maintainer-style code review:
1. ns_ax_window_end_charpos: added window_end_valid guard. Falls
back to BUF_ZV when the window has not been fully redisplayed,
preventing stale data in AX getters called before next redisplay.
2. GC safety documentation: detailed comment on lispWindow ivar
explaining why staticpro is not needed (windows reachable from
frame tree, GC only on main thread, AX getters dispatch to main).
3. ns-accessibility-enabled (DEFVAR_BOOL): new user option to
disable accessibility entirely. Guards three entry points.
4. postAccessibilityNotificationsForFrame: extracted from one ~200
line method into four focused helpers:
- postTextChangedNotification: (typing echo)
- postFocusedCursorNotification:direction:granularity:markActive:
oldMarkActive: (focused cursor/selection)
- postCompletionAnnouncementForBuffer:point: (completions)
- postAccessibilityNotificationsForFrame: (orchestrator, ~60 lines)
5. ns_ax_completion_text_for_span: added block_input/unblock_input
with specpdl unwind protection for signal safety.
6. Fplist_get third-argument comment (PREDICATE, not default value).
7. Documentation: macos.texi section updated with
ns-accessibility-enabled variable reference. etc/NEWS updated.
-- end of README -- -- end of README --