* gnus-summary-save-in-pipe does not pipe raw article
@ 2008-07-19 8:28 Graham Murray
2008-07-19 11:19 ` Katsumi Yamaoka
0 siblings, 1 reply; 14+ messages in thread
From: Graham Murray @ 2008-07-19 8:28 UTC (permalink / raw)
To: ding
Until recently, following the example in the documentation I was able to
"report" spam articles using spamassassin using the function
(defun my-gnus-raze-spam ()
"Invoke SpamAssassin reporting , then mark it as expirable."
(interactive)
(gnus-summary-show-raw-article)
(gnus-summary-save-in-pipe "spamassassin -r")
(gnus-summary-mark-as-expirable 1))
Now using the latest cvs of ngnus, the raw article is not sent to the
pipe.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: gnus-summary-save-in-pipe does not pipe raw article
2008-07-19 8:28 gnus-summary-save-in-pipe does not pipe raw article Graham Murray
@ 2008-07-19 11:19 ` Katsumi Yamaoka
2008-07-22 23:11 ` Katsumi Yamaoka
0 siblings, 1 reply; 14+ messages in thread
From: Katsumi Yamaoka @ 2008-07-19 11:19 UTC (permalink / raw)
To: Graham Murray; +Cc: ding
[-- Attachment #1: Type: text/plain, Size: 579 bytes --]
>>>>> In <87mykes2g8.fsf@newton.gmurray.org.uk>
>>>>> Graham Murray <graham@gmurray.org.uk> wrote:
> Until recently, following the example in the documentation I was able to
> "report" spam articles using spamassassin using the function
> (defun my-gnus-raze-spam ()
> "Invoke SpamAssassin reporting , then mark it as expirable."
> (interactive)
> (gnus-summary-show-raw-article)
> (gnus-summary-save-in-pipe "spamassassin -r")
> (gnus-summary-mark-as-expirable 1))
> Now using the latest cvs of ngnus, the raw article is not sent to the
> pipe.
Try this instead:
[-- Attachment #2: Type: application/emacs-lisp, Size: 376 bytes --]
[-- Attachment #3: Type: text/plain, Size: 135 bytes --]
;; cf. (info "(gnus)Saving Articles")
Or if you use `gnus-summary-save-in-pipe' for only this feature
simply you can do as follows:
[-- Attachment #4: Type: application/emacs-lisp, Size: 271 bytes --]
[-- Attachment #5: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: gnus-summary-save-in-pipe does not pipe raw article
2008-07-19 11:19 ` Katsumi Yamaoka
@ 2008-07-22 23:11 ` Katsumi Yamaoka
2008-07-23 7:22 ` Gabor Z. Papp
2008-07-23 20:17 ` Reiner Steib
0 siblings, 2 replies; 14+ messages in thread
From: Katsumi Yamaoka @ 2008-07-22 23:11 UTC (permalink / raw)
To: Gabor Z. Papp; +Cc: ding
[-- Attachment #1: Type: text/plain, Size: 849 bytes --]
>>>>> Gabor Z. Papp wrote:
>| (defun my-gnus-raze-spam ()
>| "Invoke SpamAssassin reporting , then mark it as expirable."
>| (interactive)
>| (let ((decode (get 'gnus-summary-save-in-pipe :decode)))
>| (put 'gnus-summary-save-in-pipe :decode nil)
>| (unwind-protect
>| (gnus-summary-save-in-pipe "spamassassin -r")
>| (put 'gnus-summary-save-in-pipe :decode decode)))
>| (gnus-summary-mark-as-expirable 1))
> With this code, using "cat | /path/to/command" instead of
> "spamassassin -r" I can't pipe the full raw article with headers, only
> with From/To/Subject/Date headers. What I'm missing?
Oops, I forgot to take account of the `:headers' property for
`gnus-summary-save-in-pipe'. I've fixed it in the Gnus CVS trunk.
If you think nothing of updating your Gnus, update and install it,
and use the following instead:
[-- Attachment #2: Type: application/emacs-lisp, Size: 562 bytes --]
[-- Attachment #3: Type: text/plain, Size: 103 bytes --]
Otherwise, you can use this workaround (which can be used with
both the fixed Gnus and the old one):
[-- Attachment #4: Type: application/emacs-lisp, Size: 605 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: gnus-summary-save-in-pipe does not pipe raw article
2008-07-22 23:11 ` Katsumi Yamaoka
@ 2008-07-23 7:22 ` Gabor Z. Papp
2008-07-23 7:54 ` Katsumi Yamaoka
2008-07-23 20:17 ` Reiner Steib
1 sibling, 1 reply; 14+ messages in thread
From: Gabor Z. Papp @ 2008-07-23 7:22 UTC (permalink / raw)
To: Katsumi Yamaoka; +Cc: ding
* Katsumi Yamaoka <yamaoka@jpl.org>:
| Oops, I forgot to take account of the `:headers' property for
| `gnus-summary-save-in-pipe'. I've fixed it in the Gnus CVS trunk.
Thanks, seems like ok. Only one problem left, earlier with the code
below I was able to mark more articles and pipe them one by one in batch:
(defun gzp-pipe-spam (&optional n)
(interactive "P")
(let* ( (pipe (format "cat | /path/to/cmd"))
)
(save-excursion
(dolist (article (gnus-summary-work-articles n))
(gnus-summary-goto-subject article)
(gnus-summary-show-raw-article)
(gnus-summary-save-in-pipe :decode nil)
(gnus-summary-save-in-pipe pipe)
(gnus-summary-show-article)
)))
(gnus-summary-expand-window))
The current code does only one article even I mark more.
I can't fix it, could someone help? :-)
(defun gzp-pipe-spam (&optional n)
(interactive "P")
(let ((decode (get 'gnus-summary-save-in-pipe :decode))
(headers (get 'gnus-summary-save-in-pipe :headers))
(gnus-save-all-headers t))
(put 'gnus-summary-save-in-pipe :decode nil)
(put 'gnus-summary-save-in-pipe :headers nil)
(unwind-protect
(gnus-summary-save-in-pipe "cat | /path/to/cmd")
(put 'gnus-summary-save-in-pipe :decode decode)
(put 'gnus-summary-save-in-pipe :headers headers))
(gnus-summary-expand-window))
)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: gnus-summary-save-in-pipe does not pipe raw article
2008-07-23 7:22 ` Gabor Z. Papp
@ 2008-07-23 7:54 ` Katsumi Yamaoka
2008-07-23 7:59 ` Gabor Z. Papp
2008-07-24 15:08 ` Dan Christensen
0 siblings, 2 replies; 14+ messages in thread
From: Katsumi Yamaoka @ 2008-07-23 7:54 UTC (permalink / raw)
To: Gabor Z. Papp; +Cc: ding
[-- Attachment #1: Type: text/plain, Size: 914 bytes --]
>>>>> Gabor Z. Papp wrote:
> Thanks, seems like ok.
Thank you for verifying it.
> Only one problem left, earlier with the code below I was able to
> mark more articles and pipe them one by one in batch:
> (defun gzp-pipe-spam (&optional n)
> (interactive "P")
> (let* ( (pipe (format "cat | /path/to/cmd"))
> )
> (save-excursion
> (dolist (article (gnus-summary-work-articles n))
> (gnus-summary-goto-subject article)
> (gnus-summary-show-raw-article)
> (gnus-summary-save-in-pipe :decode nil)
> (gnus-summary-save-in-pipe pipe)
> (gnus-summary-show-article)
^^^^^^^^^^^^^^^^^^^^^^^^^^^ Isn't it unnecessary?
> )))
> (gnus-summary-expand-window))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ That's a good idea.
> The current code does only one article even I mark more.
> I can't fix it, could someone help? :-)
Ok. Could you try this one?
[-- Attachment #2: Type: application/emacs-lisp, Size: 660 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: gnus-summary-save-in-pipe does not pipe raw article
2008-07-23 7:54 ` Katsumi Yamaoka
@ 2008-07-23 7:59 ` Gabor Z. Papp
2008-07-24 15:08 ` Dan Christensen
1 sibling, 0 replies; 14+ messages in thread
From: Gabor Z. Papp @ 2008-07-23 7:59 UTC (permalink / raw)
To: Katsumi Yamaoka; +Cc: ding
* Katsumi Yamaoka <yamaoka@jpl.org>:
| Ok. Could you try this one?
Thank you, it works as I excepted.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: gnus-summary-save-in-pipe does not pipe raw article
2008-07-22 23:11 ` Katsumi Yamaoka
2008-07-23 7:22 ` Gabor Z. Papp
@ 2008-07-23 20:17 ` Reiner Steib
2008-07-23 20:24 ` Graham Murray
1 sibling, 1 reply; 14+ messages in thread
From: Reiner Steib @ 2008-07-23 20:17 UTC (permalink / raw)
To: ding
On Wed, Jul 23 2008, Katsumi Yamaoka wrote:
> "Invoke SpamAssassin reporting , then mark it as expirable."
Can't `spam.el' be used for this? There's some support for
spamassassin there.
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: gnus-summary-save-in-pipe does not pipe raw article
2008-07-23 20:17 ` Reiner Steib
@ 2008-07-23 20:24 ` Graham Murray
2008-07-24 15:29 ` Ted Zlatanov
0 siblings, 1 reply; 14+ messages in thread
From: Graham Murray @ 2008-07-23 20:24 UTC (permalink / raw)
To: ding
Reiner Steib <reinersteib+gmane@imap.cc> writes:
> On Wed, Jul 23 2008, Katsumi Yamaoka wrote:
>
>> "Invoke SpamAssassin reporting , then mark it as expirable."
>
> Can't `spam.el' be used for this? There's some support for
> spamassassin there.
spam.el only allows learning as spam (or ham) locally, it does not allow
for reporting to external systems such as DCC, razor, pyzor, and
spamcop.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: gnus-summary-save-in-pipe does not pipe raw article
2008-07-23 7:54 ` Katsumi Yamaoka
2008-07-23 7:59 ` Gabor Z. Papp
@ 2008-07-24 15:08 ` Dan Christensen
2008-07-25 0:15 ` Katsumi Yamaoka
1 sibling, 1 reply; 14+ messages in thread
From: Dan Christensen @ 2008-07-24 15:08 UTC (permalink / raw)
To: ding
Katsumi Yamaoka <yamaoka@jpl.org> writes:
> (let* ((pipe (format "cat | /path/to/cmd"))
>
> (decode (get 'gnus-summary-save-in-pipe :decode))
> (headers (get 'gnus-summary-save-in-pipe :headers))
> (gnus-save-all-headers t)
>
> )
> (put 'gnus-summary-save-in-pipe :decode nil)
> (put 'gnus-summary-save-in-pipe :headers nil)
> (unwind-protect
> (save-excursion
> (dolist (article (gnus-summary-work-articles n))
> (gnus-summary-goto-subject article)
> (gnus-summary-save-in-pipe pipe)
> ))
> (put 'gnus-summary-save-in-pipe :decode decode)
> (put 'gnus-summary-save-in-pipe :headers headers)))
> (gnus-summary-expand-window))
Maybe all but two or three lines of the above should be made into a
function gnus-summary-save-in-pipe-raw? Or maybe the existing function
gnus-summary-save-in-pipe should take an optional "raw" argument to get
this behaviour? Forcing the caller to jump through the above hoops
seems excessive...
Dan
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: gnus-summary-save-in-pipe does not pipe raw article
2008-07-23 20:24 ` Graham Murray
@ 2008-07-24 15:29 ` Ted Zlatanov
0 siblings, 0 replies; 14+ messages in thread
From: Ted Zlatanov @ 2008-07-24 15:29 UTC (permalink / raw)
To: ding
On Wed, 23 Jul 2008 21:24:15 +0100 Graham Murray <graham@gmurray.org.uk> wrote:
GM> Reiner Steib <reinersteib+gmane@imap.cc> writes:
>> On Wed, Jul 23 2008, Katsumi Yamaoka wrote:
>>
>>> "Invoke SpamAssassin reporting , then mark it as expirable."
>>
>> Can't `spam.el' be used for this? There's some support for
>> spamassassin there.
GM> spam.el only allows learning as spam (or ham) locally, it does not allow
GM> for reporting to external systems such as DCC, razor, pyzor, and
GM> spamcop.
Have you seen spam-report.el? Maybe it can be useful to you. The
methods should be easily adaptable to other remote systems besides
what's there currently.
Ted
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: gnus-summary-save-in-pipe does not pipe raw article
2008-07-24 15:08 ` Dan Christensen
@ 2008-07-25 0:15 ` Katsumi Yamaoka
2008-07-25 8:25 ` Lloyd Zusman
0 siblings, 1 reply; 14+ messages in thread
From: Katsumi Yamaoka @ 2008-07-25 0:15 UTC (permalink / raw)
To: ding
[-- Attachment #1: Type: text/plain, Size: 1341 bytes --]
>>>>> Dan Christensen wrote:
> Katsumi Yamaoka <yamaoka@jpl.org> writes:
>> (let* ((pipe (format "cat | /path/to/cmd"))
>>
>> (decode (get 'gnus-summary-save-in-pipe :decode))
>> (headers (get 'gnus-summary-save-in-pipe :headers))
>> (gnus-save-all-headers t)
>>
>> )
>> (put 'gnus-summary-save-in-pipe :decode nil)
>> (put 'gnus-summary-save-in-pipe :headers nil)
>> (unwind-protect
>> (save-excursion
>> (dolist (article (gnus-summary-work-articles n))
>> (gnus-summary-goto-subject article)
>> (gnus-summary-save-in-pipe pipe)
>> ))
>> (put 'gnus-summary-save-in-pipe :decode decode)
>> (put 'gnus-summary-save-in-pipe :headers headers)))
>> (gnus-summary-expand-window))
> Maybe all but two or three lines of the above should be made into a
> function gnus-summary-save-in-pipe-raw? Or maybe the existing function
> gnus-summary-save-in-pipe should take an optional "raw" argument to get
> this behaviour? Forcing the caller to jump through the above hoops
> seems excessive...
That's good. Thanks. I've added to `gnus-summary-save-in-pipe'
the optional 2nd argument `raw' meaning:
,----
| Non-nil value for RAW overrides `:decode' and `:headers' properties
| and the raw article including all headers will be piped.
`----
So, now Gabor's function can be simplified into:
[-- Attachment #2: Type: application/emacs-lisp, Size: 284 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: gnus-summary-save-in-pipe does not pipe raw article
2008-07-25 0:15 ` Katsumi Yamaoka
@ 2008-07-25 8:25 ` Lloyd Zusman
2008-07-25 9:16 ` Katsumi Yamaoka
0 siblings, 1 reply; 14+ messages in thread
From: Lloyd Zusman @ 2008-07-25 8:25 UTC (permalink / raw)
To: ding
Katsumi Yamaoka <yamaoka@jpl.org> writes:
>>>>>> Dan Christensen wrote:
>> Katsumi Yamaoka <yamaoka@jpl.org> writes:
>
>>> (let* ((pipe (format "cat | /path/to/cmd"))
>>>
>>> (decode (get 'gnus-summary-save-in-pipe :decode))
>>> (headers (get 'gnus-summary-save-in-pipe :headers))
>>> (gnus-save-all-headers t)
>>>
>>> )
>>> (put 'gnus-summary-save-in-pipe :decode nil)
>>> (put 'gnus-summary-save-in-pipe :headers nil)
>>> (unwind-protect
>>> (save-excursion
>>> (dolist (article (gnus-summary-work-articles n))
>>> (gnus-summary-goto-subject article)
>>> (gnus-summary-save-in-pipe pipe)
>>> ))
>>> (put 'gnus-summary-save-in-pipe :decode decode)
>>> (put 'gnus-summary-save-in-pipe :headers headers)))
>>> (gnus-summary-expand-window))
>
>> Maybe all but two or three lines of the above should be made into a
>> function gnus-summary-save-in-pipe-raw? Or maybe the existing function
>> gnus-summary-save-in-pipe should take an optional "raw" argument to get
>> this behaviour? Forcing the caller to jump through the above hoops
>> seems excessive...
>
> That's good. Thanks. I've added to `gnus-summary-save-in-pipe'
> the optional 2nd argument `raw' meaning:
>
> ,----
> | Non-nil value for RAW overrides `:decode' and `:headers' properties
> | and the raw article including all headers will be piped.
> `----
>
> So, now Gabor's function can be simplified into:
>
> (defun gzp-pipe-spam (&optional n)
> (interactive "P")
> (let ((pipe (format "cat | /path/to/cmd")))
........................^^^^^^^
<not-to-be-taken-too-seriously>
Just a (very!) small nit. Why is `cat' being used here? Am I missing
something? This looks like another recipient of the UUOC Award ("Useless
Use of Cat"):
http://en.wikipedia.org/wiki/Cat_(Unix)#cat_and_UUOC
And for that matter, the `format' function is equally superfluous,
as the following is equivalent and faster:
(let ((pipe "/path/to/cmd"))
</not-to-be-taken-too-seriously>
> (save-excursion
> (dolist (article (gnus-summary-work-articles n))
> (gnus-summary-goto-subject article)
> (gnus-summary-save-in-pipe pipe t))))
> (gnus-summary-expand-window))
--
Lloyd Zusman
ljz@asfast.com
God bless you.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: gnus-summary-save-in-pipe does not pipe raw article
2008-07-25 8:25 ` Lloyd Zusman
@ 2008-07-25 9:16 ` Katsumi Yamaoka
2008-07-26 11:23 ` Gabor Z. Papp
0 siblings, 1 reply; 14+ messages in thread
From: Katsumi Yamaoka @ 2008-07-25 9:16 UTC (permalink / raw)
To: ding
>>>>> Lloyd Zusman wrote:
>> (defun gzp-pipe-spam (&optional n)
>> (interactive "P")
>> (let ((pipe (format "cat | /path/to/cmd")))
> ........................^^^^^^^
<not-to-be-taken-too-seriously>
> Just a (very!) small nit. Why is `cat' being used here? Am I missing
> something? This looks like another recipient of the UUOC Award ("Useless
> Use of Cat"):
> http://en.wikipedia.org/wiki/Cat_(Unix)#cat_and_UUOC
> And for that matter, the `format' function is equally superfluous,
> as the following is equivalent and faster:
> (let ((pipe "/path/to/cmd"))
I guessed that's just an example. I believe what he actually
uses is more complicated and `format' and `let*' are really
needed there. ;-)
</not-to-be-taken-too-seriously>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: gnus-summary-save-in-pipe does not pipe raw article
2008-07-25 9:16 ` Katsumi Yamaoka
@ 2008-07-26 11:23 ` Gabor Z. Papp
0 siblings, 0 replies; 14+ messages in thread
From: Gabor Z. Papp @ 2008-07-26 11:23 UTC (permalink / raw)
To: ding; +Cc: Katsumi Yamaoka
* Katsumi Yamaoka <yamaoka@jpl.org>:
| > (let ((pipe "/path/to/cmd"))
| I guessed that's just an example. I believe what he actually
| uses is more complicated and `format' and `let*' are really
| needed there. ;-)
No, I'm not speaking lisp, and got this part of code from the Net(TM).
Thanks Katsumi and Lloyd for the suggestions, I have corrected the
code, getting rid of let*, format and cat.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2008-07-26 11:23 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-19 8:28 gnus-summary-save-in-pipe does not pipe raw article Graham Murray
2008-07-19 11:19 ` Katsumi Yamaoka
2008-07-22 23:11 ` Katsumi Yamaoka
2008-07-23 7:22 ` Gabor Z. Papp
2008-07-23 7:54 ` Katsumi Yamaoka
2008-07-23 7:59 ` Gabor Z. Papp
2008-07-24 15:08 ` Dan Christensen
2008-07-25 0:15 ` Katsumi Yamaoka
2008-07-25 8:25 ` Lloyd Zusman
2008-07-25 9:16 ` Katsumi Yamaoka
2008-07-26 11:23 ` Gabor Z. Papp
2008-07-23 20:17 ` Reiner Steib
2008-07-23 20:24 ` Graham Murray
2008-07-24 15:29 ` Ted Zlatanov
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).