Gnus development mailing list
 help / color / mirror / Atom feed
* gnus-summary-sort-by-X-Spam-Status
@ 2007-09-05  0:01 jidanni
  2007-09-05 10:43 ` gnus-summary-sort-by-X-Spam-Status Adam Sjøgren
  0 siblings, 1 reply; 2+ messages in thread
From: jidanni @ 2007-09-05  0:01 UTC (permalink / raw)
  To: ding

Gentlemen, I see there is no gnus-summary-sort-by-my-favorite-header
capability. I want to sort by "X-Spam-Status: Yes, score=23.3" lines.
Indeed, I need to also be sure that it does a numeric sort, so I don't
have to rewrite 2.0 to 002.0.

Looking at gnus-sum.el it seems this would be a very big effort, and
I'm better running the messages thru a filter that would put their
score (int(score*10)) into a faked existing field, so e.g.,
     Sort by lines (`gnus-summary-sort-by-lines') or
     Sort by article number (`gnus-summary-sort-by-number').
can sort by it.
I.e., score=23.3 becomes Lines: 233, etc.

I shan't tamper with gnus-summary-sort-by-score though, as that is a
whole different ball game.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: gnus-summary-sort-by-X-Spam-Status
  2007-09-05  0:01 gnus-summary-sort-by-X-Spam-Status jidanni
@ 2007-09-05 10:43 ` Adam Sjøgren
  0 siblings, 0 replies; 2+ messages in thread
From: Adam Sjøgren @ 2007-09-05 10:43 UTC (permalink / raw)
  To: ding

On Wed, 05 Sep 2007 08:01:01 +0800, jidanni@jidanni.org wrote:

> Gentlemen, I see there is no gnus-summary-sort-by-my-favorite-header
> capability.

You can define your own sort functions, though.

> I want to sort by "X-Spam-Status: Yes, score=23.3" lines.

I've got this function in my .gnus:

 ; Sort by X-Spam-Status:
 ; (by Michael Shields <shields@msrl.com> in <87brssb9cg.fsf@mulligatwani.msrl.com>
 ;; Set gnus-extra-headers instead^WALSO:
 ;; SpamAssasin 3.0.0 changed "hits" to "score":
 (add-to-list 'nnmail-extra-headers 'X-Spam-Status)
 (defun gnus-article-sort-by-spam-status (h1 h2)
   "Sort articles by score from the X-Spam-Status: header."
   (< (string-to-number (gnus-replace-in-string
                         (gnus-extra-header 'X-Spam-Status h1)
                         ".*score=" ""))
      (string-to-number (gnus-replace-in-string
                         (gnus-extra-header 'X-Spam-Status h2)
                         ".*score=" ""))))

and in the group-parameters for my spam-group, I have added:

   (gnus-extra-headers '(X-Spam-Status To Newsgroups))
   (gnus-article-sort-functions '(gnus-article-sort-by-spam-status)))

(I am using nnml for my email, which may or may not be of importance).


Ha, I just realized I stopped using SpamAssassin years ago, so the above
is a waste of time in my setup.


  Best regards,

-- 
 "I hope you're not going to ask me to explain a              Adam Sjøgren
  title."                                                asjo@koldfront.dk




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-09-05 10:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-05  0:01 gnus-summary-sort-by-X-Spam-Status jidanni
2007-09-05 10:43 ` gnus-summary-sort-by-X-Spam-Status Adam Sjøgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).