From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Karl Eichwalder Newsgroups: gmane.emacs.devel Subject: Re: PO files and Emacs Date: Mon, 11 Mar 2002 18:54:38 +0100 Sender: emacs-devel-admin@gnu.org Message-ID: References: Reply-To: Karl Eichwalder NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1015869657 537 80.91.224.249 (11 Mar 2002 18:00:57 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 11 Mar 2002 18:00:57 +0000 (UTC) Cc: 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 16kU6T-00008Y-00 for ; Mon, 11 Mar 2002 19:00:57 +0100 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 16kU8H-0003WO-00 for ; Mon, 11 Mar 2002 19:02:50 +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 16kU6F-0005mN-00; Mon, 11 Mar 2002 13:00:43 -0500 Original-Received: from dns.franken.de ([193.175.24.33] helo=elvis.franken.de) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16kU3t-0005co-00; Mon, 11 Mar 2002 12:58:17 -0500 Original-Received: from uucp by elvis.franken.de with local-rmail (Exim 3.22 #1) id 16kU3m-00027T-00; Mon, 11 Mar 2002 18:58:10 +0100 Original-Received: by tux.gnu.franken.de (Postfix, from userid 270) id D1701A4453; Mon, 11 Mar 2002 17:54:39 +0000 (UTC) Original-To: Eli Zaretskii In-Reply-To: (Eli Zaretskii's message of "Mon, 11 Mar 2002 13:03:32 +0200 (IST)") Original-Lines: 39 User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2.50 (i686-pc-linux-gnu) 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:1856 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:1856 --=-=-= 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 This used to work with Emacs 20. As I said: I don't understand `po-find-file-coding-system'; maybe it's worth to re-write it from scratch. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=po.el Content-Transfer-Encoding: 8bit ;;; po.el --- basic support of PO translation files -*- coding: latin-1; -*- ;; Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. ;; Authors: François Pinard , ;; Greg McGary , ;; Bruno Haible . ;; This file is part of GNU Emacs. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. (defconst po-content-type-charset-alist '(; Note: Emacs 21 doesn't support all encodings, thus the missing entries. (ASCII . undecided) (ANSI_X3.4-1968 . undecided) (US-ASCII . undecided) (ISO-8859-1 . iso-8859-1) (ISO_8859-1 . iso-8859-1) (ISO-8859-2 . iso-8859-2) (ISO_8859-2 . iso-8859-2) (ISO-8859-3 . iso-8859-3) (ISO_8859-3 . iso-8859-3) (ISO-8859-4 . iso-8859-4) (ISO_8859-4 . iso-8859-4) (ISO-8859-5 . iso-8859-5) (ISO_8859-5 . iso-8859-5) ;(ISO-8859-6 . ??) ;(ISO_8859-6 . ??) (ISO-8859-7 . iso-8859-7) (ISO_8859-7 . iso-8859-7) (ISO-8859-8 . iso-8859-8) (ISO_8859-8 . iso-8859-8) (ISO-8859-9 . iso-8859-9) (ISO_8859-9 . iso-8859-9) ;(ISO-8859-13 . ??) ;(ISO_8859-13 . ??) ;(ISO-8859-15 . ??) ;(ISO_8859-15 . ??) (KOI8-R . koi8-r) ;(KOI8-U . ??) ;(CP850 . ??) ;(CP866 . ??) ;(CP874 . ??) ;(CP932 . ??) ;(CP949 . ??) ;(CP950 . ??) ;(CP1250 . ??) ;(CP1251 . ??) ;(CP1252 . ??) ;(CP1253 . ??) ;(CP1254 . ??) ;(CP1255 . ??) ;(CP1256 . ??) ;(CP1257 . ??) ;(GB2312 . euc-cn) ;(EUC-JP . euc-jp) ;(EUC-KR . euc-kr) ;(EUC-TW . ??) ;(BIG5 . big5) ;(BIG5HKSCS . ??) ;(GBK . ??) ;(GB18030 . ??) ;(SJIS . shift_jis) ;(JOHAB . ??) ;(TIS-620 . th-tis620) ;(VISCII . viscii) (UTF-8 . utf-8) ) "How to convert a GNU libc/libiconv canonical charset name as seen in Content-Type into a Mule coding system.") ;;;###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) (with-temp-buffer (let ((coding-system-for-read 'no-conversion)) (insert-file-contents (nth 1 arg-list) nil 0 4096) (if (re-search-forward "^\"Content-Type: text/plain;[ \t]*charset=\\([^\\]+\\)" nil t) (let* ((charset (buffer-substring (match-beginning 1) (match-end 1))) (charset-upper (intern (upcase charset))) (charset-lower (intern (downcase charset)))) (list (or (cdr (assq charset-upper po-content-type-charset-alist)) (if (memq charset-lower (coding-system-list)) charset-lower 'no-conversion)))) '(no-conversion)))))) (modify-coding-system-alist 'file "\\.po\\'\\|\\.po\\." 'po-find-file-coding-system) ;; po.el ends here --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=file-4.1.5.hu.po Content-Transfer-Encoding: base64 IyBIdW5nYXJpYW4gdHJhbnNsYXRpb24gb2YgR05VIGZpbGV1dGlscwojIENvcHlyaWdodCAoQykg MjAwMiBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb24sIEluYy4KIyBFbWVzZSBLb3bhY3MgPGVtZXNl QGdub21lLmh1PiwgMjAwMgojCm1zZ2lkICIiCm1zZ3N0ciAiIgoiUHJvamVjdC1JZC1WZXJzaW9u OiBHTlUgZmlsZXV0aWxzIDQuMS41XG4iCiJQT1QtQ3JlYXRpb24tRGF0ZTogMjAwMi0wMS0wNSAy MjoxMyswMTAwXG4iCiJQTy1SZXZpc2lvbi1EYXRlOiAyMDAyLTAzLTAzIDIxOjAxKzAxMDBcbiIK Ikxhc3QtVHJhbnNsYXRvcjogRW1lc2UgS292YWNzIDxlbWVzZUBnbm9tZS5odT5cbiIKIkxhbmd1 YWdlLVRlYW06IEh1bmdhcmlhbiA8aHVAbGkub3JnPlxuIgoiTUlNRS1WZXJzaW9uOiAxLjBcbiIK IkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD1pc28tODg1OS0yXG4iCiJDb250ZW50 LVRyYW5zZmVyLUVuY29kaW5nOiA4Yml0XG4iCgojOiBsaWIvYXJnbWF0Y2guYzoxNjEKIywgYy1m b3JtYXQKbXNnaWQgImludmFsaWQgYXJndW1lbnQgJXMgZm9yICVzIgptc2dzdHIgIkEgYCVzJyBh cmd1bWVudHVtIOlydulueXRlbGVuIGVoaGV6OiAlcyIKCiM6IGxpYi9hcmdtYXRjaC5jOjE2Mgoj LCBjLWZvcm1hdAptc2dpZCAiYW1iaWd1b3VzIGFyZ3VtZW50ICVzIGZvciAlcyIKbXNnc3RyICJg JXMnIGFyZ3VtZW50dW0gbmVtIGVneelydGVsbfugYSBr9nZldGtlevVo9no6IGAlcyciCgojLiBX ZSB0cnkgdG8gcHV0IHN5bm9ueW1zIG9uIHRoZSBzYW1lIGxpbmUuICBUaGUgYXNzdW1wdGlvbiBp cyB0aGF0CiMuIHN5bm9ueW1zIGZvbGxvdyBlYWNoIG90aGVyCiM6IGxpYi9hcmdtYXRjaC5jOjE4 MQptc2dpZCAiVmFsaWQgYXJndW1lbnRzIGFyZToiCm1zZ3N0ciAiQXog6XJ26W55ZXMgYXJndW1l bnR1bW9rIGEga/Z2ZXRrZXr1azoiCgojOiBsaWIvY2xvc2VvdXQuYzoxMDcKbXNnaWQgIndyaXRl IGVycm9yIgptc2dzdHIgIu1y4XNpIGhpYmEiCgo= --=-=-= -- ke@suse.de (work) / keichwa@gmx.net (home): | http://www.suse.de/~ke/ | ,__o Free Translation Project: | _-\_<, http://www.iro.umontreal.ca/contrib/po/HTML/ | (*)/'(*) --=-=-=-- _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel