GNU bug report logs -
#17453
Isearch doesn't work properly with Follow Mode.
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Fri, 9 May 2014 22:50:02 UTC
Severity: normal
Done: Alan Mackenzie <acm <at> muc.de>
Bug is archived. No further changes may be made.
Full log
Message #233 received at 17453 <at> debbugs.gnu.org (full text, mbox):
Hello, Juri
It's been nearly a week since your last email. In that time, I tried
one of the approaches (see below) that worked just fine.... except it
wouldn't work with replace.el. I got discouraged by this, and moved
onto other things for a while. Now I'm back.
On Thu, Nov 19, 2015 at 02:45:43AM +0200, Juri Linkov wrote:
> >> Another thing that disturbs me is moving lazy-highlighting checks
> >> to a new function isearch-lazy-highlight-maybe-new-loop.
> > What disturbs you about this change in particular?
> The same consequences you mentioned earlier: various time periods
> of lazy-highlighting staying active.
OK.
> >> What do you think about moving only window-checking into new function
> >> i.e. only checks for window-start/window-end/etc that need (sit-for 0)
> >> and leaving other checks in isearch-lazy-highlight-new-loop?
> > Actually, I think that "(sit-for 0)" isn't needed - I left it in to deal
> > with isearch-lazy-highlight-initial-delay being set to 0, thinking that
> > Follow Mode's post-command-hook might "not have had time" to run. But
> > surely post-command-hook will be called before checking timers. I'll
> > need to look at the source code (probably keyboard.c) to be absolutely
> > sure of this.
The "(sit-for 0)" is absolutely not needed: post-command-hook is indeed
always invoked before Emacs checks for timer expiry; I tried this out.
> > I don't think splitting the checks between
> > isearch-lazy-highlight-new-loop (in the command loop) and a function
> > triggered by a timer is a good idea. I tried it out, and it kind of
> > jars when the lazy highlighting sometimes stays 0.25s, sometimes goes
> > instantly. How about maybe ...
> > How about maybe putting the test for new highlighting in Isearch's
> > post-command-hook (and using the APPEND argument of `add-hook' to make
> > sure Isearch's post-hook-function comes after Follow Modes's)? That
> > way, all the lazy h. would be removed immediately after the command, as
> > at present.
This is precisely what I tried. It works very well in Isearch.
However, the problem is in replace.el (the replace functionality, not
`occur'): `query-replace', instead of using the Command Loop like
Isearch does, implements its own command loop. This seems suboptimal:
it doesn't invoke post-command-hook (or pre-command-hook) until the
entire replace session is over.
This means the use of `query-replace' whilst Follow Mode is enabled is
not going to work properly, without some radical change in replace.el.
Probably the smallest change would be to invoke new hooks
`pre-replace-command-hook' and `post-replace-command-hook' from
`query-replace''s command loop.
A more satisfying change would be to get rid of `perform-replace' and
use Emacs's command loop the way Isearch does. This would probably not
be all that difficult. Do you know if there's any special reason
`query-replace' implements its own command loop?
What do you think?
[ .... ]
> We need to test the same in all modes that use lazy-highlighting too.
Yes. That's a problem, right now.
--
Alan Mackenzie (Nuremberg, Germany).
This bug report was last modified 9 years and 218 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.