Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!agate!garnet!weemba From: weemba@garnet.berkeley.edu (Matthew P Wiener) Newsgroups: comp.emacs Subject: Re: Filtering news articles in Gnews Keywords: obscenity gnews talk.bizarre Message-ID: <14124@agate.BERKELEY.EDU> Date: 10 Sep 88 23:29:55 GMT References: <5251@ea.ecn.purdue.edu> Sender: usenet@agate.BERKELEY.EDU Reply-To: weemba@garnet.berkeley.edu (Matthew P Wiener) Organization: Brahms Gang Posting Central Lines: 37 In-reply-to: housel@ea.ecn.purdue.edu (Peter S. Housel) In article <5251@ea.ecn.purdue.edu>, housel@ea (Peter S. Housel) writes: > If you use Gnews and are sick of seeing any of several offensive, >low-information-content words that people seem to be fond of posting these >days, you can use the "article-hook" to filter postings in any way you >see fit. In particular: Hey, neat idea. But it won't work as is in 2.0. For speed I now buffer text in chunks *always*. I have rot13-ing re-implemented in this manner. I shall add a new hook to supply more transform-the-new-text-before-I-display user rules here. I have to be careful at NNTP-buffered-in boundaries. >(defun article:hook nil > (if gnews-purge-obscenity > ; then > (progn (setq buffer-read-only nil) > (save-excursion > (progn (goto-char (article-min)) > (replace-regexp "" > "" nil))) > (setq buffer-read-only t)))) > >(setq article-hook 'article:hook) This isn't quite right. This works in 1.9 if article-init-display (renamed article-display-count in 2.0) is nil. If it's a number, only that many lines are displayed, and your purge will only get that part of the article. The only simple general fix in 1.9 then is to rewrite gnews-exec-1-pending, that happens to be the last call within article-get and is only called at that one point, to do some extra work--and even here there are subtleties. Gnews 2.0 comes with a gnews-rot13-string function, btw, so you won't even have to insert an explicitly offensive regexp in your private code! ucbvax!garnet!weemba Matthew P Wiener/Brahms Gang/Berkeley CA 94720