all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* editing output in shell mode
@ 2009-01-09 21:12 Samuel Wales
  2009-01-09 21:32 ` Peter Dyballa
  2009-01-09 21:45 ` tyler
  0 siblings, 2 replies; 4+ messages in thread
From: Samuel Wales @ 2009-01-09 21:12 UTC (permalink / raw)
  To: help-gnu-emacs

Let's say you do something in shell mode that produces a lot of
output.  Normally, you'd use less(1), but that is not possible in
shell mode.

Ideally, you'd view the output in an emacs buffer, perhaps in text
mode, so that you can edit it and navigate it.

Is there a way to pipe this output to, say, emacsclient?

Or -- more sophisticatedly -- is there another solution that uses
shell mode, e.g. to grab the output once it detects that it is a lot
of output, and redirect it into a text mode buffer?

Obviously if it's an infinite amount of output, it should do what less
does and not use up all memory.

Google was not my friend.  :)

Thanks.

-- 
For personal gain, myalgic encephalomyelitis denialists are knowingly
causing further suffering and death by grossly corrupting science.  Do
you care about the world?
http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm




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

* Re: editing output in shell mode
  2009-01-09 21:12 editing output in shell mode Samuel Wales
@ 2009-01-09 21:32 ` Peter Dyballa
  2009-01-09 21:45 ` tyler
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Dyballa @ 2009-01-09 21:32 UTC (permalink / raw)
  To: Samuel Wales; +Cc: help-gnu-emacs


Am 09.01.2009 um 22:12 schrieb Samuel Wales:

> Is there a way to pipe this output to, say, emacsclient?


Emacsclient is not a streaming client – anyway, why would you like to  
do that? If it has been too much output, you can undo and then repeat  
the command, now sending stdout and/or stderr to files, which you can  
open afterwards. Or run your rich command as shell-command, then save  
or rename *Shell Command Output*. You can also abuse compile to run  
the shell command with output – and then you can save the resulting  
*compilation* buffer (don't forget to remove the first one, two lines!).

--
Greetings

   Pete

Behold the warranty ... the bold print giveth and the fine print  
taketh away.






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

* Re: editing output in shell mode
       [not found] <mailman.4437.1231535539.26697.help-gnu-emacs@gnu.org>
@ 2009-01-09 21:39 ` David Kastrup
  0 siblings, 0 replies; 4+ messages in thread
From: David Kastrup @ 2009-01-09 21:39 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 832 bytes --]

"Samuel Wales" <samologist@gmail.com> writes:

> Let's say you do something in shell mode that produces a lot of
> output.  Normally, you'd use less(1), but that is not possible in
> shell mode.
>
> Ideally, you'd view the output in an emacs buffer, perhaps in text
> mode, so that you can edit it and navigate it.
>
> Is there a way to pipe this output to, say, emacsclient?
>
> Or -- more sophisticatedly -- is there another solution that uses
> shell mode, e.g. to grab the output once it detects that it is a lot
> of output, and redirect it into a text mode buffer?
>
> Obviously if it's an infinite amount of output, it should do what less
> does and not use up all memory.
>
> Google was not my friend.  :)
>
> Thanks.

I have something I call emacs-pager, but it will probably not work with
infinite output satisfactorily.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: emacs-pager --]
[-- Type: text/x-sh, Size: 264 bytes --]

#!/bin/sh
TMP=`mktemp -t emacs-pager.XXXXXX`
trap "rm $TMP* 2>/dev/null" 0
echo '-*- mode: view; auto-revert-interval: 1; mode: auto-revert-tail; view-exit-action: kill-buffer -*-' >"$TMP"
exec 5<&0 <&-
cat "$@" <&5 >>"$TMP" &
eval "${VISUAL:-${EDITOR}}" '"$TMP"'

[-- Attachment #3: Type: text/plain, Size: 52 bytes --]



-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: editing output in shell mode
  2009-01-09 21:12 editing output in shell mode Samuel Wales
  2009-01-09 21:32 ` Peter Dyballa
@ 2009-01-09 21:45 ` tyler
  1 sibling, 0 replies; 4+ messages in thread
From: tyler @ 2009-01-09 21:45 UTC (permalink / raw)
  To: help-gnu-emacs

"Samuel Wales" <samologist@gmail.com> writes:

> Let's say you do something in shell mode that produces a lot of
> output. Normally, you'd use less(1), but that is not possible in shell
> mode.
>
> Ideally, you'd view the output in an emacs buffer, perhaps in text
> mode, so that you can edit it and navigate it.
>
> Is there a way to pipe this output to, say, emacsclient?
>

When I'm in shell mode, I just leave long output right there. For ex.,
you can issue 'cat README.txt' to dump the contents of a big file, then
C-c C-p to put you at the top of the output, and navigate through as
per usual.

You can delete the output when you're done a few different ways. You can
get to the following prompt with C-c C-n, from where C-c C-o will delete
the previous output (usually). Sometimes the contents of the file will
screw this up, in which case C-c C-p to back up to the previous prompt,
then use M-h C-w to select and kill the 'cat' command and the
associated output.

As an alternative, you could ignore the fact that you're in shell mode,
and issue the command using M-!, which will dump the output into a new
buffer named *Shell Command Output*, which might be more what you're
after.

HTH,

Tyler





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

end of thread, other threads:[~2009-01-09 21:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-09 21:12 editing output in shell mode Samuel Wales
2009-01-09 21:32 ` Peter Dyballa
2009-01-09 21:45 ` tyler
     [not found] <mailman.4437.1231535539.26697.help-gnu-emacs@gnu.org>
2009-01-09 21:39 ` David Kastrup

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.