From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Giorgos Keramidas Newsgroups: gmane.emacs.help Subject: Re: How to pipe text or load a file directly into mail-mode? Date: Thu, 04 May 2006 23:49:23 +0300 Organization: SunSITE.dk - Supporting Open source Message-ID: <86slnpbjn0.fsf@gothmog.pc> References: <86vesme7tk.fsf@gothmog.pc> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1146778882 22274 80.91.229.2 (4 May 2006 21:41:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 4 May 2006 21:41:22 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu May 04 23:41:19 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FblZL-0008FX-Gq for geh-help-gnu-emacs@m.gmane.org; Thu, 04 May 2006 23:41:07 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FblZK-0006Ih-Uf for geh-help-gnu-emacs@m.gmane.org; Thu, 04 May 2006 17:41:06 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!news.net.uni-c.dk!dotsrc.org!news.dotsrc.org!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (berkeley-unix) Cancel-Lock: sha1:45l9ZLgDkWkyQrf4dfyDPpQjDb8= Original-Lines: 46 Original-NNTP-Posting-Host: 62.103.39.226 Original-X-Trace: news.sunsite.dk DXC=oEmfk5R@YGT[eoV[BRG`:]YSB=nbEKnk[]l:<0?f@AASL^MjW2:ak; I7eU]W6nT6d; jI9i_9fam; :EeBIR Original-X-Complaints-To: staff@sunsite.dk Original-Xref: shelby.stanford.edu gnu.emacs.help:139212 comp.emacs:92106 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:34835 Archived-At: On Thu, 4 May 2006 20:46:32 +0100, Adam Funk wrote: > On 2006-05-04, Ralf Fassel wrote: >> Well, via '-nw' you tell emacs to use the tty as input, but the tty is >> already used by perl. Do you really need '-nw'? If you really need >> -nw, you could try something along the lines of >> >> system("emacs -nw $tempfile -f mail-mode > >> I.e. use shell input redirection to the controlling tty. I have no >> idea how robust that would be, and would rather get rid of the '-nw'. > > Maybe it would help if I explained what I'm *really* trying to do. I > get usenet access by opening an xterm, logging into a server and > running slrn. I really like like slrn except that I can't customize > forwarding articles by e-mail the way I'd like, so I want to bind a > slrn key to a command that just pipes the current article to an > external program. > > That external program I want to be a Perl script that puts some stuff > at the beginning of the article, prefaces it with my custom headers, > and then opens it in Emacs in mail-mode (so I can use my ~/.mailrc > aliases and all the other great stuff that Emacs does). Maybe I need > to store the article in a /tmp file then load it into the Perl > program, instead of piping it into the program's STDIN. You don't need Perl for that, I guess. It's fairly easy to write a function in Elisp that does all you need and call it at Emacs startup, i.e. a _very_ simplistic one could be: | (defun slrn-setup-post (&optional filename) | "Load a file and set things up for posting it as a `mail' | message through Emacs." | (interactive) | (if filename | (insert-filename)) | (beginning-of-buffer) | (insert-string "From: foo@bar.example.net\n\n") | (mail-mode)) Then you can set up slrn to use as its `$EDITOR' your Emacs wrapper script, which would run: emacs filename -f slrn-setup-post No need for Perl if you have the full Elisp languaeg at your hands :)