X-Git-Url: https://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fnnml.el;h=61d1987eac25fab28578c5399559ab6bae1b3cf7;hb=975a3d0cbe2e72da98823d6bc7839bce2b9c7d8b;hp=43f9b8ff395fd3a96f27b44ea72e518f64ba4a57;hpb=19129ec856209505e3ba9f85d67736d6ac974e6d;p=gnus diff --git a/lisp/nnml.el b/lisp/nnml.el index 43f9b8ff3..61d1987ea 100644 --- a/lisp/nnml.el +++ b/lisp/nnml.el @@ -1,7 +1,7 @@ ;;; nnml.el --- mail spool access for Gnus ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, -;; 2004, 2005 Free Software Foundation, Inc. +;; 2004, 2005, 2006 Free Software Foundation, Inc. ;; Authors: Didier Verna (adding compaction) ;; Simon Josefsson (adding MARKS) @@ -37,12 +37,12 @@ (require 'gnus) (require 'nnheader) (require 'nnmail) -(require 'gnus-bcklg) (require 'nnoo) (eval-when-compile (require 'cl)) (eval-and-compile - (autoload 'gnus-article-unpropagatable-p "gnus-sum")) + (autoload 'gnus-article-unpropagatable-p "gnus-sum") + (autoload 'gnus-backlog-remove-article "gnus-bcklg")) (nnoo-declare nnml) @@ -85,7 +85,12 @@ marks file will be regenerated properly by Gnus.") "If non-nil, inhibit expiry.") (defvoo nnml-use-compressed-files nil - "If non-nil, allow using compressed message files.") + "If non-nil, allow using compressed message files. + +If it is a string, use it as the file extension which specifies +the comression program. You can set it to \".bz2\" if your Emacs +supports auto-compression using the bzip2 program. A value of t +is equivalent to \".gz\".") (defvoo nnml-compressed-files-size-threshold 1000 "Default size threshold for compressed message files. @@ -631,7 +636,9 @@ non-nil.") (setq extension (and nnml-use-compressed-files (> chars nnml-compressed-files-size-threshold) - ".gz")) + (if (stringp nnml-use-compressed-files) + nnml-use-compressed-files + ".gz"))) (nnmail-insert-xref group-art) (run-hooks 'nnmail-prepare-save-mail-hook) (run-hooks 'nnml-prepare-save-mail-hook) @@ -763,12 +770,14 @@ non-nil.") (nnml-open-server server)) (setq nnml-directory (expand-file-name nnml-directory)) ;; Recurse down the directories. - (nnml-generate-nov-databases-1 nnml-directory nil t) + (nnml-generate-nov-databases-directory nnml-directory nil t) ;; Save the active file. (nnmail-save-active nnml-group-alist nnml-active-file)) -(defun nnml-generate-nov-databases-1 (dir &optional seen no-active) - "Regenerate the NOV database in DIR." +(defun nnml-generate-nov-databases-directory (dir &optional seen no-active) + "Regenerate the NOV database in DIR. + +Unless no-active is non-nil, update the active file too." (interactive "DRegenerate NOV in: ") (setq dir (file-name-as-directory dir)) ;; Only scan this sub-tree if we haven't been here yet. @@ -778,7 +787,7 @@ non-nil.") (dolist (dir (directory-files dir t nil t)) (when (and (not (string-match "^\\." (file-name-nondirectory dir))) (file-directory-p dir)) - (nnml-generate-nov-databases-1 dir seen))) + (nnml-generate-nov-databases-directory dir seen))) ;; Do this directory. (let ((files (sort (nnheader-article-to-file-alist dir) 'car-less-than-car))) @@ -1037,6 +1046,8 @@ Use the nov database for the current group if available." ;; #### other backends get a compaction feature. Also, note that invalidating ;; #### the "original article buffer" is already done at an upper level. +;; Shouldn't `nnml-request-compact-group' be interactive? --rsteib + (defun nnml-request-compact-group (group &optional server save) (nnml-possibly-change-directory group server) (unless nnml-article-file-alist @@ -1073,9 +1084,15 @@ Use the nov database for the current group if available." (let* ((oldfile (nnml-article-to-file old-number)) (newfile (gnus-replace-in-string - oldfile (concat "\\(" - old-number-string - "\\)\\(\\(\\.gz\\)?\\)$") + oldfile + ;; nnml-use-compressed-files might be any string, but + ;; probably it's sufficient to take into account only + ;; "\\.[a-z0-9]+". Note that we can't only use the + ;; value of nnml-use-compressed-files because old + ;; articles might have been saved with a different + ;; value. + (concat + "\\(" old-number-string "\\)\\(\\(\\.[a-z0-9]+\\)?\\)$") (concat new-number-string "\\2")))) (with-current-buffer nntp-server-buffer (nnmail-find-file oldfile)