From: Kyle Meyer <kyle@kyleam.com>
To: piem@inbox.kyleam.com
Cc: Xinglu Chen <public@yoctocell.xyz>
Subject: [PATCH] lei: Delete message buffer's window along with query window
Date: Tue, 28 Dec 2021 18:11:43 -0500 [thread overview]
Message-ID: <20211228231143.244455-1-kyle@kyleam.com> (raw)
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
next reply other threads:[~2021-12-28 23:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-28 23:11 Kyle Meyer [this message]
2021-12-30 9:15 ` [PATCH] lei: Delete message buffer's window along with query window Xinglu Chen
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
List information: https://git.kyleam.com/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211228231143.244455-1-kyle@kyleam.com \
--to=kyle@kyleam.com \
--cc=piem@inbox.kyleam.com \
--cc=public@yoctocell.xyz \
/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 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).