From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sean Whitton Newsgroups: gmane.emacs.bugs Subject: bug#60147: 30.0.50; vc-prepare-patch: Add numbered patch file names Date: Sat, 17 Dec 2022 05:40:58 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="+NRddpt/07HglXSM" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="979"; mail-complaints-to="usenet@ciao.gmane.io" Cc: philipk@posteo.net To: 60147@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 17 06:42:20 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p6Pxi-000AWm-Sh for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Dec 2022 06:42:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6PxT-0006En-Qh; Sat, 17 Dec 2022 00:42:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6PxS-0006EX-KJ for bug-gnu-emacs@gnu.org; Sat, 17 Dec 2022 00:42:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p6PxS-00007b-CN for bug-gnu-emacs@gnu.org; Sat, 17 Dec 2022 00:42:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p6PxS-0002Sx-4I; Sat, 17 Dec 2022 00:42:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Sean Whitton Original-Sender: "Debbugs-submit" Resent-CC: philipk@posteo.net, bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Dec 2022 05:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 60147 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: philipk@posteo.net Original-Received: via spool by submit@debbugs.gnu.org id=B.16712556729466 (code B ref -1); Sat, 17 Dec 2022 05:42:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Dec 2022 05:41:12 +0000 Original-Received: from localhost ([127.0.0.1]:53896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6Pwd-0002Sc-NM for submit@debbugs.gnu.org; Sat, 17 Dec 2022 00:41:12 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:55910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6PwY-0002SU-LN for submit@debbugs.gnu.org; Sat, 17 Dec 2022 00:41:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6PwY-0005hn-GA for bug-gnu-emacs@gnu.org; Sat, 17 Dec 2022 00:41:06 -0500 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6PwS-0008HM-NU for bug-gnu-emacs@gnu.org; Sat, 17 Dec 2022 00:41:06 -0500 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id CC5BF5C00B6 for ; Sat, 17 Dec 2022 00:40:59 -0500 (EST) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 17 Dec 2022 00:40:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:content-type:date:date:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to; s=fm1; t= 1671255659; x=1671342059; bh=Bj4wBtUZFc1/F7bH1vHQWeEfb47CLYzYlPI JtNOsSWo=; b=NrmURDhmiGb42HItALkdwq6gUnBlkft2jIILhkr9eXih30k/w9h kjzlZXK9oX7L77PsKgVfVamwjSbyFGCyMCQCMNFrYzx89jyFxk7vNluMdPpHlwKT N2TUXhSrm7/MeEhp2f2Dxfse/MtLybUivGF7666xlLU199S0Y98dbYlKRFvV5x7m eKAAEuE9ZIeQ735NeakmqVr8ixjVBJZMqsUxRY2ipiWoYW6j/oaXYFfg5MPc4r+1 eY8eR5f/gxLQqAedsUcO6oH+Q2c4oMyemxXZ8OiWhLT5v+bmoJwV1qvwNOHLV3UV Vhs0jE0qncQG9UA0+r+V2zeJr3rJVtBjdRw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1671255659; x= 1671342059; bh=Bj4wBtUZFc1/F7bH1vHQWeEfb47CLYzYlPIJtNOsSWo=; b=j ipbXRmdT1L5T/58aqzi1lPBK/EOW0Zp1y9PvleAXjnLlAi8Meim1UvkIiGqkqis8 6KJSjgciSkFbeaW1Je8aXsITlo4JZKbiQa1SD3H+UZe90y0vOGZ2R5EXBbsNvnYZ MgzZBEvMj3ScB0MWKkXDIAURK7hkOKq+ZOKypuQHa5ejJaiQulWcpaf6dN3VEdaa ZXjZzne7ZXIu7w1jyPQ0qi70lhFlmJDfssAW1sf0uagcgqdnPZSNjWoVDaV4p7sn dx1n//RpPdmY1aNTwQnQBOhs3nvIfAjMXSrk6uBSLMHZ26UrDFgje9YTQfY1VR59 W6/ssr2yR2ljDjvcoN5Tw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeekgdekfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfggtggusehmtddtredttd dvnecuhfhrohhmpefuvggrnhcuhghhihhtthhonhcuoehsphifhhhithhtohhnsehsphif hhhithhtohhnrdhnrghmvgeqnecuggftrfgrthhtvghrnheplefhvefhhfevgfetfeefte euueeikedvffdttdevveekleffjeffveffudegjefgnecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtth honhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sat, 17 Dec 2022 00:40:59 -0500 (EST) Original-Received: by athena.silentflame.com (Postfix, from userid 1000) id 2F28C1B5A2B; Sat, 17 Dec 2022 05:40:58 +0000 (UTC) Content-Disposition: inline Received-SPF: pass client-ip=66.111.4.25; envelope-from=spwhitton@spwhitton.name; helo=out1-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:251258 Archived-At: --+NRddpt/07HglXSM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-debbugs-cc: philipk@posteo.net Hello, If you receive a message generated by vc-prepare-patch and then you save all the attachments to a directory, you lose any indication of the order in which the patches are meant to be applied. git-format-patch(1) numbers the patch files it saves. Thus, with most mail clients, when the recipient saves all the attachments to a local directory, they'll be ordered. I think it would be useful for vc-prepare-patch to do something similar. Please find a patch attached. -- Sean Whitton --+NRddpt/07HglXSM Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-vc-prepare-patch-Number-the-attached-patches.patch" >From 226e689b1183a34f3b611185201416e4f3205304 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 16 Dec 2022 22:34:52 -0700 Subject: [PATCH] vc-prepare-patch: Number the attached patches * lisp/gnus/mml.el (mml-attach-buffer): New FILENAME argument. * lisp/vc/vc.el (vc-prepare-patch): When vc-prepare-patches-separately is nil, generate file names for the attached patches. The file names begin with numbers indicating the ordering of the patches. --- lisp/gnus/mml.el | 13 ++++++++----- lisp/vc/vc.el | 26 +++++++++++++++++++++----- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index ebd0adf2e25..dc86fe6db96 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -1484,10 +1484,12 @@ mml-dnd-attach-file (setq disposition (mml-minibuffer-read-disposition type nil file))) (mml-attach-file file type description disposition))))) -(defun mml-attach-buffer (buffer &optional type description disposition) +(defun mml-attach-buffer (buffer &optional type description disposition filename) "Attach a buffer to the outgoing MIME message. BUFFER is the name of the buffer to attach. See -`mml-attach-file' for details of operation." +`mml-attach-file' regarding TYPE, DESCRIPTION and DISPOSITION. +FILENAME is a suggested file name for the attachment should a +recipient wish to save a copy separate from the message." (interactive (let* ((buffer (read-buffer "Attach buffer: ")) (type (mml-minibuffer-read-type buffer "text/plain")) @@ -1497,9 +1499,10 @@ mml-attach-buffer ;; If in the message header, attach at the end and leave point unchanged. (let ((head (unless (message-in-body-p) (point)))) (if head (goto-char (point-max))) - (mml-insert-empty-tag 'part 'type type 'buffer buffer - 'disposition disposition - 'description description) + (apply #'mml-insert-empty-tag + 'part 'type type 'buffer buffer + 'disposition disposition 'description description + (and filename `(filename ,filename))) ;; When using Mail mode, make sure it does the mime encoding ;; when you send the message. (or (eq mail-user-agent 'message-user-agent) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 690c907c77e..ed10909fee8 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -3466,11 +3466,27 @@ vc-prepare-patch (rfc822-goto-eoh) (forward-line) (save-excursion - (dolist (patch patches) - (mml-attach-buffer (buffer-name (plist-get patch :buffer)) - "text/x-patch" - (plist-get patch :subject) - "attachment"))) + (let ((i 0)) + (dolist (patch patches) + (let* ((patch-subject (plist-get patch :subject)) + (stripped-subject + (replace-regexp-in-string + "^\\[.*PATCH.*\\]\\s-*" "" patch-subject)) + (filename + (concat + (string-trim + (replace-regexp-in-string + "\\W" "-" (if (length> stripped-subject 50) + (substring stripped-subject 0 50) + stripped-subject)) + "-+" "-+") + ".patch"))) + (mml-attach-buffer + (buffer-name (plist-get patch :buffer)) + "text/x-patch" + patch-subject + "attachment" + (format "%04d-%s" (cl-incf i) filename)))))) (open-line 2))))) (defun vc-default-responsible-p (_backend _file) -- 2.30.2 --+NRddpt/07HglXSM--