Commit 943011de authored by Eric Abrahamsen's avatar Eric Abrahamsen
Browse files

Fixes to gnus-agent-retrieve-headers

* lisp/gnus/gnus-agent.el (gnus-agent-retrieve-headers): The
sort->append call was altering fetched-headers in-place. Also, we
should explicitly sort-numeric-fields in this
function. gnus-agent-check-overview-buffer will do this, but treats it
as a failure mode and will make a backup of the overview file.
parent 84e80376
Pipeline #8780 failed with stage
in 61 minutes and 6 seconds
......@@ -3627,7 +3627,7 @@ has been fetched."
(when fetched-headers
(setq headers
(sort (append headers fetched-headers)
(sort (append headers (copy-sequence fetched-headers))
(lambda (l r)
(< (mail-header-number l)
(mail-header-number r))))))
......@@ -3636,8 +3636,14 @@ has been fetched."
(let ((coding-system-for-write
(with-current-buffer gnus-agent-overview-buffer
;; We stick the new headers in at the end, then
;; re-sort the whole buffer with
;; `sort-numeric-fields'. If this turns out to be
;; slow, we could consider a loop to add the headers
;; in sorted order to begin with.
(goto-char (point-max))
(mapc #'nnheader-insert-nov fetched-headers)
(sort-numeric-fields 1 (point-min) (point-max))
(write-region (point-min) (point-max) file nil 'silent)
(gnus-agent-update-view-total-fetched-for group t)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment