From 9019a168873afc983631eeb830053ebdb799be40 Mon Sep 17 00:00:00 2001 From: kovan Date: Fri, 13 Feb 2026 15:57:32 +0100 Subject: [PATCH] fix(evil): clean isearch overlays after ex-search navigation `evil-ex-search' (used by `n'/`N') calls `isearch-range-invisible' which temporarily opens fold overlays to check visibility, but never calls `isearch-clean-overlays' to restore them. This corrupts org-fold overlay state, making subtrees permanently unfoldable with TAB. The initial `/` search properly cleans up via `evil-ex-search-stop-session', but repeated `n'/`N' navigation skips this step. Add `:after' advice to call `isearch-clean-overlays'. Ref: emacs-evil/evil#1630 Fix: #8625 Co-authored-by: Claude Opus 4.6 --- modules/editor/evil/config.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/editor/evil/config.el b/modules/editor/evil/config.el index 3d81e3e61..88c7f74b5 100644 --- a/modules/editor/evil/config.el +++ b/modules/editor/evil/config.el @@ -67,6 +67,15 @@ directives. By default, this only recognizes C directives.") :config (evil-select-search-module 'evil-search-module 'evil-search) + ;; HACK: `evil-ex-search' (used by `n'/`N') calls `isearch-range-invisible' + ;; which temporarily opens fold overlays, but never calls + ;; `isearch-clean-overlays' to restore them. This corrupts org-fold + ;; overlay state, making subtrees permanently unfoldable with TAB. + ;; See emacs-evil/evil#1630, doomemacs/doomemacs#8625. + (defadvice! +evil--clean-isearch-overlays-a (&rest _) + :after #'evil-ex-search + (isearch-clean-overlays)) + ;; PERF: Stop copying the selection to the clipboard each time the cursor ;; moves in visual mode. Why? Because on most non-X systems (and in terminals ;; with clipboard plugins like xclip.el active), Emacs will spin up a new