discussion and development of piem
 help / color / mirror / code / Atom feed
* [PATCH] lei: Delete message buffer's window along with query window
@ 2021-12-28 23:11 Kyle Meyer
  2021-12-30  9:15 ` Xinglu Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Kyle Meyer @ 2021-12-28 23:11 UTC (permalink / raw)
  To: piem; +Cc: Xinglu Chen

Within query buffers, a message for the current line can be displayed
while keeping point in the query buffer.  Calling quit-window in a
query buffer, however, leaves the associated buffer's window in place,
which is probably not what the caller wants.  Add a custom quit-window
variant that handles the message buffer too.

Suggested-by: Xinglu Chen <public@yoctocell.xyz>
Link: https://inbox.kyleam.com/piem/871r96am1q.fsf@yoctocell.xyz
---
 piem-lei.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/piem-lei.el b/piem-lei.el
index 6c537339..22814c74 100644
--- a/piem-lei.el
+++ b/piem-lei.el
@@ -375,6 +375,16 @@ (defun piem-lei-query-show-or-scroll-down (arg)
          (arg (- arg))
          (t '-))))
 
+(defun piem-lei-query-quit-window (&optional kill)
+  "Call `quit-window' on the selected window.
+If there is a visible `piem-lei-show-mode' buffer, first call
+`quit-window' on its window.  The prefix argument KILL is passed
+to both underlying `quit-window' calls."
+  (interactive "P")
+  (when-let ((msg-win (piem-lei-query--get-visible-message-window)))
+    (quit-window kill msg-win))
+  (quit-window kill))
+
 (defvar piem-lei-query-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map (kbd "RET") #'piem-lei-query-show)
@@ -384,6 +394,7 @@ (defvar piem-lei-query-mode-map
     (define-key map "p" #'piem-lei-query-previous-line)
     (define-key map "s" #'piem-lei-q)
     (define-key map "t" #'piem-lei-mid-thread)
+    (define-key map "q" #'piem-lei-query-quit-window)
     map)
   "Keymap for `piem-lei-query-mode'.")
 

base-commit: d7d15a74c933e9a108c47f0515fc7a1b6d3199d6
-- 
2.34.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-30  9:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-28 23:11 [PATCH] lei: Delete message buffer's window along with query window Kyle Meyer
2021-12-30  9:15 ` Xinglu Chen

Code repositories for project(s) associated with this public inbox

	https://git.kyleam.com/piem/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).