From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#39112: 27.0.60; gnus-summary-attach-article 'S A' with multiple articles selected repeats latest article Date: Fri, 17 Jan 2020 21:07:54 -0800 Message-ID: <878sm5qrmd.fsf@ericabrahamsen.net> References: <0100016f9e6e96aa-7ec94d8b-c2f0-4eb0-a960-eb3ccbc23dd9-000000@email.amazonses.com> <87r203nvwk.fsf@ericabrahamsen.net> <874kwzm3g8.fsf@ericabrahamsen.net> <0100016fa225617e-6ba6c30f-c00a-411a-b0c9-a192851c2dd7-000000@email.amazonses.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="16986"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 39112@debbugs.gnu.org To: Pankaj Jangid Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 18 06:09:12 2020 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 1isgMC-0004Hh-9u for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Jan 2020 06:09:12 +0100 Original-Received: from localhost ([::1]:37136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1isgMA-0005zZ-Vp for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Jan 2020 00:09:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55087) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1isgM3-0005zL-Mu for bug-gnu-emacs@gnu.org; Sat, 18 Jan 2020 00:09:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1isgM2-0007nW-2p for bug-gnu-emacs@gnu.org; Sat, 18 Jan 2020 00:09:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34409) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1isgM1-0007nJ-V3 for bug-gnu-emacs@gnu.org; Sat, 18 Jan 2020 00:09:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1isgM1-0001S9-PZ for bug-gnu-emacs@gnu.org; Sat, 18 Jan 2020 00:09:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Jan 2020 05:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39112 X-GNU-PR-Package: emacs Original-Received: via spool by 39112-submit@debbugs.gnu.org id=B39112.15793240935527 (code B ref 39112); Sat, 18 Jan 2020 05:09:01 +0000 Original-Received: (at 39112) by debbugs.gnu.org; 18 Jan 2020 05:08:13 +0000 Original-Received: from localhost ([127.0.0.1]:40382 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1isgLF-0001R5-J0 for submit@debbugs.gnu.org; Sat, 18 Jan 2020 00:08:13 -0500 Original-Received: from ericabrahamsen.net ([52.70.2.18]:36112 helo=mail.ericabrahamsen.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1isgLD-0001Qs-PS for 39112@debbugs.gnu.org; Sat, 18 Jan 2020 00:08:12 -0500 Original-Received: from localhost (c-73-254-86-141.hsd1.wa.comcast.net [73.254.86.141]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 38840FA349; Sat, 18 Jan 2020 05:08:05 +0000 (UTC) In-Reply-To: <0100016fa225617e-6ba6c30f-c00a-411a-b0c9-a192851c2dd7-000000@email.amazonses.com> (Pankaj Jangid's message of "Tue, 14 Jan 2020 03:42:37 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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" Xref: news.gmane.io gmane.emacs.bugs:174788 Archived-At: --=-=-= Content-Type: text/plain On 01/14/20 03:42 AM, Pankaj Jangid wrote: > Eric Abrahamsen writes: > >>> That command sets up the message-mode buffer and makes it current >>> before iterating over the articles, so it's unable to actually find >>> the articles and simply repeats the last value of >>> gnus-original-article-buffer. >> >> Okay, that was only right by accident. The real problem was that the >> code inside the iterate was setting the buffer to the message-mode >> buffer. Then the calls to `gnus-summary-select-article' kept >> re-setting to the summary-buffer, but always on the same article. >> >> Anyway, would you test this patch and confirm it fixes the problem? > > Just did that. Following observation, > > when I process mark multiple items in summary-buffer and move the point > to anything other than the latest marked mail and then press 'S A', the > last mail is not added and the second-last email gets attached twice. > > When the point is on the last marked email and then I press 'S A', it > works fine. Sorry, got busy for a couple of days there... Looks like the currently-opened message is interfering with the process somewhat. I've tried this out a few different ways and this new version of the patch seems to do the right thing, would you give it another shot? Eric --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=attach-article-fix.diff Content-Description: Article Attachment Patch diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index 466a62713e..daaea3980b 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el @@ -1985,13 +1985,14 @@ gnus-summary-attach-article buffers t nil nil (car buffers)))) (gnus-summary-mail-other-window) (setq destination (current-buffer))) + (gnus-summary-expand-window) (gnus-summary-iterate n (gnus-summary-select-article) - (set-buffer destination) - ;; Attach at the end of the buffer. - (save-excursion - (goto-char (point-max)) - (message-forward-make-body-mime gnus-original-article-buffer))) + (with-current-buffer destination + ;; Attach at the end of the buffer. + (save-excursion + (goto-char (point-max)) + (message-forward-make-body-mime gnus-original-article-buffer)))) (gnus-configure-windows 'message t))) (provide 'gnus-msg) --=-=-=--