From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs 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:59:19 +0300 Organization: LINKOV.NET Message-ID: <87bla7iklo.fsf@mail.linkov.net> References: <87eef6p8bh.fsf@gmail.com> <874kg0d8ui.fsf@mail.linkov.net> <192e82f20f7e5133aaea@heytings.org> <6f6e4aa5-9fdf-b4e6-04d5-c43448d67623@gmx.at> <192e82f20f92affaec0e@heytings.org> <87o8e7bmgl.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29091"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: max.brieiev@gmail.com, 47894@debbugs.gnu.org To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 21 20:05:44 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lZHEO-0007Te-0Y for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Apr 2021 20:05:44 +0200 Original-Received: from localhost ([::1]:34684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZHEN-0006hl-2t for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Apr 2021 14:05:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZHDi-0006h2-EV for bug-gnu-emacs@gnu.org; Wed, 21 Apr 2021 14:05:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48208) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lZHDi-0003hF-40 for bug-gnu-emacs@gnu.org; Wed, 21 Apr 2021 14:05:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lZHDh-0004Sd-Qo; Wed, 21 Apr 2021 14:05:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Wed, 21 Apr 2021 18:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47894 X-GNU-PR-Package: emacs,gnus Original-Received: via spool by 47894-submit@debbugs.gnu.org id=B47894.161902829317131 (code B ref 47894); Wed, 21 Apr 2021 18:05:01 +0000 Original-Received: (at 47894) by debbugs.gnu.org; 21 Apr 2021 18:04:53 +0000 Original-Received: from localhost ([127.0.0.1]:59753 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lZHDZ-0004SF-0J for submit@debbugs.gnu.org; Wed, 21 Apr 2021 14:04:53 -0400 Original-Received: from relay11.mail.gandi.net ([217.70.178.231]:52521) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lZHDV-0004Rz-Ve for 47894@debbugs.gnu.org; Wed, 21 Apr 2021 14:04:52 -0400 Original-Received: from mail.gandi.net (m91-129-102-166.cust.tele2.ee [91.129.102.166]) (Authenticated sender: juri@linkov.net) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 5960C100005; Wed, 21 Apr 2021 18:04:41 +0000 (UTC) In-Reply-To: <87o8e7bmgl.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 21 Apr 2021 20:02:02 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:204648 Archived-At: --=-=-= Content-Type: text/plain > So rather than forcibly exit isearch, we could select the original window back I see two cases that could go wrong: 1. another window is selected by display-buffer-alist. This can be fixed by selecting an old window back. 2. another buffer is displayed in the same window by display-buffer-alist. Isearch help commands solve the second problem by simply using isearch--display-help-action that inhibits displaying other buffers in the same window. Instead of let-binding display-buffer-overriding-action in all isearch help commands, we could set it temporarily like we already temporarily set overriding-terminal-local-map: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=isearch--saved-overriding-action.patch diff --git a/lisp/isearch.el b/lisp/isearch.el index f1e6e3eba2..1dfb0c86fc 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -499,32 +499,28 @@ isearch--display-help-action (defun isearch-help-for-help () "Display Isearch help menu." (interactive) - (let ((display-buffer-overriding-action isearch--display-help-action)) - (isearch-help-for-help-internal)) + (isearch-help-for-help-internal) (isearch-update)) (defun isearch-describe-bindings () "Show a list of all keys defined in Isearch mode, and their definitions. This is like `describe-bindings', but displays only Isearch keys." (interactive) - (let ((display-buffer-overriding-action isearch--display-help-action)) - (with-help-window "*Help*" - (with-current-buffer standard-output - (princ "Isearch Mode Bindings:\n") - (princ (substitute-command-keys "\\{isearch-mode-map}")))))) + (with-help-window "*Help*" + (with-current-buffer standard-output + (princ "Isearch Mode Bindings:\n") + (princ (substitute-command-keys "\\{isearch-mode-map}"))))) (defun isearch-describe-key () "Display documentation of the function invoked by isearch key." (interactive) - (let ((display-buffer-overriding-action isearch--display-help-action)) - (call-interactively 'describe-key)) + (call-interactively 'describe-key) (isearch-update)) (defun isearch-describe-mode () "Display documentation of Isearch mode." (interactive) - (let ((display-buffer-overriding-action isearch--display-help-action)) - (describe-function 'isearch-forward)) + (describe-function 'isearch-forward) (isearch-update)) (defalias 'isearch-mode-help 'isearch-describe-mode) @@ -953,6 +949,7 @@ isearch-hidden (defvar isearch-input-method-function nil) (defvar isearch--saved-overriding-local-map nil) +(defvar isearch--saved-overriding-action nil) ;; Minor-mode-alist changes - kind of redundant with the ;; echo area, but if isearching in multiple windows, it can be useful. @@ -1278,6 +1280,8 @@ isearch-mode (setq isearch-mode " Isearch") ;; forward? regexp? (force-mode-line-update) + (setq isearch--saved-overriding-action display-buffer-overriding-action + display-buffer-overriding-action isearch--display-help-action) (setq overriding-terminal-local-map isearch-mode-map) (run-hooks 'isearch-mode-hook) ;; Remember the initial map possibly modified @@ -1400,6 +1404,7 @@ isearch-done ;; Called by all commands that terminate isearch-mode. ;; If NOPUSH is non-nil, we don't push the string on the search ring. (setq overriding-terminal-local-map nil) + (setq display-buffer-overriding-action isearch--saved-overriding-action) ;; (setq pre-command-hook isearch-old-pre-command-hook) ; for lemacs (setq minibuffer-message-timeout isearch-original-minibuffer-message-timeout) (isearch-dehighlight) @@ -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 --=-=-=--