From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4ea1::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id EIFhF450ymF2OAAAsNZ9tg (envelope-from ); Tue, 28 Dec 2021 02:21:02 +0000 Received: from out1.migadu.com ([2001:41d0:2:863f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id GPyBFI50ymFbZwEAG6o9tA (envelope-from ); Tue, 28 Dec 2021 03:21:02 +0100 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1640658061; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K+6mUgJPDcYMJoozYml5cFr2jrLWmKb/h97hqX7OBag=; b=PtURsDHU6aiCIM8ACTOaDELZCia3JMkwQGC2nCpMB9d7cYGL3F3SmSYZcCIErE2En1oqZt N/WhwJs535SIce++X1gHVi8dJYrViVZhmry+RE3KmsOsWxQbCoMbWmDXQAi11DjPSkbiPi u0n+HUBxfhczpNkdgDW61Yyf3aEkgkSCLjhATjcVJIxKD3zsbj7VYzR8UQQ9gAxoRIsE3i +y2sMpMEKfjDSMNL3hF6RRoEaUiBElF67OigRtKYDhAUT5rqJhncTmpZTlPRCTxguACAo3 teEV0Zcl2Ifh8MsGH2RjQFlshstoJMV1niqtIEAVdI1EimYQZ5kYrCAUU1Hi4w== From: Kyle Meyer 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 Message-Id: <20211228022037.206597-3-kyle@kyleam.com> In-Reply-To: <20211228022037.206597-1-kyle@kyleam.com> References: <20211228022037.206597-1-kyle@kyleam.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyleam.com X-TUID: USUsPoh3xevS 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