Gnus development mailing list
 help / color / mirror / Atom feed
* [patch] Filter History for nnmail.el
@ 1999-11-18 19:28 BrYan P. Johnson
  1999-11-24 20:17 ` Danny Siu
  0 siblings, 1 reply; 4+ messages in thread
From: BrYan P. Johnson @ 1999-11-18 19:28 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 722 bytes --]

Here's a proposed patch for nnmail.el that gives some nice output
about the split history. I wrote this because I find it useful to see
at a glance where my mail was split to.

The output looks something like this:

Wed Nov 10 15:34:00 1999
 -- Current Split -- 
dense-list : 1
 -- Session Split -- 
dense-list : 1
ding: 2
gnome-devel : 15


Where current split is where mail was split the last time you checked
mail, and session split is where mail was split since you either
started gnus or cleared the session.

I've seen talk of a feature freeze, so I've made this available as a
package rather than a patch at my web site if this doesn't make it
into this release. <URL:http://www.comsecmilnavpac.net/elisp/>

BrYan


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: split history output for nnmail --]
[-- Type: text/x-patch, Size: 4133 bytes --]

--- gnus-new/lisp/nnmail.el	Sun Nov  7 23:11:07 1999
+++ gnus-working/lisp/nnmail.el	Wed Nov 10 15:23:24 1999
@@ -107,6 +107,20 @@
 		 (function-item nnmail-split-fancy)
 		 (function :tag "Other")))
 
+(defcustom nnmail-filter-history-show-session-history t
+  "If t, show the session history when doing nnmail-filter-history."
+  :group 'nnmail-split
+  :type 'boolean
+  )
+
+(defcustom nnmail-filter-history-show-current-split t
+  "If t, show the current split when doing nnmail-filter-history."
+  :group 'nnmail-split
+  :type 'boolean
+  )
+
+
+
 ;; Suggested by Erik Selberg <speed@cs.washington.edu>.
 (defcustom nnmail-crosspost t
   "If non-nil, do crossposting if several split methods match the mail.
@@ -1608,6 +1622,61 @@
     (save-excursion
       (and (nnmail-search-unix-mail-delim-backward)
 	   (not (search-forward "\n\n" pos t))))))
+
+
+(defvar nnmail-session-split-history nil
+  "Session history for mail splits")
+
+(defun nnmail-filter-history-clear-session ()
+  "Clear the current nnmail-filter-history-session."
+  (interactive)
+  (setq nnmail-session-split-history nil))
+
+(defun nnmail-filter-history () 
+  "Creates a buffer with a summary of the number of messages you've
+received per mailbox.  The buffer name is *Filter History* To run, add
+it to a hook called when you check for new mail, such as
+gnus-group-mode-hook or gnus-after-getting-new-news-hook or it may be
+called interactively."
+  (interactive)
+  (with-output-to-temp-buffer "*Filter History*"
+    (let* ((my-split-history nnmail-split-history)
+	  (my-session-split-history (append nnmail-session-split-history nnmail-split-history)))
+      (progn
+	(princ (current-time-string))
+		(if nnmail-filter-history-show-current-split
+	(princ (concat
+		    "\n -- Current Split -- \n"
+		  (mapconcat (lambda (elem) (concat (car elem) " : " (number-to-string (cdr elem))))
+			   (let ((history (sort (mapcar 'caar my-split-history)
+						'string<)))
+			     (mapcar (lambda (x) (cons x (count x history :test 'string=)))
+				     (let (new (tail history))
+				       (while tail
+					 (or (member (car tail) new)
+					     (setq new (cons (car tail) new)))
+					 (setq tail (cdr tail)))
+				       (nreverse new))))
+			   "\n"))))
+	(if nnmail-filter-history-show-session-history
+	(princ (concat
+		"\n -- Session Split -- \n"
+		(mapconcat (lambda (elem) (concat (car elem) " : " (number-to-string (cdr elem))))
+			   (let ((history (sort (mapcar 'caar my-session-split-history)
+						'string<)))
+			     (mapcar (lambda (x) (cons x (count x history :test 'string=)))
+				     (let (new (tail history))
+				       (while tail
+					 (or (member (car tail) new)
+					     (setq new (cons (car tail) new)))
+					 (setq tail (cdr tail)))
+				       (nreverse new))))
+			   "\n"))))
+	(setq nnmail-session-split-history my-session-split-history)
+	)))
+      (setq nnmail-split-history nil)
+    )
+
 
 (run-hooks 'nnmail-load-hook)
 

--- gnus/lisp/ChangeLog	Thu Nov 18 13:16:52 1999
+++ gnus-new/lisp/ChangeLog	Thu Nov 18 14:24:31 1999
@@ -1,3 +1,22 @@
+1999-11-18  BrYan P. Johnson  <beej@mindspring.net>
+
+	* nnmail.el (nnmail-filter-history): New function. Creates a
+ 	buffer with a summary of the number of messages you've received
+ 	per mailbox.  The buffer name is *Filter History* To run, add it
+ 	to a hook called when you check for new mail, such as
+ 	gnus-group-mode-hook or gnus-after-getting-new-news-hook or it may
+ 	be called interactively."
+	(nnmail-filter-history-clear-session): New function. Clear the
+ 	current nnmail-filter-history-session.
+	(nnmail-session-split-history): New variable. Session history for
+ 	mail splits for use with nnmail-filter-history.
+	(nnmail-filter-history-show-session-history): New configurable
+ 	variable. If t, show the session history when doing
+ 	nnmail-filter-history.
+	(nnmail-filter-history-show-current-split): New configurable
+ 	variable If t, show the current split when doing
+ 	nnmail-filter-history.
+	
 1999-11-18  Matthias Andree  <ma@dt.e-technik.uni-dortmund.de>
 
 	* imap.el (require): Added autoload for base64-encode-string.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-12-01 16:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-18 19:28 [patch] Filter History for nnmail.el BrYan P. Johnson
1999-11-24 20:17 ` Danny Siu
1999-11-29 21:24   ` BrYan P. Johnson
1999-12-01 16:57     ` Lars Magne Ingebrigtsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).