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

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

bug#34972: [PATCH] Use a different name for the help buffer in query-rep


From: Michał Krzywkowski
Subject: bug#34972: [PATCH] Use a different name for the help buffer in query-replace
Date: Mon, 01 Apr 2019 11:12:20 +0200
User-agent: mu4e 1.0; emacs 27.0.50

Hi Juri,

>> There are a couple of ways to improve behavior of perform-replace:
>>
>> - Use a different name for the query-replace help buffer (patch attached)
>> - Make 'C-l' or some other key bury the help buffer, if it was displayed
>>   in the main window
>> - Make '?' toggle visibility of the help buffer
>> - Allow switching windows in query-replace
>> - Display the help message in the minibuffer
>
> To solve the same problem, isearch binds display-buffer-overriding-action
> to isearch--display-help-action with '(nil (inhibit-same-window . t))
> that forces the *Help* buffer to be displayed in another window.

Thanks for letting me know.  I'm attaching a different patch which uses
display-buffer-overriding-action.  Does it look OK?

From c3a1806b355228b28b70ddce716b6f578e9eacb1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Krzywkowski?= <k.michal@zoho.com>
Date: Mon, 1 Apr 2019 10:26:46 +0200
Subject: [PATCH] Inhibit displaying help buffer in main window in
 perform-replace

* lisp/replace.el (perform-replace): Use
  display-buffer-overriding-action with inhibit-same-window to prevent
  the help buffer from being displayed in the main window.  (Bug#34972)
---
 lisp/replace.el | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/lisp/replace.el b/lisp/replace.el
index 318a9fb025..bd96fc3300 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -2643,22 +2643,24 @@ perform-replace
                  (setq def (lookup-key map key))
                  ;; Restore the match data while we process the command.
                  (cond ((eq def 'help)
-                        (with-output-to-temp-buffer "*Help*"
-                          (princ
-                           (concat "Query replacing "
-                                   (if backward "backward " "")
-                                   (if delimited-flag
-                                       (or (and (symbolp delimited-flag)
-                                                (get delimited-flag
-                                                      'isearch-message-prefix))
-                                           "word ") "")
-                                   (if regexp-flag "regexp " "")
-                                   from-string " with "
-                                   next-replacement ".\n\n"
-                                   (substitute-command-keys
-                                    query-replace-help)))
-                          (with-current-buffer standard-output
-                            (help-mode))))
+                         (let ((display-buffer-overriding-action
+                                '(nil (inhibit-same-window . t))))
+                          (with-output-to-temp-buffer "*Help*"
+                            (princ
+                             (concat "Query replacing "
+                                     (if backward "backward " "")
+                                     (if delimited-flag
+                                         (or (and (symbolp delimited-flag)
+                                                  (get delimited-flag
+                                                        
'isearch-message-prefix))
+                                             "word ") "")
+                                     (if regexp-flag "regexp " "")
+                                     from-string " with "
+                                     next-replacement ".\n\n"
+                                     (substitute-command-keys
+                                      query-replace-help)))
+                            (with-current-buffer standard-output
+                              (help-mode)))))
                        ((eq def 'exit)
                         (setq keep-going nil)
                         (setq done t))
-- 
Michał Krzywkowski
PGP: A5A7 06C4 28EF 8F64 2868 13A1 7BDE C129 F0B8 09A1


--
Michał Krzywkowski
PGP: A5A7 06C4 28EF 8F64 2868 13A1 7BDE C129 F0B8 09A1

Attachment: signature.asc
Description: PGP signature


reply via email to

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