diff options
author | Kyle Meyer <kyle@kyleam.com> | 2021-12-27 21:20:33 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2021-12-28 12:08:35 -0500 |
commit | 8cb30023c1fbf7049cedb8df29dec8c42a332697 (patch) | |
tree | c455baccb2b4e1ce7e83024cbccfaa71750da81f | |
parent | f355e4fc3b9a06e65e1102c073bdf340f06454c2 (diff) | |
download | piem-8cb30023c1fbf7049cedb8df29dec8c42a332697.tar.gz |
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>
-rw-r--r-- | piem-lei.el | 9 |
1 files 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 |