GNU bug report logs -
#13384
gnus-treat-predicate: allow function predicates
Previous Next
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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13384 in the body.
You can then email your comments to 13384 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bugs <at> gnus.org
:
bug#13384
; Package
gnus
.
(Tue, 08 Jan 2013 02:33:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Geoff Kuenning <geoff <at> cs.hmc.edu>
:
New bug report received and forwarded. Copy sent to
bugs <at> gnus.org
.
(Tue, 08 Jan 2013 02:33:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Gnus v5.13
GNU Emacs 24.2.1 (x86_64-suse-linux-gnu, GTK+ Version 3.4.4)
of 2012-10-10 on build20
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:
(defun gnus-treat-predicate (val)
(cond
((null val)
nil)
(gnus-treat-condition
(eq gnus-treat-condition val))
((and (listp val)
(stringp (car val)))
(apply 'gnus-or (mapcar `(lambda (s)
(string-match s ,(or gnus-newsgroup-name "")))
val)))
((listp val)
(let ((pred (pop val)))
(cond
((eq pred 'or)
(apply 'gnus-or (mapcar 'gnus-treat-predicate val)))
((eq pred 'and)
(apply 'gnus-and (mapcar 'gnus-treat-predicate val)))
((eq pred 'not)
(not (gnus-treat-predicate (car val))))
((eq pred 'typep)
(equal (car val) gnus-treat-type))
; TWO NEW LINES
((functionp pred)
(funcall pred))
(t
(error "%S is not a valid predicate" pred)))))
((eq val t)
t)
((eq val 'head)
nil)
((eq val 'first)
(eq part-number 1))
((eq val 'last)
(eq part-number total-parts))
((numberp val)
(< gnus-treat-length val))
(t
(error "%S is not a valid value" val))))
--
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
Information forwarded
to
bugs <at> gnus.org
:
bug#13384
; Package
gnus
.
(Sat, 06 Jul 2013 17:23:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 13384 <at> debbugs.gnu.org (full text, mbox):
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?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Information forwarded
to
bugs <at> gnus.org
:
bug#13384
; Package
gnus
.
(Tue, 09 Jul 2013 02:31:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 13384 <at> debbugs.gnu.org (full text, mbox):
> 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
Information forwarded
to
bugs <at> gnus.org
:
bug#13384
; Package
gnus
.
(Fri, 19 Jul 2013 14:03:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 13384 <at> debbugs.gnu.org (full text, mbox):
Geoff Kuenning <geoff <at> cs.hmc.edu> writes:
> As to a patch, I think it would have been quicker to insert the two
> lines than to post a reply, but whatever:
Thanks; applied.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Added tag(s) fixed.
Request was from
Lars Magne Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Fri, 19 Jul 2013 14:03:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 24.4, send any further explanations to
13384 <at> debbugs.gnu.org and Geoff Kuenning <geoff <at> cs.hmc.edu>
Request was from
Lars Magne Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Fri, 19 Jul 2013 14:03:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 17 Aug 2013 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 11 years and 304 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.