bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#47894: 28.0.50; isearch does not work if enable-recursive-minibuffer


From: Juri Linkov
Subject: bug#47894: 28.0.50; isearch does not work if enable-recursive-minibuffers is on and some input method is set.
Date: Wed, 21 Apr 2021 20:02:02 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> For users (eq (current-buffer) (window-buffer)) _should_ be
>> invariant. When and if an application temporarily violates that
>> invariant, it should reestablish it before the user can see it.  So if an
>> application calls `display-buffer' in a state where the invariant does
>> not hold, it should handle that case including the complication that
>> `display-buffer' might have selected another window.  And it goes without
>> saying that a display buffer action should never violate that invariant.
>
> I see.  So in this case the bug was elsewhere as I thought, it's
> display-buffer-select which was wrong (as you said it should have used
> pop-to-buffer) and not the code I added in
> isearch-post-command-hook. Anyway using (window-buffer (selected-window))
> should not harm, and is an extra safety against display buffer actions
> doing something weird.

As this bug report indicates, automatically exiting isearch does more harm.
So rather than forcibly exit isearch, we could select the original window
back, in the same vein as isearch-back-into-window in the same hook
moves point back to the old window boundaries:

diff --git a/lisp/isearch.el b/lisp/isearch.el
index f1e6e3eba2..1dfb0c86fc 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -3052,6 +3057,8 @@ isearch-pre-command-hook
       (isearch-clean-overlays)))))
 
 (defun isearch-post-command-hook ()
+   (unless (eq (selected-window) (old-selected-window))
+     (select-window (old-selected-window)))
    (when isearch-pre-scroll-point
      (let ((ab-bel (isearch-string-out-of-window isearch-pre-scroll-point)))
        (if ab-bel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]