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 gDIZEWn0zGFjYgAAsNZ9tg (envelope-from ); Wed, 29 Dec 2021 23:51:05 +0000 Received: from out0.migadu.com ([2001:41d0:2:267::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id +GnOEGn0zGGAXgAAauVa8A (envelope-from ); Thu, 30 Dec 2021 00:51:05 +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=1640821865; 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=nXKAXnrAZWX4Qc+ZOTDTqovgBa8btLNJMJekQn8jV80=; b=VcP/JXoOtNgQDINs1hrjgu4UABR4Q4A20KAJhZgVDD4Ez6bxtcyqNUpnPl0LAUeyodU/22 +3jcLwKz8CuXBLisNo0vE4yiX/QL2insk2kUKnzBRXiizq8Nqq44KzNzxgOj3FC4I/zZ2d 6/0v8gL/Uz9HJdesliLrv/01Jd2VcXTrLfSifEAJw4aOdCwTSFTkyMGdpWpujyanZmc1Fs DpCWdy/kFbFkOdVnGHDGOcDthQ4yIabYPXbIkS0PWgDlyt2e7dUpvqJWQHzk2AuJOrfK4M DUnD/lnx/ywVZ8qQ7Hif+av+WVAMqe6L9iE1ajvYyoghXeT1dczGrz+pXh9l2A== From: Kyle Meyer To: piem@inbox.kyleam.com Subject: [RFC PATCH 07/14] am, b4-am: Rename piem-am to piem-am-create Date: Wed, 29 Dec 2021 18:50:29 -0500 Message-Id: <20211229235036.372313-8-kyle@kyleam.com> In-Reply-To: <20211229235036.372313-1-kyle@kyleam.com> References: <20211229235036.372313-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: jf9xlGRm+U/3 Make way for a variant the extends an existing branch. --- Documentation/piem.texi | 51 ++++++++++++++++++++++------------------- piem-b4.el | 20 ++++++++-------- piem.el | 4 ++-- 3 files changed, 39 insertions(+), 36 deletions(-) diff --git a/Documentation/piem.texi b/Documentation/piem.texi index 73d277ea..73a0b1c6 100644 --- a/Documentation/piem.texi +++ b/Documentation/piem.texi @@ -259,8 +259,8 @@ Applying patches @table @code -@item piem-am -@findex piem-am +@item piem-am-create +@findex piem-am-create This command tries to extract a patch from the current Notmuch or Gnus message buffer and can handle an inline patch as well as one or more patch attachments. @@ -278,8 +278,8 @@ Applying patches contained in a message @section Applying patches contained in a message @table @kbd -@findex piem-am -@item M-x piem-am @key{RET} @var{branch} @key{RET} @var{base} +@findex piem-am-create +@item M-x piem-am-create @key{RET} @var{branch} @key{RET} @var{base} Apply the patch or patches in the current buffer to the associated code repository. Before applying, checkout a new branch @var{branch} starting at @var{base}. @@ -304,7 +304,7 @@ Applying patches contained in a message Rather than applying the patches directly to the associated code repository, you can create a dedicated worktree by setting @code{piem-am-create-worktree} to a non-nil value. Giving a prefix -argument to @code{piem-am} inverts the meaning of +argument to @code{piem-am-create} inverts the meaning of @code{piem-am-create-worktree}; that is, by default a prefix argument is useful if you generally prefer to work within the configured code repository but would like to trigger the one-off creation of a worktree @@ -318,10 +318,11 @@ Applying patches contained in a message a patch. @findex piem-am-ready-mbox -Note that the @code{piem-am} command works only for buffers from which -@code{piem-am-ready-mbox} can generate an am-ready mbox, which depends -on the enabled integration libraries. Currently @code{piem-notmuch} and -@code{piem-gnus} implement the necessary functionality. +Note that the @code{piem-am-create} command works only for buffers from +which @code{piem-am-ready-mbox} can generate an am-ready mbox, which +depends on the enabled integration libraries. Currently +@code{piem-notmuch} and @code{piem-gnus} implement the necessary +functionality. @node Using b4 to apply patches @section Using b4 to apply patches @@ -369,8 +370,8 @@ Using b4 to apply patches @table @kbd @item a -@itemx M-x piem-b4-am-from-mid -@findex piem-b4-am-from-mid +@itemx M-x piem-b4-am-from-mid-create +@findex piem-b4-am-from-mid-create @findex piem-mid @vindex piem-am-create-worktree @vindex piem-am-read-worktree-function @@ -379,10 +380,11 @@ Using b4 to apply patches @code{git am} called within an associated Git repository. If a message ID of the current buffer is not known (i.e. @code{piem-mid} returns nil), one is read from the caller. The caller is also queried for the -branch name and base, as described for @code{piem-am} (@pxref{Applying -patches contained in a message}). And, as with @code{piem-am}, a -worktree can be created by configuring @code{piem-am-create-worktree} to -a non-nil value or by giving a prefix argument. +branch name and base, as described for @code{piem-am-create} +(@pxref{Applying patches contained in a message}). And, as with +@code{piem-am-create}, a worktree can be created by configuring +@code{piem-am-create-worktree} to a non-nil value or by giving a prefix +argument. @findex piem-mid-to-thread-functions To generate the input thread, first any functions in @@ -390,17 +392,17 @@ Using b4 to apply patches to be retrieved from a local store (e.g., the Notmuch database). If that fails, try to download the thread from the @code{piem-inboxes} URL associated with the current buffer, provided the current buffer's -message ID matches the one @code{piem-b4-am-from-mid} was called with. -As a last resort, call @code{b4 am} without a local mbox to let it -download the thread according to its own configuration. +message ID matches the one @code{piem-b4-am-from-mid-create} was called +with. As a last resort, call @code{b4 am} without a local mbox to let +it download the thread according to its own configuration. @item i @itemx M-x piem-b4-am-ready-from-mid @findex piem-b4-am-ready-from-mid Call @code{b4 am} with a given message ID. This differs from -@code{piem-b4-am-from-mid} in that it is a direct wrapper around a -command-line call to @code{b4 am}. The caller is always queried for the -message ID, and the final product is an am-ready mbox. @code{b4} is +@code{piem-b4-am-from-mid-create} in that it is a direct wrapper around +a command-line call to @code{b4 am}. The caller is always queried for +the message ID, and the final product is an am-ready mbox. @code{b4} is responsible for downloading the thread, so the caller must point b4's configuration option @code{b4.midmask} to the appropriate public-inbox URL. @@ -418,9 +420,10 @@ Applying patches without a public-inbox archive Much of the functionality described in the previous sections can work even if messages aren't available in a public-inbox archive. -@code{piem-am} and @code{piem-b4-am-from-mid} try to generate the -am-ready mbox from a local source (e.g., via Notmuch or Gnus) before -falling back to downloading the thread from a public-inbox archive. +@code{piem-am-create} and @code{piem-b4-am-from-mid-create} try to +generate the am-ready mbox from a local source (e.g., via Notmuch or +Gnus) before falling back to downloading the thread from a public-inbox +archive. @cindex mailscripts Also, for those not working with public-inbox archives, it's worth diff --git a/piem-b4.el b/piem-b4.el index 18a68d95..d29527d9 100644 --- a/piem-b4.el +++ b/piem-b4.el @@ -51,7 +51,7 @@ (defcustom piem-b4-b4-executable "b4" ;;;; Internals (defvar piem-b4-keep-temp-directory nil - "Don't clean up the directory created by `piem-b4-am-from-mid'. + "Don't clean up the directory created by `piem-b4--get-am-files'. This is intended to be used for debugging purposes.") (defun piem-b4--get-am-files (mid coderepo args) @@ -128,7 +128,7 @@ (defun piem-b4-am-ready-from-mid (mid &optional args) (append args (list mid)))) ;;;###autoload -(defun piem-b4-am-from-mid (mid &optional args toggle-worktree) +(defun piem-b4-am-from-mid-create (mid &optional args toggle-worktree) "Get the thread for MID, extract an am-ready mbox, and apply it. Try to generate a thread for the Message-Id MID with @@ -162,13 +162,13 @@ (defun piem-b4-am-from-mid (mid &optional args toggle-worktree) (piem-b4--get-am-files mid coderepo args)) (default-directory coderepo)) (unwind-protect - (piem-am mbox-file - nil - (with-temp-buffer - (insert-file-contents (or cover mbox-file)) - (piem-extract-mbox-info)) - coderepo - toggle-worktree) + (piem-am-create mbox-file + nil + (with-temp-buffer + (insert-file-contents (or cover mbox-file)) + (piem-extract-mbox-info)) + coderepo + toggle-worktree) (when clean-fn (funcall clean-fn))))) @@ -253,7 +253,7 @@ (transient-define-prefix piem-b4-am () ;; command-line piping to `git am'. (5 "-V" "Do not save cover letter" "--no-cover")] ["Actions" - [("a" "Message ID -> mbox -> git-am" piem-b4-am-from-mid)] + [("a" "Message ID -> mbox -> git-am" piem-b4-am-from-mid-create)] [("b" "Local mbox -> am-ready mbox" piem-b4-am-ready-from-mbox) ("i" "Message ID -> am-ready mbox" piem-b4-am-ready-from-mid)]]) diff --git a/piem.el b/piem.el index eea81a8e..1a3725cc 100644 --- a/piem.el +++ b/piem.el @@ -954,7 +954,7 @@ (defun piem-am--arguments () current-prefix-arg))) ;;;###autoload -(defun piem-am (mbox &optional format info coderepo toggle-worktree) +(defun piem-am-create (mbox &optional format info coderepo toggle-worktree) "Feed an am-ready mbox to `git am'. MBOX is a buffer whose contents are an am-ready mbox (obtained @@ -1039,7 +1039,7 @@ (define-derived-mode piem-edit-patch-mode text-mode "piem-edit-patch" ;;;###autoload (autoload 'piem-dispatch "piem" nil t) (transient-define-prefix piem-dispatch () "Invoke a piem command." - [[("a" "apply patch" piem-am) + [[("a" "apply patch" piem-am-create) ("b" "call b4-am" piem-b4-am)] [("i" "inject thread into maildir" piem-inject-thread-into-maildir) ("l" "copy public-inbox link" piem-copy-mid-url)] -- 2.34.0