From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:306:f42::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id i6OMDYjDgWL+SwAAsNZ9tg (envelope-from ); Mon, 16 May 2022 03:22:48 +0000 Received: from out2.migadu.com ([2001:41d0:2:aacc::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id aNGvDIjDgWKUQQEAauVa8A (envelope-from ); Mon, 16 May 2022 05:22:48 +0200 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=1652671368; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=+5LMTjmUcFIuMFGd9t8/zpTr0ns0RQFuRlj/9M1QiBs=; b=qqCqZ42l2wxsx6HjZAFoFJdks3x4UAdf52mWzYAvSFiyvU3EKHEEylk+ec7KljRZGGDFwI jcG5r8B8ocVc/p3Rlc13JjNf4Dr+IHHdA59zYih4zBLQFqUDRbkTVhzVVFgu2TGiMaKym+ lQ1NIt3XgX/6kmxSLzSJfKC316Atjdb2obvgZC3mQb+lAK5j6mZjqWDP2kvfLtw9ndI1K+ V8RVyg2v8F5+HkHzFKwNfj75G34V1ejITkcIQDQfLyaBIldbqeXgLS1j/uxCEOibcCyD2a /KkKPdDlQ6ApGMg89AlL781aV/jDkFL4lxjgCrN9kt6dzoDQbmvQaD7ngg1CkA== From: Kyle Meyer To: piem@inbox.kyleam.com Cc: zimoun Subject: [PATCH] piem-inject-thread-into-maildir: Let Lisp callers specify inbox Date: Sun, 15 May 2022 23:22:41 -0400 Message-Id: <20220516032241.212199-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: lAeLkTbx6XJB piem-inject-thread-into-maildir expects to be able to determine the inbox by calling piem-inbox. That's fine for interactive use, but wrapper functions may want to determine the inbox in another way. Suggested-by: zimoun Link: https://yhetil.org/guix-devel/86sfpo5q8w.fsf@gmail.com --- piem.el | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/piem.el b/piem.el index f91e3e64..e72f41b6 100644 --- a/piem.el +++ b/piem.el @@ -772,26 +772,31 @@ (defun piem--write-mbox-to-maildir (maildir-directory) (cons n-added n-skipped))) ;;;###autoload -(defun piem-inject-thread-into-maildir (mid &optional message-only) +(defun piem-inject-thread-into-maildir (mid &optional inbox message-only) "Inject thread containing MID into `piem-inbox-maildir-directory'. -If prefix argument MESSAGE-ONLY is non-nil, inject just the -message for MID, not the entire thread. +Download the message from the :url value configured for INBOX in +`piem-inboxes'. INBOX is passed to +`piem-inbox-maildir-directory' to determine where to inject the +message. If INBOX is nil, the inbox returned by `piem-inbox' is +used. -This function depends on :url being configured for entries in -`piem-inboxes'." +If prefix argument MESSAGE-ONLY is non-nil, inject just the +message for MID, not the entire thread." (interactive (list (or (piem-mid) (user-error "No message ID found for the current buffer")) + nil current-prefix-arg)) - (let ((maildir-directory (piem-inbox-maildir-directory))) + (let* ((inbox (or inbox (piem-inbox))) + (maildir-directory (piem-inbox-maildir-directory inbox))) (cond ((not maildir-directory) (user-error "No directory returned by `piem-inbox-maildir-directory'")) ((not (piem-maildir-dir-is-maildir-p maildir-directory)) (user-error "Does not look like a Maildir directory: %s" maildir-directory))) - (let ((url (concat (piem-mid-url mid) + (let ((url (concat (piem-mid-url mid inbox) (if message-only "/raw" "/t.mbox.gz")))) (piem-with-url-contents url (unless message-only base-commit: cbddebaa8e535e94d95510f02ebe8152c5d1a0b8 -- 2.36.0