Gnus development mailing list
 help / color / mirror / Atom feed
* Expiring old low-score threads
@ 2013-04-17 11:16 Tassilo Horn
  2013-04-17 14:17 ` Eric Abrahamsen
  0 siblings, 1 reply; 6+ messages in thread
From: Tassilo Horn @ 2013-04-17 11:16 UTC (permalink / raw)
  To: ding

Hi all,

I'm reading quite a few high-traffic mailing lists, and my mailbox is
shortly before running out of space.  So I want to do some expiry.
Basically, I could use total-expire, say, after 365 days, but I'd prefer
if I could expire threads I'm not interested in much earlier than
threads that are interesting to me.

So now I'm trying to write a command that walks over all threads in the
current summary and marks all threads that have a score lower than -30
and whose most recent article is older than 60 days as expirable.
That's what I came up with so far.

--8<---------------cut here---------------start------------->8---
(defun th-gnus-summary-exprire-old-lowscore-articles ()
  (interactive)
  (goto-char (point-min))
  (dolist (thread gnus-newsgroup-threads)
    (let ((score (gnus-thread-total-score thread))
	  (age   (/ (- (gnus-float-time (current-time))
		       (gnus-thread-latest-date thread))
		    60    ;; minutes
		    60    ;; hours
		    24    ;; days
		    )))
      (message "Thread %s has score %s and is %s days old."
	       (aref (car thread) 1)
	       score age)
      ;; (when (and (> age 60)
      ;; 		 (< score -30))
      ;; 	(dolist (article thread)
      ;; 	  (gnus-summary-mark-article (aref article 0) gnus-expirable-mark)))
      )))
--8<---------------cut here---------------end--------------->8---

The problem is that in some summary buffers, I get an error when I run it:

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (wrong-type-argument buffer-or-string-p 32)
  get-text-property(0 gnus-time 32)
  #[(header) "\303\b\304H\211.\305\232\203.\0\306\202%.\307\310\311	#\206%.\312	!.\313\310\314\311\n	%\210\n))!\207" [header d time gnus-float-time 3 "" (0 0) get-text-property 0 gnus-time safe-date-to-time put-text-property 1] 8]("Re: nREPL instance started by lein repl cannot be instrumented by jvisualvm")
  mapcar(#[(header) "\303\b\304H\211.\305\232\203.\0\306\202%.\307\310\311	#\206%.\312	!.\313\310\314\311\n	%\210\n))!\207" [header d time gnus-float-time 3 "" (0 0) get-text-property 0 gnus-time safe-date-to-time put-text-property 1] 8] ("Re: nREPL instance started by lein repl cannot be instrumented by jvisualvm" [578 "Re: nREPL instance started by lein repl cannot be instrumented by jvisualvm" "Marko Topolnik <marko.topolnik@gmail.com>" #("Fri, 15 Feb 2013 01:21:32 -0800 (PST)" 0 1 (gnus-time (20765 65052))) "<f0551001-48af-4b7c-b2ef-fc6232c63c17@googlegroups.com>" "<9d494812-a424-459d-a282-16393688e661@googlegroups.com> <CA+d+gT4BhSoN5m+4BNGCKwN=ihDyb9Gqc98i-HQthUuqtDFZJQ@mail.gmail.com> <a5a38707-2b95-48b1-ba2b-813d72da1781@googlegroups.com> <7906BEE6-8D27-444B-B82D-87919AD1D5CD@zentrope.com> <86ed2273-3de5-4c69-a467-ed7c02656579@googlegroups.com> <1A308C8B-00EF-4696-BAB9-F395FB0ABE21@zentrope.com>" 11184 50 nil ((Cc . "\"leiningen@librelist.com\" <leiningen@librelist.com>") (To . "leiningen@googlegroups.com"))] [579 "Re: nREPL instance started by lein repl cannot be instrumented by jvisualvm" "Marko Topolnik <marko.topolnik@gmail.com>" #("Fri, 15 Feb 2013 05:23:26 -0800 (PST)" 0 1 (gnus-time (20766 14030))) "<02cc50a1-40dd-4f15-b30b-11be1beff8dd@googlegroups.com>" "<9d494812-a424-459d-a282-16393688e661@googlegroups.com> <CA+d+gT4BhSoN5m+4BNGCKwN=ihDyb9Gqc98i-HQthUuqtDFZJQ@mail.gmail.com> <a5a38707-2b95-48b1-ba2b-813d72da1781@googlegroups.com> <7906BEE6-8D27-444B-B82D-87919AD1D5CD@zentrope.com> <86ed2273-3de5-4c69-a467-ed7c02656579@googlegroups.com> <1A308C8B-00EF-4696-BAB9-F395FB0ABE21@zentrope.com>" 9416 27 nil ((Cc . "\"leiningen@librelist.com\" <leiningen@librelist.com>") (To . "leiningen@googlegroups.com"))]))
  gnus-thread-latest-date(("Re: nREPL instance started by lein repl cannot be instrumented by jvisualvm" ([578 "Re: nREPL instance started by lein repl cannot be instrumented by jvisualvm" "Marko Topolnik <marko.topolnik@gmail.com>" #("Fri, 15 Feb 2013 01:21:32 -0800 (PST)" 0 1 (gnus-time (20765 65052))) "<f0551001-48af-4b7c-b2ef-fc6232c63c17@googlegroups.com>" "<9d494812-a424-459d-a282-16393688e661@googlegroups.com> <CA+d+gT4BhSoN5m+4BNGCKwN=ihDyb9Gqc98i-HQthUuqtDFZJQ@mail.gmail.com> <a5a38707-2b95-48b1-ba2b-813d72da1781@googlegroups.com> <7906BEE6-8D27-444B-B82D-87919AD1D5CD@zentrope.com> <86ed2273-3de5-4c69-a467-ed7c02656579@googlegroups.com> <1A308C8B-00EF-4696-BAB9-F395FB0ABE21@zentrope.com>" 11184 50 nil ((Cc . "\"leiningen@librelist.com\" <leiningen@librelist.com>") (To . "leiningen@googlegroups.com"))]) ([579 "Re: nREPL instance started by lein repl cannot be instrumented by jvisualvm" "Marko Topolnik <marko.topolnik@gmail.com>" #("Fri, 15 Feb 2013 05:23:26 -0800 (PST)" 0 1 (gnus-time (20766 14030))) "<02cc50a1-40dd-4f15-b30b-11be1beff8dd@googlegroups.com>" "<9d494812-a424-459d-a282-16393688e661@googlegroups.com> <CA+d+gT4BhSoN5m+4BNGCKwN=ihDyb9Gqc98i-HQthUuqtDFZJQ@mail.gmail.com> <a5a38707-2b95-48b1-ba2b-813d72da1781@googlegroups.com> <7906BEE6-8D27-444B-B82D-87919AD1D5CD@zentrope.com> <86ed2273-3de5-4c69-a467-ed7c02656579@googlegroups.com> <1A308C8B-00EF-4696-BAB9-F395FB0ABE21@zentrope.com>" 9416 27 nil ((Cc . "\"leiningen@librelist.com\" <leiningen@librelist.com>") (To . "leiningen@googlegroups.com"))])))
  (- (gnus-float-time (current-time)) (gnus-thread-latest-date thread))
  (/ (- (gnus-float-time (current-time)) (gnus-thread-latest-date thread)) 60 60 24)
  (let ((score (gnus-thread-total-score thread)) (age (/ (- (gnus-float-time (current-time)) (gnus-thread-latest-date thread)) 60 60 24))) (message "Thread %s has score %s and is %s days old." (aref (car thread) 1) score age))
  (while --dolist-tail-- (setq thread (car --dolist-tail--)) (let ((score (gnus-thread-total-score thread)) (age (/ (- (gnus-float-time (current-time)) (gnus-thread-latest-date thread)) 60 60 24))) (message "Thread %s has score %s and is %s days old." (aref (car thread) 1) score age)) (setq --dolist-tail-- (cdr --dolist-tail--)))
  (let ((--dolist-tail-- gnus-newsgroup-threads) thread) (while --dolist-tail-- (setq thread (car --dolist-tail--)) (let ((score (gnus-thread-total-score thread)) (age (/ (- (gnus-float-time ...) (gnus-thread-latest-date thread)) 60 60 24))) (message "Thread %s has score %s and is %s days old." (aref (car thread) 1) score age)) (setq --dolist-tail-- (cdr --dolist-tail--))))
  (catch (quote --cl-block-nil--) (let ((--dolist-tail-- gnus-newsgroup-threads) thread) (while --dolist-tail-- (setq thread (car --dolist-tail--)) (let ((score (gnus-thread-total-score thread)) (age (/ (- ... ...) 60 60 24))) (message "Thread %s has score %s and is %s days old." (aref (car thread) 1) score age)) (setq --dolist-tail-- (cdr --dolist-tail--)))))
  (cl--block-wrapper (catch (quote --cl-block-nil--) (let ((--dolist-tail-- gnus-newsgroup-threads) thread) (while --dolist-tail-- (setq thread (car --dolist-tail--)) (let ((score (gnus-thread-total-score thread)) (age (/ ... 60 60 24))) (message "Thread %s has score %s and is %s days old." (aref (car thread) 1) score age)) (setq --dolist-tail-- (cdr --dolist-tail--))))))
  (cl-block nil (let ((--dolist-tail-- gnus-newsgroup-threads) thread) (while --dolist-tail-- (setq thread (car --dolist-tail--)) (let ((score (gnus-thread-total-score thread)) (age (/ (- ... ...) 60 60 24))) (message "Thread %s has score %s and is %s days old." (aref (car thread) 1) score age)) (setq --dolist-tail-- (cdr --dolist-tail--)))))
  (dolist (thread gnus-newsgroup-threads) (let ((score (gnus-thread-total-score thread)) (age (/ (- (gnus-float-time (current-time)) (gnus-thread-latest-date thread)) 60 60 24))) (message "Thread %s has score %s and is %s days old." (aref (car thread) 1) score age)))
  th-gnus-summary-exprire-old-lowscore-articles()
  call-interactively(th-gnus-summary-exprire-old-lowscore-articles record nil)
  command-execute(th-gnus-summary-exprire-old-lowscore-articles record)
  execute-extended-command(nil "th-gnus-summary-exprire-old-lowscore-articles")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)
--8<---------------cut here---------------end--------------->8---

This seems to happen when there's an incomplete thread.  At least the
command doesn't error after I've referred the complete thread using A T.
On the other hand, when I open a summary of another group where also
incomplete threads are shown, I don't get that error.

Hm, it seems that it's caused by the thread having a false root.  That
is, the error appears when the thread looks like

--8<---------------cut here---------------start------------->8---
O ┃ +┃Marko Topolnik         ┃ ○ Re: nREPL instance started...
O ┃ +┃Marko Topolnik         ┃  ╰─❯  <February 15>
--8<---------------cut here---------------end--------------->8---

but when I hit ^ and it becomes

--8<---------------cut here---------------start------------->8---
R ┃  ┃Keith Irwin            ┃ ● Re: nREPL instance started...
R ┃ +┃Marko Topolnik         ┃ ├─❯  <February 15>
O ┃ +┃Marko Topolnik         ┃ ╰─❯  <February 15>
--8<---------------cut here---------------end--------------->8---

my command works without any error.

How can I fix this?  I mean, I obviously want to run my command in
complete summary containing all articles I've ever received in that
group.  Of course, chances are high that the group contains incomplete
threads with false roots where ^ (gnus-summary-refer-parent-article)
won't cure the symptoms.

Bye,
Tassilo



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

* Re: Expiring old low-score threads
  2013-04-17 11:16 Expiring old low-score threads Tassilo Horn
@ 2013-04-17 14:17 ` Eric Abrahamsen
  2013-04-17 14:31   ` Tassilo Horn
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Abrahamsen @ 2013-04-17 14:17 UTC (permalink / raw)
  To: ding

Tassilo Horn <tsdh@gnu.org> writes:

> Hi all,
>
> I'm reading quite a few high-traffic mailing lists, and my mailbox is
> shortly before running out of space.  So I want to do some expiry.
> Basically, I could use total-expire, say, after 365 days, but I'd prefer
> if I could expire threads I'm not interested in much earlier than
> threads that are interesting to me.
>
> So now I'm trying to write a command that walks over all threads in the
> current summary and marks all threads that have a score lower than -30
> and whose most recent article is older than 60 days as expirable.
> That's what I came up with so far.

[...]

> How can I fix this?  I mean, I obviously want to run my command in
> complete summary containing all articles I've ever received in that
> group.  Of course, chances are high that the group contains incomplete
> threads with false roots where ^ (gnus-summary-refer-parent-article)
> won't cure the symptoms.

It's highly unlikely that I'm actually going to be able to help you with
this, but in trying to write functions that run over *all* the messages
in a group I've usually had to start them like this:

(defun  th-gnus-summary-exprire-old-lowscore-articles (group)
  (interactive (list (gnus-group-group-name)))
  (let ((gnus-large-newsgroup nil))
    (gnus-summary-read-group group t t nil)

That at least ensures that all the available messages are present in the
*Summary* buffer.

To be honest I haven't had much luck manipulating Gnus
programmatically...

Eric





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

* Re: Expiring old low-score threads
  2013-04-17 14:17 ` Eric Abrahamsen
@ 2013-04-17 14:31   ` Tassilo Horn
  2013-04-18  0:10     ` Eric Abrahamsen
  0 siblings, 1 reply; 6+ messages in thread
From: Tassilo Horn @ 2013-04-17 14:31 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: ding

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

>> How can I fix this?  I mean, I obviously want to run my command in
>> complete summary containing all articles I've ever received in that
>> group.  Of course, chances are high that the group contains
>> incomplete threads with false roots where ^
>> (gnus-summary-refer-parent-article) won't cure the symptoms.
>
> It's highly unlikely that I'm actually going to be able to help you
> with this, but in trying to write functions that run over *all* the
> messages in a group I've usually had to start them like this:
>
> (defun  th-gnus-summary-exprire-old-lowscore-articles (group)
>   (interactive (list (gnus-group-group-name)))
>   (let ((gnus-large-newsgroup nil))
>     (gnus-summary-read-group group t t nil)
>
> That at least ensures that all the available messages are present in
> the *Summary* buffer.

I'm afraid, that doesn't help, because "all available messages" doesn't
equal "there are no false roots in threads", and those seem to be the
culprit for my code. :-(

But still, I can use your code in order to run my command from *Group*
instead of summary...

Thanks,
Tassilo



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

* Re: Expiring old low-score threads
  2013-04-17 14:31   ` Tassilo Horn
@ 2013-04-18  0:10     ` Eric Abrahamsen
  2013-04-18  6:51       ` Tassilo Horn
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Abrahamsen @ 2013-04-18  0:10 UTC (permalink / raw)
  To: ding

Tassilo Horn <tsdh@gnu.org> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>>> How can I fix this?  I mean, I obviously want to run my command in
>>> complete summary containing all articles I've ever received in that
>>> group.  Of course, chances are high that the group contains
>>> incomplete threads with false roots where ^
>>> (gnus-summary-refer-parent-article) won't cure the symptoms.
>>
>> It's highly unlikely that I'm actually going to be able to help you
>> with this, but in trying to write functions that run over *all* the
>> messages in a group I've usually had to start them like this:
>>
>> (defun  th-gnus-summary-exprire-old-lowscore-articles (group)
>>   (interactive (list (gnus-group-group-name)))
>>   (let ((gnus-large-newsgroup nil))
>>     (gnus-summary-read-group group t t nil)
>>
>> That at least ensures that all the available messages are present in
>> the *Summary* buffer.
>
> I'm afraid, that doesn't help, 

No, I didn't really think it would :)

> because "all available messages" doesn't equal "there are no false
> roots in threads", and those seem to be the culprit for my code. :-(
>
> But still, I can use your code in order to run my command from *Group*
> instead of summary...

Some sort of a "hacking gnus" page on the emacs wiki sometimes seems
like a good idea.




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

* Re: Expiring old low-score threads
  2013-04-18  0:10     ` Eric Abrahamsen
@ 2013-04-18  6:51       ` Tassilo Horn
  2013-04-18  7:08         ` Eric Abrahamsen
  0 siblings, 1 reply; 6+ messages in thread
From: Tassilo Horn @ 2013-04-18  6:51 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: ding

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

>>>> How can I fix this?  I mean, I obviously want to run my command in
>>>> complete summary containing all articles I've ever received in that
>>>> group.  Of course, chances are high that the group contains
>>>> incomplete threads with false roots where ^
>>>> (gnus-summary-refer-parent-article) won't cure the symptoms.
>>>
>>> It's highly unlikely that I'm actually going to be able to help you
>>> with this, but in trying to write functions that run over *all* the
>>> messages in a group I've usually had to start them like this:
>>>
>>> (defun  th-gnus-summary-exprire-old-lowscore-articles (group)
>>>   (interactive (list (gnus-group-group-name)))
>>>   (let ((gnus-large-newsgroup nil))
>>>     (gnus-summary-read-group group t t nil)
>>>
>>> That at least ensures that all the available messages are present in
>>> the *Summary* buffer.
>>
>> I'm afraid, that doesn't help, 
>
> No, I didn't really think it would :)

It's nice to have a conversation anyway. :-)

>> because "all available messages" doesn't equal "there are no false
>> roots in threads", and those seem to be the culprit for my code. :-(
>>
>> But still, I can use your code in order to run my command from
>> *Group* instead of summary...
>
> Some sort of a "hacking gnus" page on the emacs wiki sometimes seems
> like a good idea.

Yes, or even better, (info "(gnus)Gnus Reference Guide") could be
extended.

Bye,
Tassilo



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

* Re: Expiring old low-score threads
  2013-04-18  6:51       ` Tassilo Horn
@ 2013-04-18  7:08         ` Eric Abrahamsen
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Abrahamsen @ 2013-04-18  7:08 UTC (permalink / raw)
  To: ding

Tassilo Horn <tsdh@gnu.org> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>>>>> How can I fix this?  I mean, I obviously want to run my command in
>>>>> complete summary containing all articles I've ever received in that
>>>>> group.  Of course, chances are high that the group contains
>>>>> incomplete threads with false roots where ^
>>>>> (gnus-summary-refer-parent-article) won't cure the symptoms.
>>>>
>>>> It's highly unlikely that I'm actually going to be able to help you
>>>> with this, but in trying to write functions that run over *all* the
>>>> messages in a group I've usually had to start them like this:
>>>>
>>>> (defun  th-gnus-summary-exprire-old-lowscore-articles (group)
>>>>   (interactive (list (gnus-group-group-name)))
>>>>   (let ((gnus-large-newsgroup nil))
>>>>     (gnus-summary-read-group group t t nil)
>>>>
>>>> That at least ensures that all the available messages are present in
>>>> the *Summary* buffer.
>>>
>>> I'm afraid, that doesn't help, 
>>
>> No, I didn't really think it would :)
>
> It's nice to have a conversation anyway. :-)
>
>>> because "all available messages" doesn't equal "there are no false
>>> roots in threads", and those seem to be the culprit for my code. :-(
>>>
>>> But still, I can use your code in order to run my command from
>>> *Group* instead of summary...
>>
>> Some sort of a "hacking gnus" page on the emacs wiki sometimes seems
>> like a good idea.
>
> Yes, or even better, (info "(gnus)Gnus Reference Guide") could be
> extended.

Oh man, I wish I'd found that section of the manual earlier! That could
have saved me quite a bit of time.

What I'd really like to be able to do is edit a message's headers and
resave it from a lisp program...

E




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

end of thread, other threads:[~2013-04-18  7:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-17 11:16 Expiring old low-score threads Tassilo Horn
2013-04-17 14:17 ` Eric Abrahamsen
2013-04-17 14:31   ` Tassilo Horn
2013-04-18  0:10     ` Eric Abrahamsen
2013-04-18  6:51       ` Tassilo Horn
2013-04-18  7:08         ` Eric Abrahamsen

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).