From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id 2KRJEaLHsF/WKAAAsNZ9tg (envelope-from ) for ; Sun, 15 Nov 2020 06:16:02 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id cHgKDaLHsF/ncAAAB5/wlQ (envelope-from ) for ; Sun, 15 Nov 2020 06:16:02 +0000 Received: from pb-smtp20.pobox.com (pb-smtp20.pobox.com [173.228.157.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D4CB694042E for ; Sun, 15 Nov 2020 06:16:01 +0000 (UTC) Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 862781075C5; Sun, 15 Nov 2020 01:16:00 -0500 (EST) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=c5byNbos4lruIqL4pSuG8YlcA fQ=; b=AjVSe8F7RPoceLeCINnPRsdy+x1+0ftICLq/1bMoIzEW3CzCiqKgOVlgF ArMtMUxlyUj6O/Nf4wiXwvUEAQ/L1QS7gq56qeAQ2hQ7tHjutUn5TNsbLglerzpx VRxhomogd2KPC5hmP67+iCJQAQqwpNQKKPEHUDkbqfbDuHvyw8= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 7F58A1075C4; Sun, 15 Nov 2020 01:16:00 -0500 (EST) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=kyleam.com; h=from:to:cc:subject:date:message-id:in-reply-to:references:mime-version:content-transfer-encoding; s=mesmtp; bh=HtHI+DeLK2wd5mo7y0WvOEeI83fpJ8fQCVHhq2PJxBY=; b=GJlzJ3jhkP8chmmpXwrakRvHgL9UN6Dmg5+9+C22bsrUpfc2SKIKFmwUaiKnev7G8gfc4Io2lTCfXmFvi5m63yR3WDLBnKcV/q/3E/LbJqbb1csJ5zXBPzRHMRAxH7rNKQpOZ1YYhQuK6StiqUwzTf9jdzIcuIpeLFaJRK9J/S4= Received: from localhost (unknown [45.33.91.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp20.pobox.com (Postfix) with ESMTPSA id F3CCE1075BC; Sun, 15 Nov 2020 01:15:57 -0500 (EST) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: piem@inbox.kyleam.com Cc: zimoun Subject: [PATCH 4/6] am: Add option to configure how worktree is read Date: Sun, 15 Nov 2020 01:15:16 -0500 Message-Id: <20201115061518.22191-5-kyle@kyleam.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201115061518.22191-1-kyle@kyleam.com> References: <20201115061518.22191-1-kyle@kyleam.com> MIME-Version: 1.0 X-Pobox-Relay-ID: 06ADCEF0-270A-11EB-8F09-E43E2BB96649-24757444!pb-smtp20.pobox.com Content-Transfer-Encoding: quoted-printable X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=pobox.com header.s=sasl header.b=AjVSe8F7; dkim=fail (body hash did not verify) header.d=kyleam.com header.s=mesmtp header.b=GJlzJ3jh; dmarc=none; spf=pass (aspmx1.migadu.com: domain of kyle@kyleam.com designates 173.228.157.52 as permitted sender) smtp.mailfrom=kyle@kyleam.com X-Spam-Score: 2.50 X-TUID: BtaPNggFF8Mp It seems likely that piem-am-read-worktree won't quite behave as some callers want. Let users specify a custom function. --- piem.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/piem.el b/piem.el index da7f9f8..ac9812c 100644 --- a/piem.el +++ b/piem.el @@ -158,6 +158,14 @@ (defcustom piem-am-create-worktree nil "Whether to create a dedicated worktree for applying patches." :type 'boolean) =20 +(defcustom piem-am-read-worktree-function #'piem-am-read-worktree + "Function that reads a to-be-created worktree from the user. +This function is called with two arguments, the directory of the +code repository that the worktree will be created from and the +name of the branch that will be created. The branch may be nil +if the caller requested a detached HEAD." + :type 'function) + (defcustom piem-maildir-directory nil "Inject public-inbox threads into this directory. If non-nil, this must be an existing Maildir directory." @@ -702,7 +710,8 @@ (defun piem-am (mbox &optional format info coderepo) (when piem-am-create-worktree (setq am-directory (expand-file-name - (piem-am-read-worktree default-directory new-branch))) + (funcall piem-am-read-worktree-function + default-directory new-branch))) (when (file-exists-p am-directory) (user-error "Worktree directory already exists"))) (apply #'piem-process-call nil piem-git-executable --=20 2.29.2