all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Michał Krzywkowski" <mkrzywkow@gmail.com>
To: 34972@debbugs.gnu.org
Subject: bug#34972: [PATCH] Use a different name for the help buffer in query-replace
Date: Sun, 24 Mar 2019 13:40:11 +0100	[thread overview]
Message-ID: <87wokophsk.fsf@gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1951 bytes --]


Hi,

I use this to always display the *Help* buffer in the selected window,
or to reuse existing window displaying the same buffer:

  (add-to-list 'display-buffer-alist
               '("^\\*Help\\*$" . ((display-buffer-reuse-window
                                    display-buffer-same-window))))

With this, whenever I forget the keybindings available during
query-replace and hit '?' to get help, the help buffer is displayed in
the main window which shows the replacements to be performed.  When I
try to bury the help buffer with 'q', it doesn't do what I intended - it
quits the query-replace session.  The same thing happens when I try to
switch to the main window with 'C-x o' and manually kill the buffer.

The only thing that works really, is to enter recursive edit, kill the
help buffer and exit-recursive-edit.

This happens because the help buffer generated by perform-replace is
named "*Help*" and my display-buffer rule matches it.  I work around
this by adding an additional rule to display-buffer-alist which checks
if the help buffer was created by perform-replace.  It's ugly:

  (defun my//display-buffer-help-for-query-replace-condition (bufname action)
    (and (string-match-p "\\*Help\\*" bufname)
         (catch 'res
           (mapbacktrace (lambda (_evald func _args _flags)
                           (when (eq func 'perform-replace)
                             (throw 'res t)))))))
  (add-to-list 'display-buffer-alist
               '(my//display-buffer-help-for-query-replace-condition
                 . (display-buffer-pop-up-window)))


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


[-- Attachment #1.2: Patch --]
[-- Type: text/x-diff, Size: 1009 bytes --]

From 4cbd2022deb50a35ca38040ab0337f707834b3f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Krzywkowski?= <k.michal@zoho.com>
Date: Fri, 22 Mar 2019 18:36:21 +0100
Subject: [PATCH] Use a different name for the help buffer in query-replace

* lisp/replace.el (perform-replace): Use "*Query replace help*" for the name
  of the help buffer.
---
 lisp/replace.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/replace.el b/lisp/replace.el
index 59ad1a375b..153f8f8287 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -2635,7 +2635,7 @@ 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*"
+			 (with-output-to-temp-buffer "*Query replace help*"
 			   (princ
 			    (concat "Query replacing "
 				    (if backward "backward " "")
-- 
Michał Krzywkowski
PGP: A5A7 06C4 28EF 8F64 2868 13A1 7BDE C129 F0B8 09A1



[-- Attachment #1.3: Type: text/plain, Size: 85 bytes --]



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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

             reply	other threads:[~2019-03-24 12:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-24 12:40 Michał Krzywkowski [this message]
2019-03-31 20:11 ` bug#34972: [PATCH] Use a different name for the help buffer in query-replace Juri Linkov
2019-04-01  9:12   ` Michał Krzywkowski
2019-04-01 20:07     ` Juri Linkov
2019-04-10 13:07       ` Michał Krzywkowski
2019-04-10 20:49         ` Juri Linkov
2019-04-10 21:02           ` Drew Adams
2019-04-11 20:56             ` bug#34972: [PATCH] Inhibit displaying help buffer in main window in perform-replace 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=87wokophsk.fsf@gmail.com \
    --to=mkrzywkow@gmail.com \
    --cc=34972@debbugs.gnu.org \
    /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.