emacs-devel
[Top][All Lists]
Advanced

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

Re: EOL conversion of files in .tar archives


From: Kenichi Handa
Subject: Re: EOL conversion of files in .tar archives
Date: Thu, 24 May 2007 17:15:23 +0900
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/23.0.0 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

In article <address@hidden>, Eli Zaretskii <address@hidden> writes:

> > For the trunk, how about trying the fix of my version
> > (i.e. the change to find-buffer-file-type-coding-system)?

> I'm uneasy with that change, because there are other places that use a
> cons cell as the second argument to find-operation-coding-system, and
> I'm not sure what you propose is good for them.  For example, mule.el
> defines a utility function decode-coding-inserted-region that also
> uses a cons cell.  (This utility function is currently used in
> jka-compr.el, pcvs.el and url-handlers.el.)  Both it and its users are
> sufficiently complex that I couldn't easily decide whether the change
> you suggest will DTRT for them.  Can you help me understand that?

The docstring of find-operation-coding-system has this
paragraph.

  If operation is `insert-file-contents', the argument corresponding to
  TARGET may be a cons (FILENAME . BUFFER).  In that case, FILENAME is a
  file name to look up, and BUFFER is a buffer that contains the file's
  contents (not yet decoded).  If `file-coding-system-alist' specifies a
  function to call for FILENAME, that function should examine the
  contents of BUFFER instead of reading the file.

So, find-buffer-file-type-coding-system should handle
(FILENAME . BUFFER) as described above.  That function has
this code:

                 ;; For any other existing file, decide based on contents.
                 ((file-exists-p target)
                  (setq undecided t))

If file-exists-p is used to check whether or not there
exists contents that can decide EOL type, isn't it TRT to
return undecided in (FILENAME . BUFFER) case.

> > By the way, for emacs-unicode-2, I have a plan of new
> > functions insert-region-contents and write-region-to-buffer
> > that do the similar thing as insert-file-contents and
> > write-region but gets/puts the contents from/to a region of
> > a specified buffer.  They encapsulte various weird tasks for
> > decoding and encoding, and can easility be used both by
> > tar-mode and arc-mode.

> That's good to hear.  I hope that insert-file-contents and
> write-region will be implemented on top of these new primitives, or at
> least that they all will use the same subroutines to encode/decode
> text and set the buffer's file coding system, because currently
> tar-mode and arc-mode mimic those parts of insert-file-contents (in
> two subtly different ways).

I have not yet decided how to implement them.  As soon as I
find a good way, I'll write the plan here to hear more
opinions.

---
Kenichi Handa
address@hidden




reply via email to

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