emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 42b3340: Narrow to headers in gnus-registry before getting data


From: Lars Ingebrigtsen
Subject: master 42b3340: Narrow to headers in gnus-registry before getting data
Date: Sat, 18 Jul 2020 20:19:43 -0400 (EDT)

branch: master
commit 42b33405c2c5aef43439ec7e9e9e690b948cc4b1
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Narrow to headers in gnus-registry before getting data
    
    * lisp/gnus/gnus-registry.el (gnus-registry-spool-action): Narrow
    to the headers before getting data from them (bug#42029).
---
 lisp/gnus/gnus-registry.el | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el
index f306889..1ac1d05 100644
--- a/lisp/gnus/gnus-registry.el
+++ b/lisp/gnus/gnus-registry.el
@@ -449,19 +449,21 @@ This is not required after changing 
`gnus-registry-cache-file'."
      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-restriction
+    (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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]