patches: fix fold/unfold comment — outline-mode uses overlays in Emacs 28+

This commit is contained in:
2026-03-01 13:44:21 +01:00
parent 6703914305
commit 2402c50117

View File

@@ -1,4 +1,4 @@
From 1cbef245410db30407aa55f7d1290e879705a491 Mon Sep 17 00:00:00 2001 From ff2517c8af798fd41f8ba7d33af7a5b4cb15d8a6 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz> From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 16:01:29 +0100 Date: Sat, 28 Feb 2026 16:01:29 +0100
Subject: [PATCH 8/8] ns: announce child frame completion candidates for Subject: [PATCH 8/8] ns: announce child frame completion candidates for
@@ -20,8 +20,8 @@ element when a child frame completion closes.
doc/emacs/macos.texi | 6 - doc/emacs/macos.texi | 6 -
etc/NEWS | 4 +- etc/NEWS | 4 +-
src/nsterm.h | 9 ++ src/nsterm.h | 9 ++
src/nsterm.m | 275 +++++++++++++++++++++++++++++++++++++++++-- src/nsterm.m | 276 +++++++++++++++++++++++++++++++++++++++++--
4 files changed, 276 insertions(+), 18 deletions(-) 4 files changed, 277 insertions(+), 18 deletions(-)
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 6514dfc..f47929e 100644 index 6514dfc..f47929e 100644
@@ -97,7 +97,7 @@ index 21a93bc..bbce9fe 100644
@end @end
diff --git a/src/nsterm.m b/src/nsterm.m diff --git a/src/nsterm.m b/src/nsterm.m
index 8d44b5f..8548c68 100644 index 8d44b5f..5dec999 100644
--- a/src/nsterm.m --- a/src/nsterm.m
+++ b/src/nsterm.m +++ b/src/nsterm.m
@@ -7415,6 +7415,112 @@ visual line index for Zoom (skip whitespace-only lines @@ -7415,6 +7415,112 @@ visual line index for Zoom (skip whitespace-only lines
@@ -221,7 +221,7 @@ index 8d44b5f..8548c68 100644
@synthesize cachedOverlayModiff; @synthesize cachedOverlayModiff;
@synthesize cachedTextStart; @synthesize cachedTextStart;
@synthesize cachedModiff; @synthesize cachedModiff;
@@ -8159,16 +8266,33 @@ - (void)ensureTextCache @@ -8159,16 +8266,34 @@ - (void)ensureTextCache
if (!b) if (!b)
return; return;
@@ -255,15 +255,16 @@ index 8d44b5f..8548c68 100644
+ /* Cache is valid when neither characters nor fold-state have changed. + /* Cache is valid when neither characters nor fold-state have changed.
+ BUF_CHARS_MODIFF guards against character edits and is not bumped + BUF_CHARS_MODIFF guards against character edits and is not bumped
+ by font-lock (text-property changes), preserving the O(1) hot path. + by font-lock (text-property changes), preserving the O(1) hot path.
+ BUF_OVERLAY_MODIFF covers fold/unfold in modes that use overlays + BUF_OVERLAY_MODIFF catches fold/unfold: outline-mode, org-mode, and
+ (org-mode, hideshow); text-property-based invisibility such as + hideshow all use overlays (via outline-flag-region) in Emacs 28+.
+ outline-minor-mode without overlays is a known limitation. */ + Font-lock uses only text properties, so adding BUF_OVERLAY_MODIFF
+ here does not reintroduce the per-redisplay rebuild. */
+ if (cachedText && cachedTextModiff == chars_modiff + if (cachedText && cachedTextModiff == chars_modiff
+ && cachedOverlayModiffForText == overlay_modiff + && cachedOverlayModiffForText == overlay_modiff
&& cachedTextStart == BUF_BEGV (b) && cachedTextStart == BUF_BEGV (b)
&& pt >= cachedTextStart && pt >= cachedTextStart
&& (textLen == 0 && (textLen == 0
@@ -8184,7 +8308,8 @@ included in the cached AX text (it is handled separately via @@ -8184,7 +8309,8 @@ included in the cached AX text (it is handled separately via
{ {
[cachedText release]; [cachedText release];
cachedText = [text retain]; cachedText = [text retain];
@@ -273,7 +274,7 @@ index 8d44b5f..8548c68 100644
cachedTextStart = start; cachedTextStart = start;
if (visibleRuns) if (visibleRuns)
@@ -9175,6 +9300,7 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b @@ -9175,6 +9301,7 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b
ptrdiff_t currentOverlayStart = 0; ptrdiff_t currentOverlayStart = 0;
ptrdiff_t currentOverlayEnd = 0; ptrdiff_t currentOverlayEnd = 0;
@@ -281,7 +282,7 @@ index 8d44b5f..8548c68 100644
specpdl_ref count2 = SPECPDL_INDEX (); specpdl_ref count2 = SPECPDL_INDEX ();
record_unwind_current_buffer (); record_unwind_current_buffer ();
if (b != current_buffer) if (b != current_buffer)
@@ -9931,6 +10057,10 @@ - (void)dealloc @@ -9931,6 +10058,10 @@ - (void)dealloc
#endif #endif
[accessibilityElements release]; [accessibilityElements release];
@@ -292,7 +293,7 @@ index 8d44b5f..8548c68 100644
[[self menu] release]; [[self menu] release];
[super dealloc]; [super dealloc];
} }
@@ -11380,6 +11510,9 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f @@ -11380,6 +11511,9 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
windowClosing = NO; windowClosing = NO;
processingCompose = NO; processingCompose = NO;
@@ -302,7 +303,7 @@ index 8d44b5f..8548c68 100644
scrollbarsNeedingUpdate = 0; scrollbarsNeedingUpdate = 0;
fs_state = FULLSCREEN_NONE; fs_state = FULLSCREEN_NONE;
fs_before_fs = next_maximized = -1; fs_before_fs = next_maximized = -1;
@@ -12688,6 +12821,80 @@ - (id)accessibilityFocusedUIElement @@ -12688,6 +12822,80 @@ - (id)accessibilityFocusedUIElement
The existing elements carry cached state (modiff, point) from the The existing elements carry cached state (modiff, point) from the
previous redisplay cycle. Rebuilding first would create fresh previous redisplay cycle. Rebuilding first would create fresh
elements with current values, making change detection impossible. */ elements with current values, making change detection impossible. */
@@ -383,7 +384,7 @@ index 8d44b5f..8548c68 100644
- (void)postAccessibilityUpdates - (void)postAccessibilityUpdates
{ {
NSTRACE ("[EmacsView postAccessibilityUpdates]"); NSTRACE ("[EmacsView postAccessibilityUpdates]");
@@ -12698,11 +12905,59 @@ - (void)postAccessibilityUpdates @@ -12698,11 +12906,59 @@ - (void)postAccessibilityUpdates
/* Re-entrance guard: VoiceOver callbacks during notification posting /* Re-entrance guard: VoiceOver callbacks during notification posting
can trigger redisplay, which calls ns_update_end, which calls us can trigger redisplay, which calls ns_update_end, which calls us