From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: What's your favourite *under_publicized* editing feature of Emacs? Date: Fri, 18 Feb 2011 11:09:33 +1100 Organization: Unlimited download news at news.astraweb.com Message-ID: <87lj1e6w5e.fsf@rapttech.com.au> References: <482fb2ba-e50f-4102-bfe7-3a78613d970f@m27g2000prj.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1297989660 9843 80.91.229.12 (18 Feb 2011 00:41:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 18 Feb 2011 00:41:00 +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 Feb 18 01:40:56 2011 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.69) (envelope-from ) id 1PqEOz-0006Z1-KG for geh-help-gnu-emacs@m.gmane.org; Fri, 18 Feb 2011 01:40:53 +0100 Original-Received: from localhost ([127.0.0.1]:34072 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PqEOy-0004ri-RD for geh-help-gnu-emacs@m.gmane.org; Thu, 17 Feb 2011 19:40:52 -0500 Original-Path: usenet.stanford.edu!news.glorb.com!news2.glorb.com!news.glorb.com!news-xfer.nntp.sonic.net!news.astraweb.com!border6.newsrouter.astraweb.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:/eOCtDKpkLWHAIkcRqFRtRhzkkI= Original-Lines: 50 Original-NNTP-Posting-Host: 8c8d5787.news.astraweb.com Original-X-Trace: DXC=25; kRRVm_n@; VG4V^?kWCCAkl5c@XgkNLecOf?\LV]FKgMleREkQDM Original-Xref: usenet.stanford.edu gnu.emacs.help:185041 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:79201 Archived-At: Giorgos Keramidas writes: > On Sat, 29 Jan 2011 09:02:14 -0600, Perry Smith wrote: >> This thread is beginning to drift a bit... but something I wish I had >> was a way to view a file without loading all of it. I look at hugh >> trace files and I have to get out of emacs and start a shell so I can >> use more / less. >> >> The shame of it all! ;-) >> >> I don't know of such a critter. If there is one, that would be super >> cool. > > If there was some way to lazy-load files, I'd be happy too. > Many years ago I needed to load large trace files from Oracle. I just looked and seem to have lost the code I used, but you may find the approach useful. This was done on a Linux box and uses standard Linux utilities. The basic approach I used was to write some elisp functions that created a temporary directory, applied the 'split' program to the input file, split the input file into manageable chunks (split will/can add a prefix/suffix to sequence/number the chunks) and put them into the temp directory and then open the first chunk in a buffer. I could then run dired, which would list al the chunks and open any one of those chunks for viewing further chunks of the file. I also used a defadvice around view-file which automated the process if the file suffix was .trc. I always planned to clean it up and add a few extra features (such as not splitting the file if it had already been split before etc), but then my job changed a bit and I no longer had the need to view such large trace files. It worked quite well. Maybe not as clean as jus having a 'lazy file read', but did mean I could view these large files from within emacs and setting things up was largely automated. I do vaguely remember having to play with split a bit before I got things just right. Later I added a command that would use sed to replace strings in really large files, which was useful when migrating large oracle databases and you wanted to modify the paths in order to refresh a dev version with data form a production system. Again, can't find that code as we now do things differently and I've not kept it. Tim -- tcross (at) rapttech dot com dot au