From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/67181 Path: news.gmane.org!not-for-mail From: Lloyd Zusman Newsgroups: gmane.emacs.gnus.general Subject: Re: gnus-summary-save-in-pipe does not pipe raw article Date: Fri, 25 Jul 2008 04:25:10 -0400 Organization: Take a hippopotamus to lunch today. Message-ID: <87hcae9xqx.fsf@asfast.com> References: <87mykes2g8.fsf@newton.gmurray.org.uk> <87d4l3miah.fsf@uwo.ca> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1216974399 18719 80.91.229.12 (25 Jul 2008 08:26:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Jul 2008 08:26:39 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M15640@lists.math.uh.edu Fri Jul 25 10:27:28 2008 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.50) id 1KMIe7-0003qz-Ag for ding-account@gmane.org; Fri, 25 Jul 2008 10:27:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1KMIcH-0001DZ-BS; Fri, 25 Jul 2008 03:25:33 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1KMIcE-0001DB-I7 for ding@lists.math.uh.edu; Fri, 25 Jul 2008 03:25:30 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.67) (envelope-from ) id 1KMIc8-0006Yb-JO for ding@lists.math.uh.edu; Fri, 25 Jul 2008 03:25:30 -0500 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1KMIcR-0002Wv-00 for ; Fri, 25 Jul 2008 10:25:43 +0200 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KMIc4-0005Sg-2e for ding@gnus.org; Fri, 25 Jul 2008 08:25:20 +0000 Original-Received: from 209.59.210.144 ([209.59.210.144]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 25 Jul 2008 08:25:20 +0000 Original-Received: from ljz by 209.59.210.144 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 25 Jul 2008 08:25:20 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 70 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 209.59.210.144 User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:MjyRpg750372NWt90FaawlOIEKY= Cache-Post-Path: purity-of-essence.net!unknown@ljz.net X-Cache: nntpcache 3.0.2 (see http://www.nntpcache.com/) X-Spam-Score: -1.1 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:67181 Archived-At: Katsumi Yamaoka writes: >>>>>> Dan Christensen wrote: >> Katsumi Yamaoka 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"))) ........................^^^^^^^ 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")) > (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.