From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mathias Dahl Newsgroups: gmane.emacs.help Subject: Re: help editing huge files in emacs Date: Wed, 15 Mar 2006 17:16:27 +0100 Message-ID: References: <87hd605jlx.fsf-monnier+gnu.emacs.help@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1142439659 24606 80.91.229.2 (15 Mar 2006 16:20:59 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 15 Mar 2006 16:20:59 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 15 17:20:59 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FJYji-0008Q1-Mb for geh-help-gnu-emacs@m.gmane.org; Wed, 15 Mar 2006 17:20:39 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FJYjg-0003Uf-R4 for geh-help-gnu-emacs@m.gmane.org; Wed, 15 Mar 2006 11:20:32 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news4.google.com!news2.volia.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 81 Original-X-Trace: individual.net V2AFs3HNFlldU76ZLsAbYgs9xg8HOf6LuLaO3S1ttWNBBDM3Gk User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (windows-nt) Cancel-Lock: sha1:eAft83AawIjm7JzvGzi6uA5PlIg= Original-Xref: shelby.stanford.edu gnu.emacs.help:138184 Original-To: help-gnu-emacs@gnu.org 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:33798 Archived-At: Stefan Monnier writes: > `insert-file-contents' takes two integer parameters BEG and END to allow > getting only part of a file into a buffer. The corresponding `write-region' > takes an APPEND parameter which can be an integer indicating at which > position in the file the text should be written. > > With those two elisp functions, you can read&write parts of files, so you > can do what you want. But it requires some coding on top of that to make it > really usable (probably some kind of special major or minor mode, or maybe > a file-name-handler) and I don't know of any package that does that. Interesting idea! But it would only work in the situations where you wanted the edited text (the text you inserted into emacs and edited there) to be written at position X in the original file and could not be used (easily) to overwrite the data that was originally extracted with `insert-file-contents'. Right? The above might be confusing, so I'll give an example. Say I have this really huge file :) -- huge file -- line 1 line 2 line 3 line 4 line 5 line 6 -- end -- We extract line 3 to 5 into Emacs: -- emacs buffer -- line 3 line 4 line 5 -- end -- We might change some stuff and add stuff: -- emacs buffer -- line 3 line 4 is changed line 4.1 was added line 5 -- end -- The result, if I use `write-region' and the `append' with the original start position (X) as argument, would be: -- huge file -- line 1 line 2 line 3 line 4 is changed line 4.1 was added line 5 line 3 line 4 line 5 line 6 -- end -- It would be cool if it could instead become: -- huge file -- line 1 line 2 line 3 line 4 is changed line 4.1 was added line 5 line 6 -- end -- Possible? Note: I have no need of doing this but I find it interesting nevertheless. /Mathias