From 251f9a264b3d0b5a4f4a976bf18b505c769b7e04 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 15 Nov 2020 01:15:16 -0500 Subject: am: Add option to configure how worktree is read It seems likely that piem-am-read-worktree won't quite behave as some callers want. Let users specify a custom function. Message-Id: <20201115061518.22191-5-kyle@kyleam.com> --- piem.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/piem.el b/piem.el index dbcd4d5..81c5196 100644 --- a/piem.el +++ b/piem.el @@ -158,6 +158,14 @@ the following information about the patch series: "Whether to create a dedicated worktree for applying patches." :type 'boolean) +(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 @@ within. If not specified, the default directory is used." (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 -- cgit v1.2.3