Little Echelon
Hi,
I'm helping to summarize debian-devel. (I'm not an offcial Debian
developer now. hint, hint. :) )
I wrote a small elisp defun trying to catch up the number of posts a
developer (or not ;) ) makes in one week to debian-devel. I just tested
it locally. (This post is just frankly a test, 'cause I've wait nearly
two hours and got no post to debian-devel. ;) I'm anxious! ;) Yeap, I'm
quite new to elisp. :) )
It's used with Gnus (~/.gnus.el), nnmail-split-fancy,
(any "debian-devel@lists\\.debian\\.org"
(| ("from" "\\(\\w+@\\(\\w+\\.\\)+\\w+\\)"
(: dwn-counter "/home/zw/.dwn/devel" "d.devel" \\1))
"d.devel"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; .dwn file format
;; [(email . count)
;; (...)]
;;
(defun dwn-counter (file group email)
"Count the times the email address posts. Return the string group
for use in nnmail-split-fancy."
(let* ((count-buf (find-file-noselect file))
(count-vec (read count-buf)))
(let ((current-buf (current-buffer)))
(set-buffer count-buf)
(backward-kill-sexp 1)
(set-buffer current-buf)) ;; here's ugly. don't know. :(
(print (vconcat (dwn-counter-analyzer nil count-vec email)) count-buf)
(concat group)))
(defun dwn-counter-analyzer (count-vec loop-vec email)
(let ((focus (car (append loop-vec nil))))
(if (consp focus)
(if (string=? (car focus) email)
(vconcat count-vec
(list (cons (car focus)
(+ 1 (cdr focus))))
(cdr (append loop-vec nil)))
(dwn-counter-analyzer (vconcat count-vec (list focus))
(vconcat (cdr (append loop-vec nil)))
email))
(vconcat count-vec
(list (cons email 1))))))
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Still don't know if it will work. :) And surely it will need *big*
enhancement. ;)
If you think anything here stupid, please tell me. ;) I'm new to elisp
and I will need you help. :)
If here's anything seriously wrong, I may use procmail and guile to ... ;)
--
zhaoway -=- zw * zhaoway.com -=- http://www.zhaoway.com/ -=- blue ribbon
GnuPG 1024D/7C0441F2 BF4F B39D A53E A9BB 1057 2364 652C 1BA6 7C04 41F2
Reply to: