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

From: Juri Linkov <[email-masked]>
Date: Wed, 20 Jun 2012 00:15:45 +0300

> Dunno if this would be easy to implement.  `isearch-query-replace'
> uses just `perform-replace' from replace.el, which doesn't care about
> invisible text.

A quick try does exactly what is needed:

=== modified file 'lisp/replace.el'
--- lisp/replace.el	2012-05-01 02:48:41 +0000
+++ lisp/replace.el	2012-06-19 21:14:59 +0000
@@ -1840,7 +1840,9 @@ (defun perform-replace (from-string repl
 					   limit t)
 				  ;; For speed, use only integers and
 				  ;; reuse the list used last time.
-				  (replace-match-data t real-match-data)))
+				  (prog1 (replace-match-data t real-match-data)
+				    (isearch-range-invisible
+				     (match-beginning 0) (match-end 0)))))
 				((and (< (1+ (point)) (point-max))
 				      (or (null limit)
 					  (< (1+ (point)) limit)))

But it would be better to implement this the same way as for isearch
filters.  Adding the same filters in replacements also will make the
variable `query-replace-skip-read-only' obsolete.