From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Andreas Schwab Newsgroups: gmane.emacs.devel Subject: Re: PO files and Emacs Date: Mon, 11 Mar 2002 20:29:35 +0100 Sender: emacs-devel-admin@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1015877392 3571 80.91.224.249 (11 Mar 2002 20:09:52 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 11 Mar 2002 20:09:52 +0000 (UTC) Cc: Eli Zaretskii , Richard Stallman , emacs-devel@gnu.org, sanvila@unex.es, neil@darlow.co.uk, haible@ilog.fr, handa@etl.go.jp Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16kW7E-0000vU-00 for ; Mon, 11 Mar 2002 21:09:52 +0100 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 16kW95-0004X0-00 for ; Mon, 11 Mar 2002 21:11:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16kVV0-000507-00; Mon, 11 Mar 2002 14:30:22 -0500 Original-Received: from ns.suse.de ([213.95.15.193] helo=Cantor.suse.de) by fencepost.gnu.org with smtp (Exim 3.34 #1 (Debian)) id 16kVUV-0004ub-00; Mon, 11 Mar 2002 14:29:52 -0500 Original-Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id AE08D1ED24; Mon, 11 Mar 2002 20:29:50 +0100 (MET) X-Authentication-Warning: sykes.suse.de: schwab set sender to schwab@suse.de using -f Original-To: Karl Eichwalder X-Yow: Do I have a lifestyle yet? In-Reply-To: (Karl Eichwalder's message of "Mon, 11 Mar 2002 18:54:38 +0100") Original-Lines: 54 User-Agent: Gnus/5.090005 (Oort Gnus v0.05) Emacs/21.2.50 (ia64-suse-linux) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.5 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:1864 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:1864 Karl Eichwalder writes: |> Eli Zaretskii writes: |> |> > Sure. Karl, where do I get the version you suggest to include? |> |> It was attached to my first mail. I'll attach it here again as po.el, |> plus this check: |> |> (file-exists-p (car (cdr arg-list))) |> |> I also attach file-4.1.5.hu.po; loading this Hungarian file will set |> the coding system to iso-8859-2/latin-2: |> |> emacs --no-site-file -q -l po.el file-4.1.5.hu.po |> |> Now you can edit and save the file. Starting with a non-existing file |> emacs will produce an error message when you will try to save it: |> |> emacs --no-site-file -q -l po.el not-there.hu.po |> |> Enter: |> |> # a comment line |> C-x C-s |> error--> and: Wrong type argument: stringp, 1 That's because your function is called with the same arguments as find-operation-coding-system, which itself gets the same arguments as the I/O primitives. Those are, for file I/O, insert-file-contents and write-region. The latter has the signature (write-region START END FILENAME &optional APPEND VISIT LOCKNAME MUSTBENEW) which means that (car (cdr arg-list)) == START. You should just move the second test before the first one. |> ;;;###autoload |> (defun po-find-file-coding-system (arg-list) |> "Return a Mule (DECODING . ENCODING) pair, according to PO file charset. |> Called through file-coding-system-alist, before the file is visited for real." |> (and (file-exists-p (car (cdr arg-list))) |> (eq (car arg-list) 'insert-file-contents) (and (eq (car arg-list) 'insert-file-contents) (file-exists-p (car (cdr arg-list))) Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel