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: Richard M. Stallman
Subject: Re: po file charset via auto-coding-functions
Date: Fri, 11 Nov 2005 02:42:20 -0500

    >     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.

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?

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.

                  ;; We need to mimic the parts of insert-file-contents
                  ;; which determine the coding-system and decode the text.
                  (let ((coding
                         (or coding-system-for-read
                             (and set-auto-coding-function
                                  (save-excursion
                                    (funcall set-auto-coding-function
                                             name (- (point-max) (point)))))
                             (car (find-operation-coding-system
                                   'insert-file-contents name t))))

But since that isn't a true valid file name, it needs a comment
to explain why calling find-operation-coding-system in a way 
contrary to its rules nonetheless gives correct results.
And maybe we need to document this also in the place that defines
find-operation-coding-system and the functions it calls, so that people
will not change them in a way that breaks this code.





reply via email to

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