From a6b26a720903c98382f3d92f29388c1b1fb552fd Mon Sep 17 00:00:00 2001 From: shuhei-k Date: Sun, 8 Mar 1998 17:54:00 +0000 Subject: [PATCH] Importing qgnus-0.37 --- lisp/ChangeLog | 9 ++++++ lisp/gnus-agent.el | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++- lisp/gnus.el | 2 +- texi/ChangeLog | 1 + texi/gnus.texi | 26 +++++++++++++-- texi/message.texi | 6 ++-- 6 files changed, 125 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ba33dbe..6b2a1b3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +Sat Mar 7 21:59:18 1998 Lars Magne Ingebrigtsen + + * gnus.el: Quassia Gnus v0.37 is released. + +Sat Mar 7 20:10:42 1998 Lars Magne Ingebrigtsen + + * gnus-agent.el (gnus-agent-expire-days): New variable. + (gnus-agent-expire): New function. + Sat Mar 7 17:35:53 1998 Lars Magne Ingebrigtsen * gnus.el: Quassia Gnus v0.36 is released. diff --git a/lisp/gnus-agent.el b/lisp/gnus-agent.el index b1bc701..039dbf3 100644 --- a/lisp/gnus-agent.el +++ b/lisp/gnus-agent.el @@ -49,6 +49,11 @@ :group 'gnus-agent :type 'integer) +(defcustom gnus-agent-expire-days 7 + "Read articles older than this will be expired." + :group 'gnus-agent + :type 'integer) + ;;; Internal variables (defvar gnus-agent-history-buffers nil) @@ -546,7 +551,7 @@ the actual number of articles toggled is returned." (goto-char (point-max)) (insert id "\t" (number-to-string date) "\t") (while group-arts - (insert (caar group-arts) "/" (number-to-string (cdr (pop group-arts))) + (insert (caar group-arts) " " (number-to-string (cdr (pop group-arts))) " ")) (insert "\n"))) @@ -1192,6 +1197,88 @@ The following commands are available: "Expire all old articles." (interactive) (let ((methods gnus-agent-covered-methods) + (day (- (gnus-time-to-day (current-time)) gnus-agent-expire-days)) + (expiry-hashtb (gnus-make-hashtable 1023)) + gnus-command-method sym group articles + history overview file histories elem art nov-file low info + unreads marked article) + (save-excursion + (setq overview (get-buffer-create " *expire overview*")) + (while (setq gnus-command-method (pop methods)) + (gnus-agent-open-history) + (set-buffer + (setq gnus-agent-current-history + (setq history (gnus-agent-history-buffer)))) + (goto-char (point-min)) + (while (not (eobp)) + (skip-chars-forward "^\t") + (if (> (read (current-buffer)) day) + ;; New article; we don't expire it. + (forward-line 1) + ;; Old article. Schedule it for possible nuking. + (while (not (eolp)) + (setq sym (let ((obarray expiry-hashtb)) + (read (current-buffer)))) + (if (boundp sym) + (set sym (cons (cons (read (current-buffer)) (point)) + (symbol-value sym))) + (set sym (list (cons (read (current-buffer)) (point))))) + (skip-chars-forward " ")) + (forward-line 1))) + ;; We now have all articles that can possibly be expired. + (mapatoms + (lambda (sym) + (setq group (symbol-name sym) + articles (sort (symbol-value sym) 'car-less-than-car) + low (car (gnus-active group)) + info (gnus-get-info group) + unreads (ignore-errors (gnus-list-of-unread-articles group)) + marked (nconc (gnus-uncompress-range + (cdr (assq 'ticked (gnus-info-marks info)))) + (gnus-uncompress-range + (cdr (assq 'dormant (gnus-info-marks info))))) + nov-file (gnus-agent-article-name ".overview" group)) + (gnus-message 5 "Expiring articles in %s" group) + (set-buffer overview) + (erase-buffer) + (when (file-exists-p nov-file) + (insert-file-contents nov-file)) + (goto-char (point-min)) + (while (setq elem (pop articles)) + (setq article (car elem)) + (when (or (null low) + (< article low) + (and (not (memq article unreads)) + (not (memq article marked)))) + ;; Find and nuke the NOV line. + (while (and (not (eobp)) + (< (setq art (read (current-buffer))) article)) + (forward-line 1)) + (if (or (eobp) + (/= art article)) + (beginning-of-line) + (gnus-delete-line)) + ;; Nuke the article. + (when (file-exists-p (setq file (gnus-agent-article-name + (number-to-string article) + group))) + (delete-file file)) + ;; Schedule the history line for nuking. + (push (cdr elem) histories))) + (write-region (point-min) (point-max) nov-file nil 'silent)) + expiry-hashtb) + (set-buffer history) + (setq histories (nreverse (sort histories '<))) + (while histories + (goto-char (pop histories)) + (gnus-delete-line)) + (gnus-agent-save-history) + (gnus-agent-close-history))))) + +(defun gnus-agent-expire-old () + "Expire all old articles." + (interactive) + (let ((methods gnus-agent-covered-methods) (alist (cdr gnus-newsrc-alist)) gnus-command-method ofiles info method file group) (while (setq gnus-command-method (pop methods)) diff --git a/lisp/gnus.el b/lisp/gnus.el index 19b1a95..01df41b 100644 --- a/lisp/gnus.el +++ b/lisp/gnus.el @@ -246,7 +246,7 @@ is restarted, and sometimes reloaded." :link '(custom-manual "(gnus)Exiting Gnus") :group 'gnus) -(defconst gnus-version-number "0.36" +(defconst gnus-version-number "0.37" "Version number for this version of Gnus.") (defconst gnus-version (format "Quassia Gnus v%s" gnus-version-number) diff --git a/texi/ChangeLog b/texi/ChangeLog index a492ff1..9f4c2c7 100644 --- a/texi/ChangeLog +++ b/texi/ChangeLog @@ -2,6 +2,7 @@ Sat Mar 7 17:09:49 1998 Lars Magne Ingebrigtsen * gnus.texi: Took direntries out again, since makeinfo doesn't understand them. + (Agent Expiry): New. Sat Mar 7 16:14:10 1998 Dan Christensen diff --git a/texi/gnus.texi b/texi/gnus.texi index 2ea63f2..2398fce 100644 --- a/texi/gnus.texi +++ b/texi/gnus.texi @@ -1,7 +1,7 @@ \input texinfo @c -*-texinfo-*- @setfilename gnus -@settitle Quassia Gnus 0.36 Manual +@settitle Quassia Gnus 0.37 Manual @synindex fn cp @synindex vr cp @synindex pg cp @@ -316,7 +316,7 @@ into another language, under the above conditions for modified versions. @tex @titlepage -@title Quassia Gnus 0.36 Manual +@title Quassia Gnus 0.37 Manual @author by Lars Magne Ingebrigtsen @page @@ -352,7 +352,7 @@ can be gotten by any nefarious means you can think of---@sc{nntp}, local spool or your mbox file. All at the same time, if you want to push your luck. -This manual corresponds to Quassia Gnus 0.36. +This manual corresponds to Quassia Gnus 0.37. @end ifinfo @@ -11154,6 +11154,7 @@ Of course, to use it as such, you have to learn a few new commands. * Agent Basics:: How it all is supposed to work. * Agent Categories:: How to tell the Gnus Agent what to download. * Agent Commands:: New commands for all the buffers. +* Agent Expiry:: How to make old articles go away. * Outgoing Messages:: What happens when you post/mail something? * Agent Variables:: Customizing is fun. * Example Setup:: An example @file{.gnus.el} file for offline people. @@ -11550,6 +11551,21 @@ Agent (@code{gnus-agent-remove-server}). @end table +@node Agent Expiry +@subsection Agent Expiry + +@vindex gnus-agent-expiry-days +@findex gnus-agent-expiry +@kindex M-x gnus-agent-expiry + +@code{nnagent} doesn't handle expiry. Instead, there's a special +@code{gnus-agent-expiry} command that will expire all read articles that +are older than @code{gnus-agent-expiry-days} days. It can be run +whenever you feel that you're running out of space. It's not +particularly fast or efficient, and it's not a particularly good idea to +interrupt it (with @kbd{C-g} or anything else) once you've started it. + + @node Outgoing Messages @subsection Outgoing Messages @@ -15489,6 +15505,7 @@ Geoffrey T. Dairiki, Andre Deparade, Ulrik Dickow, Dave Disser, +Rui-Tao Dong, @c ? Joev Dubach, Michael Welsh Duggan, Dave Edmondson, @@ -15540,6 +15557,7 @@ Shlomo Mahlab, Nat Makarevitch, Istvan Marko, David Martin, +Jason R Mastaler, Gordon Matzigkeit, Timo Metzemakers, Richard Mlynarik, @@ -15556,9 +15574,11 @@ Masaharu Onishi, @c Onishi Hideki Ono, @c Ono William Perry, Stephen Peters, +Jens-Ulrik Holger Petersen, Ulrich Pfeifer, John McClary Prevost, Colin Rafferty, +Lasse Rasinen, Lars Balker Rasmussen, Joe Reiss, Renaud Rioboo, diff --git a/texi/message.texi b/texi/message.texi index 67a4ab1..afdedbd 100644 --- a/texi/message.texi +++ b/texi/message.texi @@ -1,7 +1,7 @@ \input texinfo @c -*-texinfo-*- @setfilename message -@settitle Message 0.36 Manual +@settitle Message 0.37 Manual @synindex fn cp @synindex vr cp @synindex pg cp @@ -42,7 +42,7 @@ into another language, under the above conditions for modified versions. @tex @titlepage -@title Message 0.36 Manual +@title Message 0.37 Manual @author by Lars Magne Ingebrigtsen @page @@ -83,7 +83,7 @@ Message mode buffers. * Key Index:: List of Message mode keys. @end menu -This manual corresponds to Message 0.36. Message is distributed with +This manual corresponds to Message 0.37. Message is distributed with the Gnus distribution bearing the same version number as this manual has. -- 1.7.10.4