From 40d69550682a9dce97c7d5d261830cb433e09961 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Sun, 13 Nov 2005 04:55:41 +0000 Subject: [PATCH] Synch to No Gnus 200511130413. --- lisp/ChangeLog | 7 +++++ lisp/gnus-agent.el | 82 +++++++++++++++++++++++++++++++--------------------- 2 files changed, 56 insertions(+), 33 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b16813c..eebb5e4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2005-11-12 Kevin Greiner + + * gnus-agent.el (gnus-agent-braid-nov): Now tests new nov entries + for duplicates which are removed. The invalid sort check then + triggers a rescan after the sort as sorting may have moved + duplicate entries such that they can be cheaply detected. + 2005-11-13 Katsumi Yamaoka * gnus-start.el (gnus-dribble-read-file): Quote file-precious-flag. diff --git a/lisp/gnus-agent.el b/lisp/gnus-agent.el index 3655d76..3fefc37 100644 --- a/lisp/gnus-agent.el +++ b/lisp/gnus-agent.el @@ -1882,7 +1882,7 @@ article numbers will be returned." (defsubst gnus-agent-read-article-number () "Reads the article number at point. Returns nil when a valid article number can not be read." - ;; It is unfortunite but the read function quietly overflows + ;; It is unfortunate but the read function quietly overflows ;; integer. As a result, I have to use string operations to test ;; for overflow BEFORE calling read. (when (looking-at "[0-9]+\t") @@ -1941,21 +1941,21 @@ doesn't exist, to valid the overview buffer." (gnus-agent-copy-nov-line (pop articles)) (ignore-errors - (while articles - (while (let ((art (read (current-buffer)))) - (cond ((< art (car articles)) - (forward-line 1) - t) - ((= art (car articles)) - (beginning-of-line) - (delete-region - (point) (progn (forward-line 1) (point))) - nil) - (t - (beginning-of-line) - nil)))) - - (gnus-agent-copy-nov-line (pop articles))))) + (while articles + (while (let ((art (read (current-buffer)))) + (cond ((< art (car articles)) + (forward-line 1) + t) + ((= art (car articles)) + (beginning-of-line) + (delete-region + (point) (progn (forward-line 1) (point))) + nil) + (t + (beginning-of-line) + nil)))) + + (gnus-agent-copy-nov-line (pop articles))))) (goto-char (point-max)) @@ -1971,23 +1971,39 @@ doesn't exist, to valid the overview buffer." (goto-char p)) (setq last (or last -134217728)) - (let (sort art) - (while (not (eobp)) - (setq art (gnus-agent-read-article-number)) - (cond ((not art) - ;; Bad art num - delete this line - (beginning-of-line) - (delete-region (point) (progn (forward-line 1) (point)))) - ((< art last) - ;; Art num out of order - enable sort - (setq sort t) - (forward-line 1)) - (t - ;; Good art num - (setq last art) - (forward-line 1)))) - (when sort - (sort-numeric-fields 1 (point-min) (point-max))))))) + (while (catch 'problems + (let (sort art) + (while (not (eobp)) + (setq art (gnus-agent-read-article-number)) + (cond ((not art) + ;; Bad art num - delete this line + (beginning-of-line) + (delete-region (point) (progn (forward-line 1) (point)))) + ((< art last) + ;; Art num out of order - enable sort + (setq sort t) + (forward-line 1)) + ((= art last) + ;; Bad repeat of art number - delete this line + (beginning-of-line) + (delete-region (point) (progn (forward-line 1) (point)))) + (t + ;; Good art num + (setq last art) + (forward-line 1)))) + (when sort + ;; something is seriously wrong as we simply shouldn't see out-of-order data. + ;; First, we'll fix the sort. + (sort-numeric-fields 1 (point-min) (point-max)) + + ;; but now we have to consider that we may have duplicate rows... + ;; so reset to beginning of file + (goto-char (point-min)) + (setq last -134217728) + + ;; and throw a code that restarts this scan + (throw 'problems t)) + nil)))))) ;; Keeps the compiler from warning about the free variable in ;; gnus-agent-read-agentview. -- 1.7.10.4