[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: query-replace-regexp does not use isearch-open-invisible properties
From: |
Stefan Monnier |
Subject: |
Re: query-replace-regexp does not use isearch-open-invisible properties |
Date: |
03 Dec 2001 20:30:32 -0500 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.1.50 |
>>>>> "David" == David Kastrup <David.Kastrup@t-online.de> writes:
> For being able to do sensible searching through invisible overlays, the
> properties isearch-open-invisible and isearch-open-invisible-temporary are
> available. Exactly the same problem occurs with query-replace and its
> ilk, so it would be more than reasonable if query-replace used the same
> functions and properties for making the text visible while searching
> and replacing.
[ This is not an answer, but anyway... ]
If you check out the CVS repository, you'll see a new minor-mode
`reveal-mode' which does basically the same as isearch-open-invisible
except that it does it all the time rather than only from isearch.
I use it with outline-minor-mode (I do (hide-sublevels 1) in
outline-minor-mode-hook and then I don't need any outline-minor-mode
command any more: text gets opened/closed as I move around the buffer).
Sadly it doesn't work for query-replace because query-replace uses
`read-event' when querying the user which does not run post-command-hook
(where reveal-mode hooks itself).
Maybe query-replace should explicitly run pre/post-command-hook?
Of course an alternative would be to change query-replace to not use
`read-event' but to do what isearch does: use overriding-terminal-map or
a recursive-edit so as to use the usual command loop which would (as
a side-effect) run post/pre-command-hook.
Stefan
--- replace.el.~1.124.~ Sun Dec 2 15:35:47 2001
+++ replace.el Mon Dec 3 19:57:26 2001
@@ -1038,7 +1038,9 @@
;; with a bunch of identical messages.
(let ((message-log-max nil))
(message message from-string next-replacement))
+ (run-hooks 'pre-command-hook)
(setq key (read-event))
+ (run-hooks 'post-command-hook)
;; Necessary in case something happens during read-event
;; that clobbers the match data.
(set-match-data real-match-data)