From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: view/edit large files (was: map-file-lines) Date: Fri, 06 Feb 2009 12:42:59 -0600 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <86zlgzqudo.fsf_-_@lifelogs.com> References: <86fxiuw6u7.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1233945777 20639 80.91.229.12 (6 Feb 2009 18:42:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Feb 2009 18:42:57 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 06 19:44:12 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LVVgE-0000UG-0P for ged-emacs-devel@m.gmane.org; Fri, 06 Feb 2009 19:43:58 +0100 Original-Received: from localhost ([127.0.0.1]:38415 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LVVev-0002E4-08 for ged-emacs-devel@m.gmane.org; Fri, 06 Feb 2009 13:42:37 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LVVdn-00017v-3V for emacs-devel@gnu.org; Fri, 06 Feb 2009 13:41:27 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LVVdk-00015C-IT for emacs-devel@gnu.org; Fri, 06 Feb 2009 13:41:26 -0500 Original-Received: from [199.232.76.173] (port=53785 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LVVdk-000152-DK for emacs-devel@gnu.org; Fri, 06 Feb 2009 13:41:24 -0500 Original-Received: from main.gmane.org ([80.91.229.2]:57641 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LVVdj-0001xb-Us for emacs-devel@gnu.org; Fri, 06 Feb 2009 13:41:24 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LVVdg-0002mq-SL for emacs-devel@gnu.org; Fri, 06 Feb 2009 18:41:20 +0000 Original-Received: from 38.98.147.130 ([38.98.147.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 06 Feb 2009 18:41:20 +0000 Original-Received: from tzz by 38.98.147.130 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 06 Feb 2009 18:41:20 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 46 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 38.98.147.130 X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:Ae0YAN0jtPRc/p67cPgtyuItFHQ= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:108831 Archived-At: On Thu, 05 Feb 2009 00:40:40 -0500 Richard M Stallman wrote: RMS> The main point of my message is the UI proposal. You're right that RMS> it's good to use byte offsets. I had not thought about that, but it RMS> could be done by specifying the -b option for grep. RMS> I proposed a specific UI for specifying which part of the file to RMS> edit, one I think will be convenient. Could you please explain, with code or text, what using your UI would look like? I looked over your suggestions and I still think we have the same idea, just expressed differently. You do seem to want `grep' instead of dynamic offsets, but see my comments later. Here's the "window"[1] API I'm suggesting, as a detailed list of TODO items: 1) a buffer-local set of offset variables that indicate the beginning and the end of the current window into the file. 2) override all write-file functions to write the buffer at the starting offset. I don't think there's a write-file-contents analogous to insert-file-contents 3) override all insert-file* functions to respect the offsets as well 3) disable insertion, always in overwrite mode for better performance (maybe allow insert at end of file...). Force save when the "window" is moved. 4) "window" management functions: set/get-window-offset, set/get-window-length, etc. These operate on the (1) buffer-local variables. As you can see, it requires no grep calls to pre-scan the file, and should be consistent with the existing Emacs code. Pre-scanning a large file with grep can be very expensive, and it's inaccurate if the large file is growing (e.g. a log file). Thanks to anyone with suggestions... Ted [1] I still can't think of a better term than "window." large-file-window is too verbose. boffset? byte-offset? virtual-buffer?