Subject: bug#52248: Open hidden overlays in isearch-delete-char

From: Juri Linkov <[email-masked]>
Date: Thu, 02 Dec 2021 21:56:02 +0200

Tags: patch

This is not a regression.

While navigating forward with C-s in a buffer with invisible overlays
such as when using outline-minor-mode with hidden outlines,
it opens hidden overlays on the current match, and hides again
when going to the next match.

But going back with DEL (isearch-delete-char) doesn't reopen
the hidden overlay on the previous match.  Here is the fix:

diff --git a/lisp/isearch.el b/lisp/isearch.el
index fcb7d646c6..8421c5629b 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2504,6 +2552,10 @@ isearch-delete-char
   (if (null (cdr isearch-cmds))
       (ding)
     (isearch-pop-state))
+  ;; When going back to the hidden match, reopen it.
+  (when (and (eq search-invisible 'open) isearch-hide-immediately isearch-other-end)
+    (isearch-range-invisible (min (point) isearch-other-end)
+                             (max (point) isearch-other-end)))
   (isearch-update))
 
 (defun isearch-del-char (&optional arg)
--