all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* stdin/stdout
@ 2008-07-22 12:49 Jack O'Connor
  2008-07-23 11:03 ` stdin/stdout Tim X
  0 siblings, 1 reply; 3+ messages in thread
From: Jack O'Connor @ 2008-07-22 12:49 UTC (permalink / raw
  To: help-gnu-emacs

Is there any way in Emacs to read standard input into a buffer or to
send the contents of a buffer to the standard output (particularly
both with editing in between)? I'm interested in being able to do
things like the following:

decrypt file.crypt | emacs | encrypt > file2.crypt
                     ---or perhaps---
curl some-website-with-code.com | emacs | python
                    ---or even just---
emacs < file.txt > edited_file.txt

Thanks very much for your help.

- Jack O'Connor


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

* Re: stdin/stdout
  2008-07-22 12:49 stdin/stdout Jack O'Connor
@ 2008-07-23 11:03 ` Tim X
  2008-07-25 10:53   ` stdin/stdout Dan Davison
  0 siblings, 1 reply; 3+ messages in thread
From: Tim X @ 2008-07-23 11:03 UTC (permalink / raw
  To: help-gnu-emacs

"Jack O'Connor" <oconnor663@gmail.com> writes:

> Is there any way in Emacs to read standard input into a buffer or to
> send the contents of a buffer to the standard output (particularly
> both with editing in between)? I'm interested in being able to do
> things like the following:
>
> decrypt file.crypt | emacs | encrypt > file2.crypt
>                      ---or perhaps---
> curl some-website-with-code.com | emacs | python
>                     ---or even just---
> emacs < file.txt > edited_file.txt
>
> Thanks very much for your help.
>
> - Jack O'Connor

Not really answering your question, but ....

For each of the examples you have, emacs has a solution. 

For encryption/decryption, there is crypt++ that will allow you to
encrypt files and decrypt them from within emacs. Note also that emacs
23 comes with support for gnupg built-in.

For your curl example, there is an interface for wget (wget.el) and I
think also curl.

Your last example, I don't really get. Emacs does have a 'script' mode
that will allow you to process files and apply emacs functions to them
(assuming your example is about non-interactive editing/processing of
files. 

The point to note is that emacs is a pretty heavy duty piece of software
that can be a bit slow to start/stop. While batch mode and script mode
does mean you can do stuff non0interactively, in most cases, there are
far beter tools. Most long-term emacs users learn to adjust to a
paradigm where emacs is left running for long periods of time. I usually
have my emacs running for weeks at a time - using things like the emacs
client and server mode, you can leave emacs running and configure your
system to just opo up a frame when an application needs input - for
example, when you run crontab -e etc. 

tim

-- 
tcross (at) rapttech dot com dot au


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

* Re: stdin/stdout
  2008-07-23 11:03 ` stdin/stdout Tim X
@ 2008-07-25 10:53   ` Dan Davison
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Davison @ 2008-07-25 10:53 UTC (permalink / raw
  To: Tim X; +Cc: help-gnu-emacs

On Wed, Jul 23, 2008 at 09:03:23PM +1000, Tim X wrote:
> "Jack O'Connor" <oconnor663@gmail.com> writes:
> 
> > Is there any way in Emacs to read standard input into a buffer or to
> > send the contents of a buffer to the standard output (particularly
> > both with editing in between)? I'm interested in being able to do
> > things like the following:
> >
> > decrypt file.crypt | emacs | encrypt > file2.crypt
> >                      ---or perhaps---
> > curl some-website-with-code.com | emacs | python
> >                     ---or even just---
> > emacs < file.txt > edited_file.txt
> >
> > Thanks very much for your help.
> >
> > - Jack O'Connor
> 
> Not really answering your question, but ....
> 
> For each of the examples you have, emacs has a solution. 
> 
> For encryption/decryption, there is crypt++ that will allow you to
> encrypt files and decrypt them from within emacs. Note also that emacs
> 23 comes with support for gnupg built-in.
> 
> For your curl example, there is an interface for wget (wget.el) and I
> think also curl.
> 
> Your last example, I don't really get. Emacs does have a 'script' mode
> that will allow you to process files and apply emacs functions to them
> (assuming your example is about non-interactive editing/processing of
> files. 
> 
> The point to note is that emacs is a pretty heavy duty piece of software
> that can be a bit slow to start/stop. 

I don't think that's fair to emacs. On my laptop, emacs -nw -Q is
instantaneous. Then you can use the -l flag to specify any elisp file
you want to evaluate in addition to the core stuff.

> While batch mode and script mode does mean you can do stuff
> non0interactively, in most cases, there are far beter tools. Most
> long-term emacs users learn to adjust to a

I was looking forward to seeing the responses to this thread, as I
have no experience of non-interactive use of emacs, but there must be
situations where it'd be the right choice. For example writing a
script to deal with emacs org-mode files. You don't want to do it all
in $other_scripting_language when all that effort's been put into the
existing elisp code. More generally, presumably people with genuine
expertise in elisp find it an attractive approach to modifying some
text file in a script, i.e. attractive compared to perl/sed/whatever?

DAn

> paradigm where emacs is left running for long periods of time. I usually
> have my emacs running for weeks at a time - using things like the emacs
> client and server mode, you can leave emacs running and configure your
> system to just opo up a frame when an application needs input - for
> example, when you run crontab -e etc. 
> 
> tim
> 
> -- 
> tcross (at) rapttech dot com dot au




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

end of thread, other threads:[~2008-07-25 10:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-22 12:49 stdin/stdout Jack O'Connor
2008-07-23 11:03 ` stdin/stdout Tim X
2008-07-25 10:53   ` stdin/stdout Dan Davison

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.