3

How can I fetch patches from a subscribed development mailinglist with mutt and vim so that they can be applied with "git am" or "git apply" command easily?

Is it either possible to save it automaticaly as filenname.patch where filename is the patch subject according to git format-patch standard?

If I hit (v) on a Email containing a Patch mutt show something like this:

"<no description>  [text plain, base64, utf-8, 2,6K]"

Now I hit (s) and I can manually enter a filename. Here I like to have the patch name in git format-patch standard from the mail subject.

5
  • From the attachments menu (v), save the patch (s) to your desired directory...
    – jasonwryan
    May 3, 2015 at 18:10
  • 1
    But here I must manually specify the filename. If I use (v) and (enter) I got an vim session with /tmp/muttXYZ instead of somethink like /tmp/filename.patch
    – Oliver G.
    May 3, 2015 at 18:15
  • No, mutt loads the name of the attachment by default, just Ctrl-a to the start of the line and prepend the path... Don't hit Enter until after you have the full path at the prompt.
    – jasonwryan
    May 3, 2015 at 18:16
  • did not work for me, I hit (v) then (s) then Ctrl-a, but mutt says "the key is not in use" the attachment is a text/plain 7 bit us-ascii
    – Oliver G.
    May 3, 2015 at 18:30
  • Works fine for me: a limited set of the readline bindings (like Ctrl-a for beginning-of-line and Ctrl-u for erase line, etc) work in mutt's menu prompts...
    – jasonwryan
    May 3, 2015 at 19:09

1 Answer 1

0

Instead of hitting (v) to view the attachments, hit (e) to edit the raw message. Mutt will open the message with the configured editor application (which you said to be vim in your case). Then, within your editor, save the email/patch file (you will have to type a name for the email/patch file). With vim, you'll end up typing colon w followed by the file path. For example: :w ~/my_patch. You will then be able to apply the patch with git am <patch_file_you_have_saved>.

1
  • 1
    The OP already has a solution that works(?) but requires them to type two command characters and type a filename.  They want a solution that automatically extracts an appropriate filename from the Subject line. Aug 21, 2022 at 4:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .