From afa9e05e5bb42d88b0c5cf79bdcb8fbd14fdd800 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Tue, 28 Dec 2021 18:11:43 -0500 Subject: lei: Delete message buffer's window along with query window 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 Link: https://inbox.kyleam.com/piem/871r96am1q.fsf@yoctocell.xyz Message-Id: <20211228231143.244455-1-kyle@kyleam.com> --- piem-lei.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/piem-lei.el b/piem-lei.el index 6c53733..22814c7 100644 --- a/piem-lei.el +++ b/piem-lei.el @@ -375,6 +375,16 @@ line's message, scroll its text downward, passing ARG to (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 @@ line's message, scroll its text downward, passing ARG to (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'.") -- cgit v1.2.3