diff options
author | Kyle Meyer <kyle@kyleam.com> | 2021-12-28 18:11:43 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2021-12-29 15:32:44 -0500 |
commit | afa9e05e5bb42d88b0c5cf79bdcb8fbd14fdd800 (patch) | |
tree | 26dd1d022e079d296c946ce05679bcf92f19bede | |
parent | 010ab95f59d8a4fcdd6fa26db3c1e567ab1ccacc (diff) | |
download | piem-afa9e05e5bb42d88b0c5cf79bdcb8fbd14fdd800.tar.gz |
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 <public@yoctocell.xyz>
Link: https://inbox.kyleam.com/piem/871r96am1q.fsf@yoctocell.xyz
Message-Id: <20211228231143.244455-1-kyle@kyleam.com>
-rw-r--r-- | piem-lei.el | 11 |
1 files changed, 11 insertions, 0 deletions
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'.") |