Subject: Re: bug#13384: gnus-treat-predicate: allow function predicates

From: Geoff Kuenning <[email-masked]>
Date: Mon, 08 Jul 2013 19:30:18 -0700

> Geoff Kuenning <[email-masked]> writes:
>
>> Gnus-treat-predicate is a bit silly, because it limits you predicates
>> the author thought of.  It's easy to extend it to be generalized, which
>> is what elisp is for in the first place.  This version lets any function
>> be called; it can access things via free variables.  See "TWO NEW LINES"
>> below:
>
> Sounds good.  Can you add this to the documentation, too, and send a
> patch for both changes?

Sorry, I don't know how to update the odd format of info pages.  But
what they should read is something like:

    9. A function: the function is called with no arguments and should
       return t or f.  The current article is available in the buffer
       named by gnus-article-buffer.

As to a patch, I think it would have been quicker to insert the two
lines than to post a reply, but whatever:

Index: gnus-art.el

--- -	2013-07-08 19:29:48.785369924 -0700
+++ /tmp/gnus-art.el	2013-07-08 19:28:55.916943064 -0700
@@ -8422,6 +8422,8 @@
 	(not (gnus-treat-predicate (car val))))
        ((eq pred 'typep)
 	(equal (car val) gnus-treat-type))
+       ((functionp pred)
+	(funcall pred))
        (t
 	(error "%S is not a valid predicate" pred)))))
    ((eq val t)

-- 
    Geoff Kuenning   [email-masked]   http://www.cs.hmc.edu/~geoff/

Orchestra retrospectively extremely satisfied with symphony [No. 1] as
result of barrel of free beer.
	-- Gustav Mahler, post-premiere letter to Arnold Berliner