emacs-devel
[Top][All Lists]
Advanced

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

Re: po file charset via auto-coding-functions


From: Kenichi Handa
Subject: Re: po file charset via auto-coding-functions
Date: Fri, 18 Nov 2005 22:08:34 +0900
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/22.0.50 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI)

Sorry for the late response on this matter.  I was just back
from Hanoi; Vietnamese foods were very good.  :-)

In article <address@hidden>, "Richard M. Stallman" <address@hidden> writes:

>>      As a matter of fact I think passing
>>      "/home/handa/x.tgz!vi.po" is more correct: if we assume that
>>      a suitable file-name-handler is installed it's perfectly correct.

>>  But I don't think we should install such a handler, because it would
>>  be an incompatible change in file name syntax.

>     Then maybe another syntax should be used, but currently that's the syntax
>     chosen: this is the value used for buffer-file-name.

> Does that file name get used for anything except to appear in the C_x
> C-b listing and be helpful for the user?  I think it does not.

I don't know exactly which command uses it, but it is used
by any operations that call get-file-buffer.

> The previous message said:

>       The correct operation in a handler for insert-file-contents
>       will be to find a buffer pretending to visit the file, and
>       insert that buffer contents.  And, for that, we have to give
>       buffer-file-name (e.g. /home/handa/x.tgz!vi.po") not the
>       filename itself (e.g. vi.po) to
>       find-operation-coding-system.

> Can you explain the context of this?  Where is insert-file-contents
> being called from, and with what file name argument?
> How does it relate to this issue?

Here the "handler" means a function registered in
file-coding-system-alist (it's po-find-file-coding-system in
the current case).

> If it is simply a matter to call find-operation-coding-system here,
> in tar-extract, then I agree it is ok to pass buffer-file-name.

Yes, that is what the change I propsed for an archived file
does.

And, for a compressed file, I proposed this change.

*** jka-compr.el        08 Aug 2005 10:13:24 +0900      1.87
--- jka-compr.el        24 Oct 2005 11:38:27 +0900      
***************
*** 500,509 ****
             (delete-file local-copy)))
  
          (unless notfound
            (decode-coding-inserted-region
             (point) (+ (point) size)
!            (jka-compr-byte-compiler-base-file-name file)
!            visit beg end replace))
  
          (and
           visit
--- 500,513 ----
             (delete-file local-copy)))
  
          (unless notfound
+           (let ((buffer-file-name
+                  (concat file "!"
+                          (jka-compr-byte-compiler-base-file-name file))))
+ 
            (decode-coding-inserted-region
             (point) (+ (point) size)
!            buffer-file-name
!            visit beg end replace)))
  
          (and
           visit

As you see, this binds buffer-file-name temporarily to
something like /home/handa/temp.po.gz!/home/handa/temp.po so
that find-operation-coding-system (called in
decode-coding-inserted-region) can surely find
po-find-file-coding-system to be called, and it can surely
find the current buffer by get-file-buffer.

Do you agree with this change too (of course provided that
more comments are added)?

---
Kenichi Handa
address@hidden




reply via email to

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