From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: Cyrillic vs UTF-8 Date: Mon, 19 May 2003 11:31:50 +0900 (JST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200305190231.LAA02082@etlken.m17n.org> References: <1858-Fri25Apr2003194023+0300-eliz@elta.co.il> <200304282149.h3SLnxSU002624@rum.cs.yale.edu> <200305190040.JAA01942@etlken.m17n.org> <200305190052.h4J0qUfa017404@rum.cs.yale.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: main.gmane.org 1053311489 17041 80.91.224.249 (19 May 2003 02:31:29 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 19 May 2003 02:31:29 +0000 (UTC) Cc: jas@extundo.com Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon May 19 04:31:22 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19HaQs-0004Q9-00 for ; Mon, 19 May 2003 04:31:22 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19HaaT-0007Pd-00 for ; Mon, 19 May 2003 04:41:17 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19HaS9-0007ne-02 for emacs-devel@quimby.gnus.org; Sun, 18 May 2003 22:32:41 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19HaRe-0006y2-00 for emacs-devel@gnu.org; Sun, 18 May 2003 22:32:10 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19HaRZ-0006gV-00 for emacs-devel@gnu.org; Sun, 18 May 2003 22:32:06 -0400 Original-Received: from tsukuba.m17n.org ([192.47.44.130]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19HaRR-00061X-00 for emacs-devel@gnu.org; Sun, 18 May 2003 22:31:58 -0400 Original-Received: from fs.m17n.org (fs.m17n.org [192.47.44.2])h4J2Vpu03205; Mon, 19 May 2003 11:31:51 +0900 (JST) (envelope-from handa@m17n.org) Original-Received: from etlken.m17n.org (etlken.m17n.org [192.47.44.125]) h4J2Vo904320; Mon, 19 May 2003 11:31:50 +0900 (JST) Original-Received: (from handa@localhost) by etlken.m17n.org (8.8.8+Sun/3.7W-2001040620) id LAA02082; Mon, 19 May 2003 11:31:50 +0900 (JST) Original-To: monnier+gnu/emacs@rum.cs.yale.edu In-reply-to: <200305190052.h4J0qUfa017404@rum.cs.yale.edu> (monnier+gnu/emacs@rum.cs.yale.edu) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.2.92 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) Original-cc: eliz@elta.co.il Original-cc: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:13985 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13985 In article <200305190052.h4J0qUfa017404@rum.cs.yale.edu>, "Stefan Monnier" writes: >> I'd like to avoid introducing a new mechanism to control a >> coding system as far as possible. And, the second >> preference-order (used for saving) works only in this case: >> >> (1) The buffer file coding system can't encode the current >> buffer, and >> (2) The most preferred coding system can encode the current >> buffer, and >> (3) A user doesn't want to use the most preferred one. >> >> Isn't it a very rare case? > Maybe it is. In my situation, I'd like utf-8 to be at the top > of the preferences w.r.t decoding because it virtually never > guesses wrong. > OTOH, I'm still using a mostly-latin-1 environment, so I'd > still rather avoid utf-8 when I can. I.e. latin-1 should be at > the top of my preferences w.r.t encoding. In that case, I think the source of the problem is that the command prefer-coding-system doesn't satisfy this request of yours: Prefer utf-8 only in automatic detection on reading a file, not for the other situations. (defun prefer-coding-system (coding-system) "Add CODING-SYSTEM at the front of the priority list for automatic detection. This also sets the following coding systems: o coding system of a newly created buffer o default coding system for subprocess I/O This also sets the following values: o default value used as `file-name-coding-system' for converting file names. o default value for the command `set-terminal-coding-system' (not on MSDOS) o default value for the command `set-keyboard-coding-system' How about changing it to skip "This also ..." parts if called with a prefix argument? Then, on writing, if buffer-file-coding-system is not locally bound, default-buffer-file-coding-system is tried automatically. And, for the case that buffer-file-coding-system is locally bound differently from default-buffer-file-coding-system, but it can'd encode the current buffer, we can change select-safe-coding-system to try default-buffer-file-coding-system before trying the most preferred coding system. That way, I think we can satisfy your request completely. --- Ken'ichi HANDA handa@m17n.org