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#42029: `gnus-registry-spool-action' gets field beyond message headers Date: Fri, 26 Jun 2020 11:32:19 -0700 Message-ID: <87mu4pu18s.fsf@ericabrahamsen.net> References: <87o8p8v0iy.fsf@ericabrahamsen.net> 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="26899"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 42029@debbugs.gnu.org To: Tomotaka SUWA Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 26 20:37:14 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 1jotDu-0006y8-9I for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 26 Jun 2020 20:37:14 +0200 Original-Received: from localhost ([::1]:35350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jotDt-0007AM-CP for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 26 Jun 2020 14:37:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jot9q-0003Fl-E3 for bug-gnu-emacs@gnu.org; Fri, 26 Jun 2020 14:33:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59716) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jot9q-00027X-2I for bug-gnu-emacs@gnu.org; Fri, 26 Jun 2020 14:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jot9p-0002td-TW; Fri, 26 Jun 2020 14:33:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Fri, 26 Jun 2020 18:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42029 X-GNU-PR-Package: emacs,gnus Original-Received: via spool by 42029-submit@debbugs.gnu.org id=B42029.159319635311084 (code B ref 42029); Fri, 26 Jun 2020 18:33:01 +0000 Original-Received: (at 42029) by debbugs.gnu.org; 26 Jun 2020 18:32:33 +0000 Original-Received: from localhost ([127.0.0.1]:43029 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jot9M-0002sg-Uf for submit@debbugs.gnu.org; Fri, 26 Jun 2020 14:32:33 -0400 Original-Received: from ericabrahamsen.net ([52.70.2.18]:45268 helo=mail.ericabrahamsen.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jot9H-0002sG-03 for 42029@debbugs.gnu.org; Fri, 26 Jun 2020 14:32:31 -0400 Original-Received: from localhost (75-172-112-137.tukw.qwest.net [75.172.112.137]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 0E13CFA0AD; Fri, 26 Jun 2020 18:32:20 +0000 (UTC) In-Reply-To: (Tomotaka SUWA's message of "Thu, 25 Jun 2020 09:52:43 +0900") 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" Xref: news.gmane.io gmane.emacs.bugs:182415 Archived-At: --=-=-= Content-Type: text/plain Tomotaka SUWA writes: >> Thanks for this report. It might be simpler to wrap the whole thing in a >> single save-restriction+narrow-to-headers, since the function gets >> called four times. What do you think? > > I wrote the patch paying attention to minimize side effects since I'm not > familiar with that functionality. So if `gnus-registry-spool-action' is > interested in only mail headers, your proposal is much better. Okay! Would you be willing to give the attached diff a quick test? Thanks, Eric --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=protect-registry-spool-action.diff diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el index f306889a7f..a36095c1ec 100644 --- a/lisp/gnus/gnus-registry.el +++ b/lisp/gnus/gnus-registry.el @@ -449,19 +449,21 @@ gnus-registry-action to subject sender recipients))) (defun gnus-registry-spool-action (id group &optional subject sender recipients) - (let ((to (gnus-group-guess-full-name-from-command-method group)) - (recipients (or recipients - (gnus-registry-sort-addresses - (or (message-fetch-field "cc") "") - (or (message-fetch-field "to") "")))) - (subject (or subject (message-fetch-field "subject"))) - (sender (or sender (message-fetch-field "from")))) - (when (and (stringp id) (string-match "\r$" id)) - (setq id (substring id 0 -1))) - (gnus-message 7 "Gnus registry: article %s spooled to %s" - id - to) - (gnus-registry-handle-action id nil to subject sender recipients))) + (save-excursion + (message-narrow-to-headers-or-head) + (let ((to (gnus-group-guess-full-name-from-command-method group)) + (recipients (or recipients + (gnus-registry-sort-addresses + (or (message-fetch-field "cc") "") + (or (message-fetch-field "to") "")))) + (subject (or subject (message-fetch-field "subject"))) + (sender (or sender (message-fetch-field "from")))) + (when (and (stringp id) (string-match "\r$" id)) + (setq id (substring id 0 -1))) + (gnus-message 7 "Gnus registry: article %s spooled to %s" + id + to) + (gnus-registry-handle-action id nil to subject sender recipients)))) (defun gnus-registry-handle-action (id from to subject sender &optional recipients) @@ -1064,7 +1066,7 @@ gnus-registry-get-article-marks Uses process/prefix conventions. For multiple articles, only the last one's marks are returned." (interactive (gnus-summary-work-articles 1)) - (let* ((article (last articles)) + (let* ((article (car (last articles))) (id (gnus-registry-fetch-message-id-fast article)) (marks (when id (gnus-registry-get-id-key id 'mark)))) (when (called-interactively-p 'any) --=-=-=--