Subject: Re: bug#11746: feature request: `isearch-query-replace' should open invisible text

From: Juri Linkov <[email-masked]>
Date: Thu, 30 May 2013 03:03:00 +0300

Actually opening hidden overlays is not optimal when the user types `!'
for automatic replacement.  There is no need to open overlays and
immediately close afterwards without seeing opened text by the user.
This can be improved with this patch:

=== modified file 'lisp/replace.el'
--- lisp/replace.el	2013-05-29 23:16:44 +0000
+++ lisp/replace.el	2013-05-30 00:00:39 +0000
@@ -2111,6 +2111,9 @@ (defun perform-replace (from-string repl
 	    (setq skip-filtered-count (1+ skip-filtered-count)))
 	   ;; Optionally ignore invisible matches.
 	   ((not (or (eq search-invisible t)
+		     ;; Don't open overlays for automatic replacements.
+		     (and (not query-flag) search-invisible)
+		     ;; Open hidden overlays for interactive replacements.
 		     (not (isearch-range-invisible
 			   (nth 0 real-match-data) (nth 1 real-match-data)))))
 	    (setq skip-invisible-count (1+ skip-invisible-count)))