🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.gnus
Article #882

changing meaning of gnus-execute, ...

#882
From: Benjamin Chase
Date: Sun, 25 Feb 1990 00:58
53 lines
2437 bytes
[Quicky definition of gnus-kill supplied for the reader's convenience.]

	(defun gnus-kill (field regexp &optional command all)
	  "If FIELD of an article matches REGEXP, execute COMMAND.

Currently, gnus-kill is set up to munch on articles whose FIELD
matches a particular REGEXP.  This is accomplished (two levels down)
by calling string-match on the regular expression REGEXP and the value
of the indicated field FIELD.

I'd like to change gnus-kill, or something similar, so that you can
supply a function of one argument in the place of REGEXP, the regular
expression that is matched against the specified field.  Why?  So I
can do something like:

	; Return true if the value of an Xref field mentions more
	; than two newsgroups.
	(defun xref-killer (xref-line)
	  (and xref-line
	       (> (length (gnus-parse-xref-field xref-line)) 2)))

	; Kill excessively crossposted articles.
	(gnus-kill "Xref" 'xref-killer)

Without this, the only way to chew on the Xref field in a general way
is to write fairly disgusting regular expressions.  I found this
annoying, especially when I found gnus-parse-xref-field, which was
begging to be used to preprocess the Xref field.

The function supplied to gnus-kill would take the value of FIELD as an
argument and return t or nil.  Thus, the case where REGEXP was still
really a regular expression would be equivalent to calling (something
like):
	
	(gnus-kill
		FIELD
		(function (lambda (field-value)
			(string-match REGEXP field-value)))
		...
		)

(Excuse any silly mistakes, I just typed it in without thinking too
deeply.)  Of course, that equivalence would be pushed down into
gnus-kill, so that the lambda would be hidden within it.  Or perhaps
it would be pushed further down, into gnus-execute?

Of course, you'd want to find a better name for REGEXP, since it's not
just a regular expression any more.

Comments?
--
	Ben Chase <bbc@rice.edu>, Rice University, Houston, Texas
Technical Details
Message-ID: <BBC.90Feb24185812@legia.rice.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!uwm.edu!cs.utexas.edu!rice!brazos.rice.edu!bbc

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!uwm.edu!cs.utexas.edu!rice!brazos.rice.edu!bbc
From: bbc@legia.rice.edu (Benjamin Chase)
Newsgroups: gnu.emacs.gnus
Subject: changing meaning of gnus-execute, ...
Message-ID: <BBC.90Feb24185812@legia.rice.edu>
Date: 25 Feb 90 00:58:12 GMT
Sender: root@rice.edu
Reply-To: Benjamin Chase <bbc@rice.edu>
Distribution: gnu
Organization: Center for Research on Parallel Computations
Lines: 53