GNU bug report logs - #13384
gnus-treat-predicate: allow function predicates

Previous Next

Package: gnus;

Reported by: Geoff Kuenning <geoff <at> cs.hmc.edu>

Date: Tue, 8 Jan 2013 02:33:02 UTC

Severity: normal

Tags: fixed

Found in version 5.13

Fixed in version 24.4

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Geoff Kuenning <geoff <at> cs.hmc.edu>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 13384 <at> debbugs.gnu.org
Subject: bug#13384: gnus-treat-predicate: allow function predicates
Date: Mon, 08 Jul 2013 19:30:18 -0700
> Geoff Kuenning <geoff <at> cs.hmc.edu> 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   geoff <at> cs.hmc.edu   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




This bug report was last modified 11 years and 305 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.