all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Piped insert-file?
@ 2002-11-14 16:49 ginak
  2002-11-14 16:52 ` Barry Margolin
  2002-11-14 17:26 ` Friedrich Dominicus
  0 siblings, 2 replies; 6+ messages in thread
From: ginak @ 2002-11-14 16:49 UTC (permalink / raw)




Is there a way (without creating a temporary file) to insert into a
buffer the results of running a file's contents through a Unix pipe?

Thanks,

g

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

* Re: Piped insert-file?
  2002-11-14 16:49 Piped insert-file? ginak
@ 2002-11-14 16:52 ` Barry Margolin
  2002-11-14 18:10   ` ginak
  2002-11-14 17:26 ` Friedrich Dominicus
  1 sibling, 1 reply; 6+ messages in thread
From: Barry Margolin @ 2002-11-14 16:52 UTC (permalink / raw)


In article <ar0k64$q5o$1@reader1.panix.com>,
ginak  <gina02122000@yahoo.com> wrote:
>Is there a way (without creating a temporary file) to insert into a
>buffer the results of running a file's contents through a Unix pipe?

C-u M-! and C-u M-| will execute commands and insert the output in the
current buffer.  The second command pipes the current region to the command
and replaces it with the output.


-- 
Barry Margolin, barmar@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

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

* Re: Piped insert-file?
  2002-11-14 16:49 Piped insert-file? ginak
  2002-11-14 16:52 ` Barry Margolin
@ 2002-11-14 17:26 ` Friedrich Dominicus
  1 sibling, 0 replies; 6+ messages in thread
From: Friedrich Dominicus @ 2002-11-14 17:26 UTC (permalink / raw)


ginak <gina02122000@yahoo.com> writes:

> Is there a way (without creating a temporary file) to insert into a
> buffer the results of running a file's contents through a Unix pipe?

Some more words would be helpful. you can run
M-x shell-command-on-region 

line-1
line-2
line-4
line-10
line-5

Making it in a region and run sort on it yields
line-1
line-10
line-2
line-4
line-5

other option you may have run
(shell-command-to-string "ls -l /tmp/*")
C-u C-x C-e insert that stuff at point here

If you want it interactive you have to write a wrapper for it and than
there is with-output-to-temp-buffer which may of some use too

Regards
Friedrich

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

* Re: Piped insert-file?
  2002-11-14 16:52 ` Barry Margolin
@ 2002-11-14 18:10   ` ginak
  2002-11-14 19:10     ` Stefan Monnier <foo@acm.com>
  2002-11-14 19:13     ` Barry Margolin
  0 siblings, 2 replies; 6+ messages in thread
From: ginak @ 2002-11-14 18:10 UTC (permalink / raw)


In <hxQA9.12$Xq1.1204@paloalto-snr1.gtei.net> Barry Margolin <barmar@genuity.net> writes:

>In article <ar0k64$q5o$1@reader1.panix.com>,
>ginak  <gina02122000@yahoo.com> wrote:
>>Is there a way (without creating a temporary file) to insert into a
>>buffer the results of running a file's contents through a Unix pipe?

>C-u M-! and C-u M-| will execute commands and insert the output in the
>current buffer.

Thanks.  That's great to know.

When I tried C-u M-! with "grep foo foo_file", I got the desired text
inserted in the buffer, but preceded by the lines:

stty: standard input: Inappropriate ioctl for device
stty: standard input: Inappropriate ioctl for device

I don't know how to interpret these lines.

g

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

* Re: Piped insert-file?
  2002-11-14 18:10   ` ginak
@ 2002-11-14 19:10     ` Stefan Monnier <foo@acm.com>
  2002-11-14 19:13     ` Barry Margolin
  1 sibling, 0 replies; 6+ messages in thread
From: Stefan Monnier <foo@acm.com> @ 2002-11-14 19:10 UTC (permalink / raw)


>>>>> "ginak" == ginak  <gina02122000@yahoo.com> writes:
> stty: standard input: Inappropriate ioctl for device
> stty: standard input: Inappropriate ioctl for device

These are typically messages due to your running `stty' from your
shell startup scripts even if the shell is not run interactively.

The elisp code for the M-! function has the following to say about it:

	    ;; We do not use -f for csh; we will not support broken use of
	    ;; .cshrcs.  Even the BSD csh manual says to use
	    ;; "if ($?prompt) exit" before things which are not useful
	    ;; non-interactively.  Besides, if someone wants their other
	    ;; aliases for shell commands then they can still have them.


-- Stefan

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

* Re: Piped insert-file?
  2002-11-14 18:10   ` ginak
  2002-11-14 19:10     ` Stefan Monnier <foo@acm.com>
@ 2002-11-14 19:13     ` Barry Margolin
  1 sibling, 0 replies; 6+ messages in thread
From: Barry Margolin @ 2002-11-14 19:13 UTC (permalink / raw)


In article <ar0ov7$s2l$1@reader1.panix.com>,
ginak  <gina02122000@yahoo.com> wrote:
>When I tried C-u M-! with "grep foo foo_file", I got the desired text
>inserted in the buffer, but preceded by the lines:
>
>stty: standard input: Inappropriate ioctl for device
>stty: standard input: Inappropriate ioctl for device
>
>I don't know how to interpret these lines.

Your shell startup file (.cshrc, .bashrc, .kshrc, whichever is appropriate
for your shell) contains stty commands, which should only be done in
interactive shells (in fact, probably only in the initial login shell, so
they should probably be in .login or .profile).

-- 
Barry Margolin, barmar@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

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

end of thread, other threads:[~2002-11-14 19:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-14 16:49 Piped insert-file? ginak
2002-11-14 16:52 ` Barry Margolin
2002-11-14 18:10   ` ginak
2002-11-14 19:10     ` Stefan Monnier <foo@acm.com>
2002-11-14 19:13     ` Barry Margolin
2002-11-14 17:26 ` Friedrich Dominicus

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.