From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Richard M. Stallman" Newsgroups: gmane.emacs.devel Subject: Re: po file charset via auto-coding-functions Date: Tue, 25 Oct 2005 11:59:18 -0400 Message-ID: References: <87zmp399ue.fsf@zip.com.au> <87ll0ma3ow.fsf@zip.com.au> <87fyqu9ung.fsf@zip.com.au> Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: sea.gmane.org 1130258024 2104 80.91.229.2 (25 Oct 2005 16:33:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 25 Oct 2005 16:33:44 +0000 (UTC) Cc: user42@zip.com.au, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 25 18:33:37 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EURj6-0001W0-AG for ged-emacs-devel@m.gmane.org; Tue, 25 Oct 2005 18:32:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EURj5-0004Jl-Lq for ged-emacs-devel@m.gmane.org; Tue, 25 Oct 2005 12:32:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EURCq-0001PW-Qz for emacs-devel@gnu.org; Tue, 25 Oct 2005 11:59:20 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EURCq-0001Oz-7U for emacs-devel@gnu.org; Tue, 25 Oct 2005 11:59:20 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EURCp-0001Oq-S3 for emacs-devel@gnu.org; Tue, 25 Oct 2005 11:59:19 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EURCq-0003ep-7G for emacs-devel@gnu.org; Tue, 25 Oct 2005 11:59:20 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1EURCo-0000K6-S6; Tue, 25 Oct 2005 11:59:18 -0400 Original-To: Kenichi Handa In-reply-to: (message from Kenichi Handa on Mon, 24 Oct 2005 11:05:06 +0900) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:44831 Archived-At: The current problem is that on extracting vi.po in tar-mode, a function registered in file-coding-system-alist is called with a filename "vi.po". So, that function can't check the contents of that file because it can't read the contents by insert-file-contents. I see. 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. I think such a change is safe because, at least, all current entries in file-coding-system-alist checks only the tail of a filename. If this means passing "/home/handa/x.tgz!vi.po" as the second argument to find-operation-coding-system, I think it is not clean. That argument is documented to be _the same_ in meaning as the argument you would pass to OPERATION, but this string isn't the same, isn't a valid argument to insert-file-contents. If we want to modify the calling convention of find-operation-coding-system, we should do it in a cleaner way: by binding a global variable. That variable would be nil, normally. I think the variable's value should be a buffer name. If the variable is non-nil, it means "the file's contents are already in this buffer". And all the functions that handle find-operation-coding-system for various file types should check the variable. I think that is a fairly clean solution. What do you think?