discussion and development of piem
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: piem@inbox.kyleam.com
Subject: [PATCH 2/6] lei q: Extract buffer names to variables
Date: Mon, 27 Dec 2021 21:20:33 -0500	[thread overview]
Message-ID: <20211228022037.206597-3-kyle@kyleam.com> (raw)
In-Reply-To: <20211228022037.206597-1-kyle@kyleam.com>

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.
---
 piem-lei.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/piem-lei.el b/piem-lei.el
index 4485dcdf..9779c972 100644
--- a/piem-lei.el
+++ b/piem-lei.el
@@ -233,6 +233,8 @@ (defun piem-lei-query--format-date (data)
        (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 @@ (defun piem-lei-query (query &optional args)
                        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 @@ (defun piem-lei-query--slurp (args)
         (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 @@ (defun piem-lei-query-thread (mid &optional args)
                    (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
-- 
2.34.0


  parent reply	other threads:[~2021-12-28  2:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-28  2:20 [PATCH 0/6] lei q: Support displaying multiple threads Kyle Meyer
2021-12-28  2:20 ` [PATCH 1/6] lei q: Allow initial input for query to be customized Kyle Meyer
2021-12-28  2:20 ` Kyle Meyer [this message]
2021-12-28  2:20 ` [PATCH 3/6] lei q: Support displaying multiple threads Kyle Meyer
2021-12-28 16:03   ` Xinglu Chen
2021-12-28 17:26     ` Kyle Meyer
2021-12-28  2:20 ` [PATCH 4/6] lei q: Add date placeholder for ghost messages Kyle Meyer
2021-12-28  2:20 ` [PATCH 5/6] lei q: Separate different threads with newline Kyle Meyer
2021-12-28  2:20 ` [PATCH 6/6] lei q: Sort threads by date of initial message Kyle Meyer
2021-12-28 17:24   ` Kyle Meyer

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=20211228022037.206597-3-kyle@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=piem@inbox.kyleam.com \
    /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).