From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Oliver Scholz Newsgroups: gmane.emacs.help Subject: Re: Problem with coding system and emacsclient Date: Sat, 21 Aug 2004 12:55:42 +0200 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1093086060 19912 80.91.224.253 (21 Aug 2004 11:01:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 21 Aug 2004 11:01:00 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Aug 21 13:00:52 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ByTcB-0006qN-00 for ; Sat, 21 Aug 2004 13:00:51 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1ByTgW-0003iQ-TA for geh-help-gnu-emacs@m.gmane.org; Sat, 21 Aug 2004 07:05:20 -0400 Original-Newsgroups: gnu.emacs.help X-Attribution: os X-Face: "HgH2sgK|bfH$; PiOJI6|qUCf.ve<51_Od(%ynHr?=>znn#~#oS>",F%B8&\vus),2AsPYb -n>PgddtGEn}s7kH?7kH{P_~vu?]OvVN^qD(L)>G^gDCl(U9n{:d>'DkilN!_K"eNzjrtI4Ya6; Td% IZGMbJ{lawG+'J>QXPZD&TwWU@^~A}f^zAb[Ru;CT(UA]c& User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (windows-nt) Cancel-Lock: sha1:PyXoQ9UqpQQ9OIY1jrhWzCJKtJA= Original-NNTP-Posting-Host: 82.82.141.195 Original-X-Trace: 21 Aug 2004 12:55:43 +0200, 82.82.141.195 Original-Lines: 96 Original-X-Complaints-To: abuse@arcor-ip.de Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!newsmi-eu.news.garr.it!NewsITBone-GARR!feed.news.tiscali.de!newsfeed.arcor-ip.de!news.arcor-ip.de!82.82.141.195 Original-Xref: shelby.stanford.edu gnu.emacs.help:124852 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:20201 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:20201 Unfortunately I am right now doomed to work on the operating system that dare not say its name; I can't make any test with emacsclient. So I am probably not the right person to answer your question right now. However, since nobody else has replied so far, I might as well try my best. Juraj Kubelka writes: > Hi! > > I have problem with opening files with emacsclient in different > coding. > > My default coding system is: > > ------- M-x describe-coding-system RET RET > Coding system for saving this buffer: > 2 -- iso-8859-2 (alias of iso-latin-2) [...] > Priority order for recognizing coding systems when reading files: > 1. iso-8859-2 (alias of iso-latin-2) > 2. iso-latin-1 (alias: iso-8859-1 latin-1) > 3. iso-2022-jp (alias: junet) > 4. iso-2022-7bit > 5. iso-2022-7bit-lock (alias: iso-2022-int-1) > 6. iso-2022-8bit-ss2 > 7. emacs-mule > 8. raw-text > 9. japanese-shift-jis (alias: shift_jis sjis) > 10. chinese-big5 (alias: big5 cn-big5) > 11. no-conversion (alias: binary) > 12. mule-utf-8 (alias: utf-8) > I can open file with coding system cp1250: > > C-x RET c cp1250-unix RET C-x C-f file_coding.txt > > Everything is correct. Now I save and close file. > > I can open file again with same sequence above. But when I want open > file with emacsclient I cannot use prefix "C-x RET c cp1250-unix RET" > and file is opened in "Unibyte raw-coding". [...] > Characters are strange of course. I can use "C-x RET f cp1250-unix > RET" and file is now opened in "Unibyte cp1250-unix". When the character encoding scheme has not been properly detected on visiting the file, then it's too late to do `C-x RET f'. Recent CVS Emacs provides the command `C-x RET r' (`revert-buffer-with-coding-system') which, erm, reverts the buffer with a different coding system. [...] > Do you have any solution for it? How open file in different coding with > emacsclient (I know coding of file)? It would be nice, if emacsclient had some sort of --encoding option to specify the encoding on the command line (but maybe it does? Have you checked?). Failing that I can think of two ways to get what you want: The best way is probably to put a coding system cookie into the file: At the beginning: -*- coding: windows-1250 -*- At the end: Local Variables: coding: windows-1250 End: See (info "(emacs)Recognize Coding"). Another way would be to frob the coding system priorities: ;; Move windows-1250 (aka cp1250) to front. (prefer-coding-system 'windows-1250) ;; Move Latin-2 to front again, because that's what is actually ;; prefered. (prefer-coding-system 'iso-latin-2) Oliver -- 4 Fructidor an 212 de la Révolution Liberté, Egalité, Fraternité!