emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tar-mode


From: Kenichi Handa
Subject: Re: tar-mode
Date: Wed, 26 Feb 2003 20:53:56 +0900 (JST)
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)

In article <address@hidden>, "Stefan Monnier" <monnier+gnu/address@hidden> 
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
address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]