Subject: Re: bug#47894: 28.0.50; isearch does not work if enable-recursive-minibuffers is on and some input method is set.

From: Juri Linkov <[email-masked]>
Date: Tue, 20 Apr 2021 23:00:53 +0300

> Some recent change made isearch to misbehave.
>
> isearch works normally when enable-recursive-minibuffers is off and no
> input method is set.
>
> However, when both enable-recursive-minibuffers is on and some input
> method is set, pressing C-s and then entering some text does not start a
> search. Successive presses of C-s lead to some garbled content being
> produced in minibuffer window (see screenshot).
>
> Steps to reproduce.
>
> 1. emacs -Q
> 2. M-x set-input-method RET programmer-dvorak
> 3. M-x customize-option RET enable-recursive-minibuffers
> Toggle the option into "On" state
> 4. Inside, for example, *scratch* buffer press C-s, then enter text to
> search. Observe that interactive search doesn't start. Also, successive
> presses of C-s produce some garbled text in minibuffer window as can be
> seen on screenshot below.

This is because of the recent change in ff796823e5
with the hope that it doesn't break other modes.
But your bug report helped to reveal that it
causes breakage.  So I had to revert it.

Gregory, could you please see if it can be improved
to not fail in the reported case?  Additionally,
on emacs-devel Zhiwei Chen said this:

  It failed to work when buffer is auto selected via
  `display-buffer-alist’.  When the point moves to the *Occur* buffer,
  typing “n”, “p” still sends “n”, “p” to isearch.

  (defun display-buffer-select (buffer alist)
    (let ((window (display-buffer-below-selected buffer alist)))
      (when (window-live-p window)
        (select-window window))))

  (setq display-buffer-alist '(("\\*Occur\\*" (display-buffer-select))))

Maybe this could be handled as well?