discussion and development of piem
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
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	[thread overview]
Message-ID: <20211229235036.372313-8-kyle@kyleam.com> (raw)
In-Reply-To: <20211229235036.372313-1-kyle@kyleam.com>

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


  parent reply	other threads:[~2021-12-29 23:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-29 23:50 [RFC PATCH 00/14] am, b4-am: Add commands to extend an existing branch Kyle Meyer
2021-12-29 23:50 ` [RFC PATCH 01/14] am: Give better name to default piem-am-read-worktree-function value Kyle Meyer
2022-02-05 17:37   ` Kyle Meyer
2021-12-29 23:50 ` [RFC PATCH 02/14] am: Add dedicated function for reading worktree Kyle Meyer
2021-12-29 23:50 ` [RFC PATCH 03/14] am: Extract git-am logic to dedicated function Kyle Meyer
2021-12-29 23:50 ` [RFC PATCH 04/14] am: Add function for reading piem-am's arguments Kyle Meyer
2021-12-29 23:50 ` [RFC PATCH 05/14] am: Add comment header for patch editing subsection Kyle Meyer
2021-12-29 23:50 ` [RFC PATCH 06/14] edit patch: Inject values via interactive arguments Kyle Meyer
2022-02-05 17:48   ` Kyle Meyer
2021-12-29 23:50 ` Kyle Meyer [this message]
2021-12-29 23:50 ` [RFC PATCH 08/14] am, b4-am: Rewrite -create docstrings to emphasize branch creation Kyle Meyer
2021-12-29 23:50 ` [RFC PATCH 09/14] piem-am-create: Move info argument to the end Kyle Meyer
2021-12-29 23:50 ` [RFC PATCH 10/14] piem-am--arguments: Make info extraction optional Kyle Meyer
2021-12-29 23:50 ` [RFC PATCH 11/14] b4: Move logic for checking arguments to a dedicated function Kyle Meyer
2021-12-29 23:50 ` [RFC PATCH 12/14] am, b4-am: Add commands that extend an existing branch Kyle Meyer
2021-12-29 23:50 ` [RFC PATCH 13/14] am: Move functionality under a dedicated transient Kyle Meyer
2021-12-29 23:50 ` [RFC PATCH 14/14] b4: Add piem-b4-am-from-mid-extend to transient Kyle Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://git.kyleam.com/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211229235036.372313-8-kyle@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=piem@inbox.kyleam.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.kyleam.com/piem/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).