From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.help Subject: Re: editing output in shell mode Date: Fri, 09 Jan 2009 22:39:25 +0100 Organization: Organization?!? Message-ID: <851vvcnoqa.fsf@lola.goethe.zz> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1231537253 14522 80.91.229.12 (9 Jan 2009 21:40:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 9 Jan 2009 21:40:53 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 09 22:42:05 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LLP7E-0001np-DW for geh-help-gnu-emacs@m.gmane.org; Fri, 09 Jan 2009 22:42:04 +0100 Original-Received: from localhost ([127.0.0.1]:39209 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LLP5y-0005r0-Ij for geh-help-gnu-emacs@m.gmane.org; Fri, 09 Jan 2009 16:40:46 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!kanaga.switch.ch!switch.ch!news.belwue.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:JYk6+Wybu235wmEKwa1pTengj1o= Original-Lines: 48 Original-NNTP-Posting-Date: 09 Jan 2009 22:39:25 CET Original-NNTP-Posting-Host: 06942f75.newsspool2.arcor-online.net Original-X-Trace: DXC=B0]AG?HBZaIFJ3]dH>I?oEA9EHlD; 3YcB4Fo<]lROoRA^YC2XCjHcbITXc:WRo:dlICV`H8_`hhQD^9QSCVg3dOFOIC5DBZVJ9K:j1RT]Gm8oLn_l?aL?_19I Original-X-Complaints-To: usenet-abuse@arcor.de Original-Xref: news.stanford.edu gnu.emacs.help:165890 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:61224 Archived-At: --=-=-= "Samuel Wales" 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. --=-=-= Content-Type: text/x-sh Content-Disposition: inline; filename=emacs-pager #!/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"' --=-=-= -- David Kastrup, Kriemhildstr. 15, 44793 Bochum --=-=-=--