From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: tar-mode Date: Wed, 26 Feb 2003 20:53:56 +0900 (JST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200302261153.UAA29803@etlken.m17n.org> References: <200302250634.PAA27478@etlken.m17n.org> <200302260058.JAA28973@etlken.m17n.org> <200302260211.h1Q2BJl08373@rum.cs.yale.edu> <200302260234.LAA29082@etlken.m17n.org> <200302260252.h1Q2qIK08490@rum.cs.yale.edu> <200302260532.OAA29294@etlken.m17n.org> <200302260550.h1Q5oSc08967@rum.cs.yale.edu> <200302260749.QAA29494@etlken.m17n.org> <200302260812.h1Q8CcO10018@rum.cs.yale.edu> <200302260838.RAA29571@etlken.m17n.org> <200302260853.h1Q8rRQ10164@rum.cs.yale.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: main.gmane.org 1046262371 19945 80.91.224.249 (26 Feb 2003 12:26:11 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 26 Feb 2003 12:26:11 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18o0dW-0005BY-00 for ; Wed, 26 Feb 2003 13:26:10 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18o0tw-0006vk-00 for ; Wed, 26 Feb 2003 13:43:08 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18o0Xk-0008Kg-02 for emacs-devel@quimby.gnus.org; Wed, 26 Feb 2003 07:20:13 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18o0Ww-0008G0-00 for emacs-devel@gnu.org; Wed, 26 Feb 2003 07:19:22 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18o09R-0004oY-00 for emacs-devel@gnu.org; Wed, 26 Feb 2003 06:55:08 -0500 Original-Received: from tsukuba.m17n.org ([192.47.44.130]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18o08T-0004WU-00 for emacs-devel@gnu.org; Wed, 26 Feb 2003 06:54:05 -0500 Original-Received: from fs.m17n.org (fs.m17n.org [192.47.44.2])h1QBruk17880; Wed, 26 Feb 2003 20:53:56 +0900 (JST) (envelope-from handa@m17n.org) Original-Received: from etlken.m17n.org (etlken.m17n.org [192.47.44.125]) h1QBruR08625; Wed, 26 Feb 2003 20:53:56 +0900 (JST) Original-Received: (from handa@localhost) by etlken.m17n.org (8.8.8+Sun/3.7W-2001040620) id UAA29803; Wed, 26 Feb 2003 20:53:56 +0900 (JST) Original-To: monnier+gnu/emacs@rum.cs.yale.edu In-reply-to: <200302260853.h1Q8rRQ10164@rum.cs.yale.edu> (monnier+gnu/emacs@rum.cs.yale.edu) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.2.92 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:11978 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:11978 In article <200302260853.h1Q8rRQ10164@rum.cs.yale.edu>, "Stefan Monnier" writes: >> I still don't understand the necessity of the helper buffer. >> When tar-mode is called, usually the current buffer is >> unibyte, so there's no need of moving the contents to >> another buffer. Instead, it creates a buffer for table of >> contents, setup that buffer, then switch to that buffer. > How are you going to "switch to that buffer" ? > Can you really expect that none of the callers have done some > kind of save-current-buffer ? > Hmm...looking at the code, it does seem like there really isn't > any save-current-buffer interfering. Can we rely on that ? > Should we document it ? I have not yet considered this method in deep. > It's rather unusual for a major-mode function to switch the > current buffer. Yes. I agree that it's a fragile operation. But, it seems that it is the only way to avoid moving or copying 24MB memory. Ah... I think I understand what you mean by "swap" and "helper buffer". What you are suggesting is something like this, isn't it? In the function tar-mode, ... (setq helper-buffer (generate-new-buffer ...)) (swap-buffer-contents helper-buffer) ;; Now the current buffer is empty. (tar-mode-setup-table-of-contents helper-buffer) (add-hook 'write-file-functions 'tar-mode-write-helper-buffer) ... --- Ken'ichi HANDA handa@m17n.org