all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Gregory Heytings <gregory@heytings.org>
Cc: max.brieiev@gmail.com, 47894@debbugs.gnu.org
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	[thread overview]
Message-ID: <87bla7iklo.fsf@mail.linkov.net> (raw)
In-Reply-To: <87o8e7bmgl.fsf@mail.linkov.net> (Juri Linkov's message of "Wed,  21 Apr 2021 20:02:02 +0300")

[-- Attachment #1: Type: text/plain, Size: 639 bytes --]

> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: isearch--saved-overriding-action.patch --]
[-- Type: text/x-diff, Size: 3220 bytes --]

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

  parent reply	other threads:[~2021-04-21 17:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19 16:06 bug#47894: 28.0.50; y.oy max.brieiev
2021-04-19 16:31 ` bug#47894: 28.0.50; isearch does not work if enable-recursive-minibuffers is on and some input method is set max.brieiev
2021-04-19 20:49   ` Juri Linkov
2021-04-20 20:00 ` Juri Linkov
2021-04-20 20:15   ` Gregory Heytings
2021-04-20 21:51     ` Gregory Heytings
2021-04-20 22:35     ` Gregory Heytings
2021-04-21  6:21       ` Gregory Heytings
2021-04-21  7:03       ` martin rudalics
2021-04-21  7:16         ` Gregory Heytings
2021-04-21  7:42           ` martin rudalics
2021-04-21  7:49             ` Gregory Heytings
2021-04-21 17:02               ` Juri Linkov
2021-04-21 17:18                 ` Gregory Heytings
2021-04-21 17:37                   ` Juri Linkov
2021-04-21 17:59                 ` Juri Linkov [this message]
2021-04-21 19:23                   ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bla7iklo.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=47894@debbugs.gnu.org \
    --cc=gregory@heytings.org \
    --cc=max.brieiev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.