Subject: Re: bug#4994: 23.1.50; reftex-isearch-minor-mode does not restore to the original point

From: Juri Linkov <[email-masked]>
Date: Fri, 20 Nov 2009 21:32:08 +0200

>> 1. (reftex-isearch-minor-mode t)
>>
>> 2. now search a string in a LaTeX project that is split (via \input
>> or \include) into many files
>>
>> 3. C-g to quit
>>
>> and you will see point can be left in a new buffer.
>>
>> For example, from the master file I initialised an isearch and when the
>> point jumped to chap1.tex, I hit C-g. Point was left in chap1.tex
>> instead of the original buffer where the command started.
>>
>> I am surprised by this behaviour so I'm wondering whether this is a bug.
>
> Thanks, good point.  It seems C-g doesn't return to the initial search state.
> I'll try to find a solution.

Multi-buffer isearch has no chance to save the initial state because
its setup is called too late - after the initial state (without
additional information about the original buffer) is pushed to the stack.

IOW, in `isearch-mode', `(isearch-push-state)' is called earlier than
(run-hooks 'isearch-mode-hook) that sets up multi-buffer specific
`isearch-push-state-function'.

Changing the order of these lines fixes this bug.  However, this change has
a risk of breaking other things.  So I need more time to test this fix.

-- 
Juri Linkov
http://www.jurta.org/emacs/