Path: utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!pt.cs.cmu.edu!k.gp.cs.cmu.edu!rgs From: rgs@CS.CMU.EDU (Robert Stockton) Newsgroups: gnu.emacs.gnus Subject: Re: Kill-permanent command; Faster kill hooks Message-ID: Date: 9 Dec 89 04:33:26 GMT References: Sender: rgs@k.gp.cs.cmu.edu Organization: School of Computer Science, Carnegie Mellon University Lines: 48 In-reply-to: ashwin@gatech.edu's message of 8 Dec 89 15:41:22 GMT In article ashwin@gatech.edu (Ashwin Ram) writes: Does anyone have a 'kill-permanent' command for gnus (like the 'K' command in rn)? Also, does anyone have faster code for applying kill hooks? I find that using kill files is very slow if I have more than 4 or 5 gnus-kill commands in the kill file and there are 20-30 messages in the newsgroup. With 10 kill commands and 50 messages it's pretty much unusable. I think it is the gnus-kill function that is the bottleneck, but I could be wrong. I would tend to agree that the gnus-kill function is entirely too slow. I've seen it take upwards of half an hour on some of the larger newsgroups (which are the ones that really need kill files.) I have worked around this problem by writing my own version of 'gnus-kill which is nearly compatible with the old one, but which runs vastly faster (i.e. I have no problem running it on 1000 messages at a time). It's not incredibly clean code at the moment, but I think you will find it worthwhile anyway. If anyone out there wants to clean it up and include it in the distribution that is fine with me. ------------------------------ >8 Cut here 8< ------------------------------ (defun new-gnus-kill (field regexp &optional command) (save-excursion (save-window-excursion (switch-to-buffer gnus-Subject-buffer) (let ((fun (intern-soft (concat "gnus-header-" (downcase field)))) (headers gnus-newsgroup-headers) (value nil)) (while headers (setq value (funcall fun (car headers))) ;; Number (Lines:) or symbol must be converted to string. (or (stringp value) (setq value (prin1-to-string value))) (if (string-match regexp value) (progn (goto-char (point-min)) (while (and (re-search-forward (int-to-string (gnus-header-number (car headers))) nil t) (not (looking-at ":.\\[")))) (cond ((not (looking-at ": \\[")) nil) ((null command) (gnus-Subject-mark-as-read nil "X")) ((stringp command) ;Keyboard macro. (execute-kbd-macro command)) (t (eval command))))) (setq headers (cdr headers))))))) -- Robert Stockton ARPA: rgs@k.cs.cmu.edu UUCP: ...!seismo!cmu-cs-k!rgs ...!seismo!rgs@k.cs.cmu.edu