From unknown Sun Jun 22 00:30:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60147: 30.0.50; vc-prepare-patch: Add numbered patch file names 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-GNU-PR-Keywords: To: 60147@debbugs.gnu.org Cc: philipk@posteo.net X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: philipk@posteo.net Received: via spool by submit@debbugs.gnu.org id=B.16712556729466 (code B ref -1); Sat, 17 Dec 2022 05:42:01 +0000 Received: (at submit) by debbugs.gnu.org; 17 Dec 2022 05:41:12 +0000 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 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 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 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 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) 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 Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sat, 17 Dec 2022 00:40:59 -0500 (EST) Received: by athena.silentflame.com (Postfix, from userid 1000) id 2F28C1B5A2B; Sat, 17 Dec 2022 05:40:58 +0000 (UTC) Date: Sat, 17 Dec 2022 05:40:58 +0000 From: Sean Whitton Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="+NRddpt/07HglXSM" 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-Spam-Score: -1.6 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) --+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-- From unknown Sun Jun 22 00:30:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60147: 30.0.50; vc-prepare-patch: Add numbered patch file names Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Dec 2022 09:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60147 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Sean Whitton Cc: 60147@debbugs.gnu.org Received: via spool by 60147-submit@debbugs.gnu.org id=B60147.167126960821247 (code B ref 60147); Sat, 17 Dec 2022 09:34:01 +0000 Received: (at 60147) by debbugs.gnu.org; 17 Dec 2022 09:33:28 +0000 Received: from localhost ([127.0.0.1]:54847 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6TZP-0005Wb-Ib for submit@debbugs.gnu.org; Sat, 17 Dec 2022 04:33:28 -0500 Received: from mout02.posteo.de ([185.67.36.66]:32947) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6TZM-0005WT-4O for 60147@debbugs.gnu.org; Sat, 17 Dec 2022 04:33:26 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 2D6F3240104 for <60147@debbugs.gnu.org>; Sat, 17 Dec 2022 10:33:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1671269598; bh=hJ9UD/FPu6W/IYlZlacUwGAvdXgfjDd9d/Y242HdCUY=; h=From:To:Cc:Subject:Date:From; b=ZuBFtgiPCdPynxIVqcOK3sj4a/OmqkGG5zdKT5tWQmx8epJLAm6zZKDjCSWC/1wHd XERKfDHt4OafNvUfuxq7wGCV6+wLyRIbkEKP+2aET0U47Bxq15baZbxz8bS7sHtuGL abd9mDrwXnFZDaK6L/W5MI9r4keaBHo3UNLer9NNcBq/A1sG4I/cLWvBGbL6ThEh6M yD+T9raxDSXo2hYFa/lRA4hWHW5lmeJZj5oT4mcGdFo5Bm51JxK51nT7ne1YHrvo6h QlMFMjY/kQS63ivJRCupd8HEIlAVNCHyk3FiTRdWhcAQMJo4TKNLETk166Sv7ygEOJ 4Ql/NDJ5kfDLA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NZ13x3qZ3z9rxD; Sat, 17 Dec 2022 10:33:16 +0100 (CET) From: Philip Kaludercic In-Reply-To: (Sean Whitton's message of "Sat, 17 Dec 2022 05:40:58 +0000") References: Date: Sat, 17 Dec 2022 09:33:20 +0000 Message-ID: <87y1r64bof.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Sean Whitton writes: > 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. This sounds good, find my comments below. > -- > Sean Whitton > > 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)) I think using a \` instead of ^ would be more robust. > + (filename > + (concat > + (string-trim > + (replace-regexp-in-string > + "\\W" "-" (if (length> stripped-subject 50) > + (substring stripped-subject 0 50) > + stripped-subject)) Is limiting the file names to ~50 characters a Git thing? > + "-+" "-+") > + ".patch"))) Perhaps this should be pulled out into a separate function. > + (mml-attach-buffer > + (buffer-name (plist-get patch :buffer)) > + "text/x-patch" > + patch-subject > + "attachment" > + (format "%04d-%s" (cl-incf i) filename)))))) Is the new additional argument really necessary, or couldn't we just rename the generated buffer? We could specify that the buffer must be fresh/renameable. > (open-line 2))))) > > (defun vc-default-responsible-p (_backend _file) From unknown Sun Jun 22 00:30:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60147: 30.0.50; vc-prepare-patch: Add numbered patch file names Resent-From: Sean Whitton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Dec 2022 00:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60147 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Philip Kaludercic Cc: 60147@debbugs.gnu.org Received: via spool by 60147-submit@debbugs.gnu.org id=B60147.167132361924239 (code B ref 60147); Sun, 18 Dec 2022 00:34:01 +0000 Received: (at 60147) by debbugs.gnu.org; 18 Dec 2022 00:33:39 +0000 Received: from localhost ([127.0.0.1]:58876 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6hcY-0006It-K9 for submit@debbugs.gnu.org; Sat, 17 Dec 2022 19:33:38 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:45583) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6hcW-0006In-PX for 60147@debbugs.gnu.org; Sat, 17 Dec 2022 19:33:37 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 75AAC5C0080; Sat, 17 Dec 2022 19:33:31 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Sat, 17 Dec 2022 19:33:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:cc:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1671323611; x=1671410011; bh=7O c7yE6tJY0IWpvx21Sz6778ovNpNxt13nrsO1o64UI=; b=M5lI4mZKYcpzNLVJor VWA1q9fEwO7LNjvMj+wrzO7Y/G29UxBjyC8IB12BYemf3B/CuK3fpMXVmupIb3zI jdwEJiGAF3VKuecC/xIjlXLywWEOM9I0kxVLkQptIktreVsX6Erc2VBcG5gs73i2 xj0Y9QJ8Ko6Q9m6+ADdEe0Br0gxeffbbAxfIJDZS+X42LjIUL4GOzRbr5oPVmcNb TwInoitmD6GcEUT9BT/grf3RmRRttyVRBWwOw3sE4ucFJ4GD2J3QWa6iQpaIbACg R74TIkgeGh38b5qgmimDrOEaX6wMblf0pSz0fN16HGEnIXcCcQoLvIn6UxPXAXby kwfg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references: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=1671323611; x=1671410011; bh=7Oc7yE6tJY0IWpvx21Sz6778ovNp Nxt13nrsO1o64UI=; b=V0wt+5xWOqx4X4JVps5xDq4aHBSqlVitL2FDpWyWEffn Sxof6xE51Y3BwQQVym6mE4qzDWI9Q1NE+jE+RuY5iBh/5sWxuGMIhh0hAzdITTDG lkE8mu5WvWv1x2Q/kIDOWIuEIuvvyz2/75I8B56CXvY06/acLI4OakBx6/r27u97 /sCoK6RVw+9nwP3sgkDutKN2k/TBXHfCtN4ffB9+CR6aJ/sKytkPAYr/mP6x2RHT Yc65Y28YVZdtyW8KruqMY4W1NvYoBN0DCuMO7491o+I9SNj2dMqL9OQLc19canIY gizMs2J2SfEn8C3mq2R3Q9ky5pktK2AyDL/CbtiyLw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgedtgddvvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufgjfhffkfgfgggtsehttddttddtredtnecuhfhrohhmpefuvggrnhcu hghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgeqne cuggftrfgrthhtvghrnheptdffvdffueeluedvteekvdevhefghedvgeevgffhvedukeeg geelveegjeekteeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 17 Dec 2022 19:33:30 -0500 (EST) Received: by melete.silentflame.com (Postfix, from userid 1000) id 3266E7EA019; Sat, 17 Dec 2022 17:33:30 -0700 (MST) From: Sean Whitton In-Reply-To: <87y1r64bof.fsf@posteo.net> (Philip Kaludercic's message of "Sat, 17 Dec 2022 09:33:20 +0000") References: <87y1r64bof.fsf@posteo.net> Date: Sat, 17 Dec 2022 17:33:30 -0700 Message-ID: <87r0wxv9d1.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, On Sat 17 Dec 2022 at 09:33AM GMT, Philip Kaludercic wrote: >> + (filename >> + (concat >> + (string-trim >> + (replace-regexp-in-string >> + "\\W" "-" (if (length> stripped-subject 50) >> + (substring stripped-subject 0 50) >> + stripped-subject)) > > Is limiting the file names to ~50 characters a Git thing? Git does it, yes, and I thought it seemed like a good idea in general. >> + (mml-attach-buffer >> + (buffer-name (plist-get patch :buffer)) >> + "text/x-patch" >> + patch-subject >> + "attachment" >> + (format "%04d-%s" (cl-incf i) filename)))))) > > Is the new additional argument really necessary, or couldn't we just > rename the generated buffer? We could specify that the buffer must be > fresh/renameable. The description and the filename for an attachment are not the same thing -- I don't believe MUAs will save the files with the correct name unless there is the filename= field. And I think it's a useful general addition to mml-attach-buffer. -- Sean Whitton From unknown Sun Jun 22 00:30:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60147: 30.0.50; vc-prepare-patch: Add numbered patch file names Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Dec 2022 10:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60147 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Sean Whitton Cc: 60147@debbugs.gnu.org Received: via spool by 60147-submit@debbugs.gnu.org id=B60147.167136032627538 (code B ref 60147); Sun, 18 Dec 2022 10:46:01 +0000 Received: (at 60147) by debbugs.gnu.org; 18 Dec 2022 10:45:26 +0000 Received: from localhost ([127.0.0.1]:33214 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6rAb-0007A6-QR for submit@debbugs.gnu.org; Sun, 18 Dec 2022 05:45:26 -0500 Received: from mout01.posteo.de ([185.67.36.65]:36747) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6rAa-00079y-2R for 60147@debbugs.gnu.org; Sun, 18 Dec 2022 05:45:25 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 00712240027 for <60147@debbugs.gnu.org>; Sun, 18 Dec 2022 11:45:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1671360318; bh=tqtrVvB/avY7doY3PmfHipoqDOKy/RDU5EUrb6fSIm4=; h=From:To:Cc:Subject:Date:From; b=V/5dCRhE2LZGTfxr4+Moq8MciMme22goyKy9iCsSie+NNCbYLoK5hXU5gf7N0wz+q 60e1vLUtRdWILovWFTNFs/bK78NfsFZJHx+BfZkJ9z7TG7zkWnaQjg0oOIBZOCerf2 XOrQUyExSvWH/zvwjh2Q/OyvIhbKg88kaBjycQnQ9TDWMI3jOd3lWLm/L0M/Xfa67m Gz5OOmEOzSGv9DLTc1o2zdOx90KvgNUokUIozPmtO3iYimSrQZA/Mj7tA0uguT/T0w u1S/T73urd+rVp5gbQSra2Ao9N00SpVSVNer9bL7RjOz+bFMkeIaeD0i47XNygA4m6 579k9khITKhmw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NZfcX29psz9rxD; Sun, 18 Dec 2022 11:45:13 +0100 (CET) From: Philip Kaludercic In-Reply-To: <87r0wxv9d1.fsf@melete.silentflame.com> (Sean Whitton's message of "Sat, 17 Dec 2022 17:33:30 -0700") References: <87y1r64bof.fsf@posteo.net> <87r0wxv9d1.fsf@melete.silentflame.com> Date: Sun, 18 Dec 2022 10:45:17 +0000 Message-ID: <87cz8hyoqq.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Sean Whitton writes: > Hello, > > On Sat 17 Dec 2022 at 09:33AM GMT, Philip Kaludercic wrote: > >>> + (filename >>> + (concat >>> + (string-trim >>> + (replace-regexp-in-string >>> + "\\W" "-" (if (length> stripped-subject 50) >>> + (substring stripped-subject 0 50) >>> + stripped-subject)) >> >> Is limiting the file names to ~50 characters a Git thing? > > Git does it, yes, and I thought it seemed like a good idea in general. OK, then it should be a good convention. And if the file names are numbered, then there shouldn't be any conflicts when downloading patches. >>> + (mml-attach-buffer >>> + (buffer-name (plist-get patch :buffer)) >>> + "text/x-patch" >>> + patch-subject >>> + "attachment" >>> + (format "%04d-%s" (cl-incf i) filename)))))) >> >> Is the new additional argument really necessary, or couldn't we just >> rename the generated buffer? We could specify that the buffer must be >> fresh/renameable. > > The description and the filename for an attachment are not the same > thing -- I don't believe MUAs will save the files with the correct name > unless there is the filename= field. And I think it's a useful general > addition to mml-attach-buffer. I see, in that case this should be fine. Can you apply the patch? From unknown Sun Jun 22 00:30:10 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Sean Whitton Subject: bug#60147: closed (Re: bug#60147: 30.0.50; vc-prepare-patch: Add numbered patch file names) Message-ID: References: <87sfhbhqrv.fsf@melete.silentflame.com> X-Gnu-PR-Message: they-closed 60147 X-Gnu-PR-Package: emacs Reply-To: 60147@debbugs.gnu.org Date: Tue, 20 Dec 2022 00:19:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1671495542-3320-1" This is a multi-part message in MIME format... ------------=_1671495542-3320-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #60147: 30.0.50; vc-prepare-patch: Add numbered patch file names which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 60147@debbugs.gnu.org. --=20 60147: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D60147 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1671495542-3320-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 60147-done) by debbugs.gnu.org; 20 Dec 2022 00:18:06 +0000 Received: from localhost ([127.0.0.1]:41224 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7QKb-0000rH-Qa for submit@debbugs.gnu.org; Mon, 19 Dec 2022 19:18:06 -0500 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:57079) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7QKa-0000qm-6n for 60147-done@debbugs.gnu.org; Mon, 19 Dec 2022 19:18:05 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 45F323200930; Mon, 19 Dec 2022 19:17:58 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 19 Dec 2022 19:17:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:cc:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1671495477; x=1671581877; bh=Hm FqK0DAxhUQiZpXz1w2SbsfflRM/vgIalRp91TQ5OA=; b=AOrjYbML45Uv/K/1ty c6qjJyFCfEbzV3aa2o9x6LCPfeeZGo3ztre4o41JSnWX/HDThfS/1+BZXElqff74 9dwcGWItSbqhj1KCmKcHJyl3XM+PqYfSmtT2vBRNI8pjbXdge3tHWPtyzJYfyLNG pc1f0S4lwx71UEmT3JIc+Hs36x0+NU4wmV7b+mq6ofTD7jhyRljV3N1s6t/CtSz6 pfb1OqIv8tB3tce1WtuKIQIZdkkAnJmrrLbxFtJclapcRTzMr7sxJdokRbO4ge5r gbKSBtabR1jDjw4sPQ6ptX4hiEwTPYshlAjvOheo9+l860zwY1dRZxWRlbiV0guV OyPw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references: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=1671495477; x=1671581877; bh=HmFqK0DAxhUQiZpXz1w2SbsfflRM /vgIalRp91TQ5OA=; b=AC9dbVfGNw9BVtDykl6uoFOB31k16/ZmreYP22GEFmDc AMn2bwLbdf8e/xMWF7Ff34t/dgDITR37m/aGQEfe1H2+D3dv5RPG6xHhs8knlXJb 6wOH0BUFax2ALwucIYiBLIPuvwi8CEENvNRUF6zF99oPseVcoDb1I+Xcy9VTxVYU jsYjAhSd7F/AUr4ZcdQTL0uFOF/vW+0SZYQA+U+YYjkpo5S5PO7Cdw0c5fBLmDIT w92oPn/06YwJIHwlUFfcABYch+WQV/iIBERETyBkRpbf4l7AJI2Yfv4ESp+HfEKD 3AIX4HbzwReauCB8msDiz+KxtApCE3wP6cBDWoxxZQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeeggddvtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufgjfhffkfgfgggtsehttddttddtredtnecuhfhrohhmpefuvggrnhcu hghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgeqne cuggftrfgrthhtvghrnheptdffvdffueeluedvteekvdevhefghedvgeevgffhvedukeeg geelveegjeekteeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 19 Dec 2022 19:17:57 -0500 (EST) Received: by melete.silentflame.com (Postfix, from userid 1000) id 371517EF9FD; Mon, 19 Dec 2022 17:17:56 -0700 (MST) From: Sean Whitton To: Philip Kaludercic Subject: Re: bug#60147: 30.0.50; vc-prepare-patch: Add numbered patch file names In-Reply-To: <87cz8hyoqq.fsf@posteo.net> (Philip Kaludercic's message of "Sun, 18 Dec 2022 10:45:17 +0000") References: <87y1r64bof.fsf@posteo.net> <87r0wxv9d1.fsf@melete.silentflame.com> <87cz8hyoqq.fsf@posteo.net> Date: Mon, 19 Dec 2022 17:17:56 -0700 Message-ID: <87sfhbhqrv.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60147-done Cc: 60147-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, Pushed. Thank you for looking. We may later want to refine the vc--subject-to-file-name subroutine to replace other characters too. -- Sean Whitton ------------=_1671495542-3320-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 17 Dec 2022 05:41:12 +0000 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 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 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 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 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) 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 Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sat, 17 Dec 2022 00:40:59 -0500 (EST) Received: by athena.silentflame.com (Postfix, from userid 1000) id 2F28C1B5A2B; Sat, 17 Dec 2022 05:40:58 +0000 (UTC) Date: Sat, 17 Dec 2022 05:40:58 +0000 From: Sean Whitton To: bug-gnu-emacs@gnu.org Subject: 30.0.50; vc-prepare-patch: Add numbered patch file names Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="+NRddpt/07HglXSM" 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-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) --+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-- ------------=_1671495542-3320-1--