aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2010-09-05 01:27:15 +0000
committerKatsumi Yamaoka2010-09-05 01:27:15 +0000
commit85816ac1c59f9ec922686450119f7f1bf63fcd0d (patch)
tree71bc51b35ddef3f756abfdc2e19e6aeb2b9ec9f3
parent530b8957da9951149171412e4206987e170b063c (diff)
downloademacs-85816ac1c59f9ec922686450119f7f1bf63fcd0d.tar.gz
emacs-85816ac1c59f9ec922686450119f7f1bf63fcd0d.zip
mail-source.el (mail-source-delete-crash-box): Always move the crash box to the Incoming file. Fixes mistake in previous checkin; Do incremental NOV updates when scanning new male. (nnml-save-incremental-nov, nnml-open-incremental-nov, nnml-add-incremental-nov): New functions to do "incremental" nov updates, where we just append to the end of the existing nov files without reading/writing them in full.
-rw-r--r--lisp/gnus/ChangeLog10
-rw-r--r--lisp/gnus/mail-source.el34
-rw-r--r--lisp/gnus/nnml.el61
3 files changed, 77 insertions, 28 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 192c2c04646..2c4d98b4d16 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,7 +1,17 @@
12010-09-04 Lars Magne Ingebrigtsen <larsi@gnus.org> 12010-09-04 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 2
3 * mail-source.el (mail-source-delete-crash-box): Always move the crash
4 box to the Incoming file. Fixes mistake in previous checkin.
5
6 * pop3.el (pop3-send-streaming-command): Off-by-one error on the
7 request loop (for debugging purposes) removed.
8
3 * nnml.el (nnml-save-nov): Message around nnml-save-nov so that the 9 * nnml.el (nnml-save-nov): Message around nnml-save-nov so that the
4 culprit is more visible. 10 culprit is more visible.
11 (nnml-save-incremental-nov, nnml-open-incremental-nov)
12 (nnml-add-incremental-nov): New functions to do "incremental" nov
13 updates, where we just append to the end of the existing nov files
14 without reading/writing them in full.
5 15
6 * mail-source.el (mail-source-delete-crash-box): Really only check the 16 * mail-source.el (mail-source-delete-crash-box): Really only check the
7 incoming files once in a while. 17 incoming files once in a while.
diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el
index a8db55b182c..7a626869347 100644
--- a/lisp/gnus/mail-source.el
+++ b/lisp/gnus/mail-source.el
@@ -631,23 +631,23 @@ Deleting old (> %s day(s)) incoming mail file `%s'." diff bfile)
631 ;; Delete or move the incoming mail out of the way. 631 ;; Delete or move the incoming mail out of the way.
632 (if (eq mail-source-delete-incoming t) 632 (if (eq mail-source-delete-incoming t)
633 (delete-file mail-source-crash-box) 633 (delete-file mail-source-crash-box)
634 ;; Don't check for old incoming files more than once per day to 634 (let ((incoming
635 ;; save a lot of file accesses. 635 (mm-make-temp-file
636 (when (or (null mail-source-incoming-last-checked-time) 636 (expand-file-name
637 (> (time-to-seconds 637 mail-source-incoming-file-prefix
638 (time-since mail-source-incoming-last-checked-time)) 638 mail-source-directory))))
639 (* 24 60 60))) 639 (unless (file-exists-p (file-name-directory incoming))
640 (setq mail-source-incoming-last-checked-time (current-time)) 640 (make-directory (file-name-directory incoming) t))
641 (let ((incoming 641 (rename-file mail-source-crash-box incoming t)
642 (mm-make-temp-file 642 ;; remove old incoming files?
643 (expand-file-name 643 (when (natnump mail-source-delete-incoming)
644 mail-source-incoming-file-prefix 644 ;; Don't check for old incoming files more than once per day to
645 mail-source-directory)))) 645 ;; save a lot of file accesses.
646 (unless (file-exists-p (file-name-directory incoming)) 646 (when (or (null mail-source-incoming-last-checked-time)
647 (make-directory (file-name-directory incoming) t)) 647 (> (time-to-seconds
648 (rename-file mail-source-crash-box incoming t) 648 (time-since mail-source-incoming-last-checked-time))
649 ;; remove old incoming files? 649 (* 24 60 60)))
650 (when (natnump mail-source-delete-incoming) 650 (setq mail-source-incoming-last-checked-time (current-time))
651 (mail-source-delete-old-incoming 651 (mail-source-delete-old-incoming
652 mail-source-delete-incoming 652 mail-source-delete-incoming
653 mail-source-delete-old-incoming-confirm))))))) 653 mail-source-delete-old-incoming-confirm)))))))
diff --git a/lisp/gnus/nnml.el b/lisp/gnus/nnml.el
index 6d5a8d20d2a..1c9513d2191 100644
--- a/lisp/gnus/nnml.el
+++ b/lisp/gnus/nnml.el
@@ -283,7 +283,7 @@ non-nil.")
283(deffoo nnml-request-scan (&optional group server) 283(deffoo nnml-request-scan (&optional group server)
284 (setq nnml-article-file-alist nil) 284 (setq nnml-article-file-alist nil)
285 (nnml-possibly-change-directory group server) 285 (nnml-possibly-change-directory group server)
286 (nnmail-get-new-mail 'nnml 'nnml-save-nov nnml-directory group)) 286 (nnmail-get-new-mail 'nnml 'nnml-save-incremental-nov nnml-directory group))
287 287
288(deffoo nnml-close-group (group &optional server) 288(deffoo nnml-close-group (group &optional server)
289 (setq nnml-article-file-alist nil) 289 (setq nnml-article-file-alist nil)
@@ -438,7 +438,7 @@ non-nil.")
438 (setq result (car (nnml-save-mail 438 (setq result (car (nnml-save-mail
439 (list (cons group (nnml-active-number group 439 (list (cons group (nnml-active-number group
440 server))) 440 server)))
441 server))) 441 server t)))
442 (progn 442 (progn
443 (nnmail-save-active nnml-group-alist nnml-active-file) 443 (nnmail-save-active nnml-group-alist nnml-active-file)
444 (and last (nnml-save-nov)))) 444 (and last (nnml-save-nov))))
@@ -449,7 +449,7 @@ non-nil.")
449 (nnml-active-number group ,server))))) 449 (nnml-active-number group ,server)))))
450 (yes-or-no-p "Moved to `junk' group; delete article? ")) 450 (yes-or-no-p "Moved to `junk' group; delete article? "))
451 (setq result 'junk) 451 (setq result 'junk)
452 (setq result (car (nnml-save-mail result server)))) 452 (setq result (car (nnml-save-mail result server t))))
453 (when last 453 (when last
454 (nnmail-save-active nnml-group-alist nnml-active-file) 454 (nnmail-save-active nnml-group-alist nnml-active-file)
455 (when nnmail-cache-accepted-message-ids 455 (when nnmail-cache-accepted-message-ids
@@ -691,7 +691,7 @@ non-nil.")
691 (make-directory (directory-file-name dir) t) 691 (make-directory (directory-file-name dir) t)
692 (nnheader-message 5 "Creating mail directory %s" dir)))) 692 (nnheader-message 5 "Creating mail directory %s" dir))))
693 693
694(defun nnml-save-mail (group-art &optional server) 694(defun nnml-save-mail (group-art &optional server full-nov)
695 "Save a mail into the groups GROUP-ART in the nnml server SERVER. 695 "Save a mail into the groups GROUP-ART in the nnml server SERVER.
696GROUP-ART is a list that each element is a cons of a group name and an 696GROUP-ART is a list that each element is a cons of a group name and an
697article number. This function is called narrowed to an article." 697article number. This function is called narrowed to an article."
@@ -742,11 +742,14 @@ article number. This function is called narrowed to an article."
742 ;; header. 742 ;; header.
743 (setq headers (nnml-parse-head chars)) 743 (setq headers (nnml-parse-head chars))
744 ;; Output the nov line to all nov databases that should have it. 744 ;; Output the nov line to all nov databases that should have it.
745 (if nnmail-group-names-not-encoded-p 745 (let ((func (if full-nov
746 'nnml-add-nov
747 'nnml-add-incremental-nov)))
748 (if nnmail-group-names-not-encoded-p
749 (dolist (ga group-art)
750 (funcall func (pop dec) (cdr ga) headers))
746 (dolist (ga group-art) 751 (dolist (ga group-art)
747 (nnml-add-nov (pop dec) (cdr ga) headers)) 752 (funcall func (car ga) (cdr ga) headers)))))
748 (dolist (ga group-art)
749 (nnml-add-nov (car ga) (cdr ga) headers))))
750 group-art) 753 group-art)
751 754
752(defun nnml-active-number (group &optional server) 755(defun nnml-active-number (group &optional server)
@@ -778,6 +781,37 @@ article number. This function is called narrowed to an article."
778 (setcdr active (1+ (cdr active)))) 781 (setcdr active (1+ (cdr active))))
779 (cdr active))) 782 (cdr active)))
780 783
784(defvar nnml-incremental-nov-buffer-alist nil)
785
786(defun nnml-save-incremental-nov ()
787 (message "nnml saving incremental nov...")
788 (save-excursion
789 (while nnml-incremental-nov-buffer-alist
790 (when (buffer-name (cdar nnml-incremental-nov-buffer-alist))
791 (set-buffer (cdar nnml-incremental-nov-buffer-alist))
792 (when (buffer-modified-p)
793 (nnmail-write-region (point-min) (point-max)
794 nnml-nov-buffer-file-name t 'nomesg))
795 (set-buffer-modified-p nil)
796 (kill-buffer (current-buffer)))
797 (setq nnml-incremental-nov-buffer-alist
798 (cdr nnml-incremental-nov-buffer-alist))))
799 (message "nnml saving incremental nov...done"))
800
801(defun nnml-open-incremental-nov (group)
802 (or (cdr (assoc group nnml-incremental-nov-buffer-alist))
803 (let ((buffer (nnml-get-nov-buffer group t)))
804 (push (cons group buffer) nnml-incremental-nov-buffer-alist)
805 buffer)))
806
807(defun nnml-add-incremental-nov (group article headers)
808 "Add a nov line for the GROUP nov headers, incrementally."
809 (save-excursion
810 (set-buffer (nnml-open-incremental-nov group))
811 (goto-char (point-max))
812 (mail-header-set-number headers article)
813 (nnheader-insert-nov headers)))
814
781(defun nnml-add-nov (group article headers) 815(defun nnml-add-nov (group article headers)
782 "Add a nov line for the GROUP base." 816 "Add a nov line for the GROUP base."
783 (save-excursion 817 (save-excursion
@@ -804,16 +838,21 @@ article number. This function is called narrowed to an article."
804 (mail-header-set-number headers number) 838 (mail-header-set-number headers number)
805 headers)))) 839 headers))))
806 840
807(defun nnml-get-nov-buffer (group) 841(defun nnml-get-nov-buffer (group &optional incrementalp)
808 (let* ((decoded (nnml-decoded-group-name group)) 842 (let* ((decoded (nnml-decoded-group-name group))
809 (buffer (get-buffer-create (format " *nnml overview %s*" decoded))) 843 (buffer (get-buffer-create (format " *nnml %soverview %s*"
844 (if incrementalp
845 "incremental "
846 "")
847 decoded)))
810 (file-name-coding-system nnmail-pathname-coding-system)) 848 (file-name-coding-system nnmail-pathname-coding-system))
811 (save-excursion 849 (save-excursion
812 (set-buffer buffer) 850 (set-buffer buffer)
813 (set (make-local-variable 'nnml-nov-buffer-file-name) 851 (set (make-local-variable 'nnml-nov-buffer-file-name)
814 (nnmail-group-pathname decoded nnml-directory nnml-nov-file-name)) 852 (nnmail-group-pathname decoded nnml-directory nnml-nov-file-name))
815 (erase-buffer) 853 (erase-buffer)
816 (when (file-exists-p nnml-nov-buffer-file-name) 854 (when (and (not incrementalp)
855 (file-exists-p nnml-nov-buffer-file-name))
817 (nnheader-insert-file-contents nnml-nov-buffer-file-name))) 856 (nnheader-insert-file-contents nnml-nov-buffer-file-name)))
818 buffer)) 857 buffer))
819 858