Gnus development mailing list
 help / color / mirror / Atom feed
From: Lloyd Zusman <ljz@asfast.com>
To: ding@gnus.org
Subject: Re: gnus-summary-save-in-pipe does not pipe raw article
Date: Fri, 25 Jul 2008 04:25:10 -0400	[thread overview]
Message-ID: <87hcae9xqx.fsf@asfast.com> (raw)
In-Reply-To: <b4mbq0m4y4u.fsf@jpl.org>

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.




  reply	other threads:[~2008-07-25  8:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-19  8:28 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87hcae9xqx.fsf@asfast.com \
    --to=ljz@asfast.com \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).