From 8cb30023c1fbf7049cedb8df29dec8c42a332697 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Mon, 27 Dec 2021 21:20:33 -0500 Subject: lei q: Extract buffer names to variables The next commit will split piem-lei-query-thread into two commands, one for general queries with threaded output and one for displaying a single thread for a given message ID. It makes sense to have different buffer names for these commands, and going forward it's likely that there will be more name tweaks (e.g., support for "locked" buffers). Add defvars that can be bound to control the names. Message-Id: <20211228022037.206597-3-kyle@kyleam.com> --- piem-lei.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/piem-lei.el b/piem-lei.el index 4485dcd..9779c97 100644 --- a/piem-lei.el +++ b/piem-lei.el @@ -233,6 +233,8 @@ unless DISPLAY is non-nil." (error "Date did not match expected format: %S" date)) 'font-lock-face 'piem-lei-query-date))) +(defvar piem-lei-query--buffer-name "*lei-query*") + ;;;###autoload (defun piem-lei-query (query &optional args) "Call `lei q' with QUERY and ARGS. @@ -243,7 +245,7 @@ QUERY is split according to `split-string-and-unquote'." piem-lei-query-initial-input 'piem-lei-query-history)) (transient-args 'piem-lei-q))) - (with-current-buffer (get-buffer-create "*lei-query*") + (with-current-buffer (get-buffer-create piem-lei-query--buffer-name) (let ((inhibit-read-only t)) (erase-buffer) (piem-lei-insert-output @@ -669,6 +671,8 @@ Return a list with a `piem-lei-msg' object for each root." (forward-line)) (nreverse items)))) +(defvar piem-lei-query-threads--buffer-name "*lei-thread*") + (defun piem-lei-query-thread (mid &optional args) "Show thread containing message MID. ARGS is passed to the underlying `lei q' call." @@ -681,7 +685,8 @@ ARGS is passed to the underlying `lei q' call." (append args (list "--threads") query))) (msgs (piem-lei-query--thread records)) depths pt-final subject-prev) - (with-current-buffer (get-buffer-create "*lei-thread*") + (with-current-buffer + (get-buffer-create piem-lei-query-threads--buffer-name) (let ((inhibit-read-only t)) (erase-buffer) (while msgs -- cgit v1.2.3