housel@ea.ecn.purdue.edu (Peter S. Housel) (09/11/88)
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: --------cut here-------- ;; the controlling variable. (defvar gnews-purge-obscenity nil "If non-nil, remove obscenities from articles. To remove offensive words from all groups, globally setq to non-nil. To purge only a particular group, set a pre-hook for that group containing \"(pre nil gnews-set 'gnews-purge-obscenity t)\"") ;; the hook function (defun article:hook nil (if gnews-purge-obscenity ; then (progn (setq buffer-read-only nil) (save-excursion (progn (goto-char (article-min)) (replace-regexp "<insert regexp of unprintables here>" "" nil))) (setq buffer-read-only t)))) (setq article-hook 'article:hook) --------cut here-------- Insert the above or something similar into your "Site.el" or whatever your "load-Gnews-and-set-up-hooks" file is called. Also, set up a pre-hook as described in the documentation string. I also load a version of replace-regexp which does not print "Mark set" and "Done" (just remove the calls to "(message ...)" from the definition, found in loaddefs.el). -Peter S. Housel- housel@ei.ecn.purdue.edu ...!pur-ee!housel
weemba@garnet.berkeley.edu (Matthew P Wiener) (09/11/88)
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 "<insert regexp of unprintables here>" > "" 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