From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#70338: message-fcc-externalize-attachments has no effect Date: Sat, 20 Apr 2024 17:28:58 -0700 Message-ID: <878r17h839.fsf@ericabrahamsen.net> References: <878r18t022.fsf@graner.name> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29646"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 70338@debbugs.gnu.org To: Nicolas Graner Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 21 02:30:18 2024 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 1ryL61-0007WQ-Q7 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 21 Apr 2024 02:30:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ryL5a-00086x-Ge; Sat, 20 Apr 2024 20:29:50 -0400 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 1ryL5Y-00086h-Pw for bug-gnu-emacs@gnu.org; Sat, 20 Apr 2024 20:29:49 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ryL5X-0004wy-HF for bug-gnu-emacs@gnu.org; Sat, 20 Apr 2024 20:29:48 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ryL5m-0007xx-A4 for bug-gnu-emacs@gnu.org; Sat, 20 Apr 2024 20:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 21 Apr 2024 00:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70338 X-GNU-PR-Package: emacs Original-Received: via spool by 70338-submit@debbugs.gnu.org id=B70338.171365936630373 (code B ref 70338); Sun, 21 Apr 2024 00:30:02 +0000 Original-Received: (at 70338) by debbugs.gnu.org; 21 Apr 2024 00:29:26 +0000 Original-Received: from localhost ([127.0.0.1]:39469 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ryL5B-0007tp-TC for submit@debbugs.gnu.org; Sat, 20 Apr 2024 20:29:26 -0400 Original-Received: from mail.ericabrahamsen.net ([52.70.2.18]:37852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ryL57-0007sH-Lh for 70338@debbugs.gnu.org; Sat, 20 Apr 2024 20:29:24 -0400 Original-Received: from localhost (71-212-21-65.tukw.qwest.net [71.212.21.65]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 9634DFA183; Sun, 21 Apr 2024 00:28:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericabrahamsen.net; s=mail; t=1713659339; bh=UCrxQb28rvqCA9IQVt+2E8CnBRR6DM3jRwsyJlHz3/4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=QtGeDo+sW7wyxD6IwnwsChxTU0ouaBg2VYOpLIySwLpTThmPfsVnHlXY1rotGqZHr ZX70QLLYswZj424WPIjXCSLhTB/gJ12a3SU/no15Acq6mxuX9QvElok2pnfxHM0oT+ w4yMIffp9+6jlhOOOeKJVbxoJhDjxfQN84pj2/Yg= In-Reply-To: <878r18t022.fsf@graner.name> (Nicolas Graner's message of "Sat, 20 Apr 2024 19:29:25 +0200") 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:283751 Archived-At: --=-=-= Content-Type: text/plain On 04/20/24 19:29 PM, Nicolas Graner wrote: > Eric Abrahamsen wrote on 2024-04-20 08:36: >> So far I don't see that this option would actually do anything in an FCC >> context. `message-fcc-externalize-attachments' is only used in >> `message-do-fcc`, where its value is let-bound to >> `mml-externalize-attachments'. >> >> But `mml-externalize-attachments' is only consulted in >> `gnus-inews-do-gcc', which already doesn't sound very promising. That >> function first let-binds `mml-externalize-attachments' to nil, before >> doing its own setting, so any dynamic value is getting overridden >> anyway. >> >> I tried starting with `gnus-gcc-externalize-attachments' and sending a >> message with an attachment, just to see how it's supposed to work. >> Nothing seemed to happen. >> >> Can you tell me what the desired effect is supposed to be? Does the >> "gcc" version of this option work for you? >> >> Eric > > When you attach a file to a mail message you are writing, only an anchor > with the file name is inserted in the message buffer. When the message > is sent, the anchor is replaced with the actual MIME-encoded contents of > the attached file. The copy of the message that is written to the FCC > file also includes the MIME-encoded attached file. > > I was expecting that externalization would mean that the copy in the FCC > file would only include an anchor rather than the attachment, which > would be extremely useful. I must admit this was only a guess (wishful > thinking?) since the documentation is not explicit at all. Oh, that sounds very useful, I've often wanted that. > I don't use gnus. To test the gnus version of the variable, I guess I > would need access to a free, public NNTP server, which I don't know > where to find. Can you help? I think most of us use news.gmane.io I tested the GCC version again (now that I know what it's supposed to do), and it did work -- the version of the message in my Sent folder had a mime part of "message/external-body". Long story short, the encoded body of the message is cached during sending, and the cached version is re-used during GCC/FCC handling. If the user has requested the externalization of attachments, the GCC version of the code knows to use that as a flag to dump the cache and re-generate it with externalized attachments; the FCC code doesn't do the equivalent. I've pushed a change that fixes this issue in my testing -- are you using Emacs master? If not, I've attached the commit here, I hope you'll be able to test it. Thanks, Eric --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Re-encode-message-bodies-with-externalized-attachmen.patch >From 3dfca6f9c7f4da512fff48cf6957c6492e2c0449 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Sat, 20 Apr 2024 17:25:20 -0700 Subject: [PATCH] Re-encode message bodies with externalized attachments during FCC Bug#70338 * lisp/gnus/message.el (message-do-fcc): If the user has requested to externalize attachments, we can't use the cached version of the message body from sending. This mirrors an equivalent check for GCC in `gnus-inews-do-gcc'. --- lisp/gnus/message.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 979d2fecf56..b2805774162 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -5768,8 +5768,10 @@ message-do-fcc (with-temp-buffer (insert-buffer-substring buf) (message-clone-locals buf) - ;; Avoid re-doing things like GPG-encoding secret parts. - (if (not encoded-cache) + ;; Avoid re-doing things like GPG-encoding secret parts, unless + ;; the user has requested that attachments be externalized, in + ;; which case we have to re-encode the message body. + (if (or mml-externalize-attachments (not encoded-cache)) (message-encode-message-body) (erase-buffer) (insert encoded-cache)) -- 2.44.0 --=-=-=--