From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#8122: 23.2.94; (prefer-coding-system 'utf-8) changes indentation behavior for emacsclient Date: Sat, 26 Feb 2011 18:40:32 +0200 Message-ID: <83y652oikf.fsf@gnu.org> References: <20110226143116.GB6286@srevilak.net> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1298740149 26843 80.91.229.12 (26 Feb 2011 17:09:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 26 Feb 2011 17:09:09 +0000 (UTC) Cc: 8122@debbugs.gnu.org To: Steve Revilak , Kenichi Handa Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 26 18:09:03 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PtNdc-0002RP-Ee for geb-bug-gnu-emacs@m.gmane.org; Sat, 26 Feb 2011 18:09:00 +0100 Original-Received: from localhost ([127.0.0.1]:42883 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PtNdb-0002xg-DP for geb-bug-gnu-emacs@m.gmane.org; Sat, 26 Feb 2011 12:08:59 -0500 Original-Received: from [140.186.70.92] (port=40441 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PtNbW-00029w-Ct for bug-gnu-emacs@gnu.org; Sat, 26 Feb 2011 12:06:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PtNbR-0000J6-Ep for bug-gnu-emacs@gnu.org; Sat, 26 Feb 2011 12:06:46 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59690) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PtNbR-0000Iz-Bs for bug-gnu-emacs@gnu.org; Sat, 26 Feb 2011 12:06:45 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PtNCY-00082e-4k; Sat, 26 Feb 2011 11:41:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 26 Feb 2011 16:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8122 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8122-submit@debbugs.gnu.org id=B8122.129873843730882 (code B ref 8122); Sat, 26 Feb 2011 16:41:02 +0000 Original-Received: (at 8122) by debbugs.gnu.org; 26 Feb 2011 16:40:37 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PtNC9-000823-9r for submit@debbugs.gnu.org; Sat, 26 Feb 2011 11:40:37 -0500 Original-Received: from mtaout20.012.net.il ([80.179.55.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PtNC6-00081q-Oo for 8122@debbugs.gnu.org; Sat, 26 Feb 2011 11:40:36 -0500 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LH800800GVWWT00@a-mtaout20.012.net.il> for 8122@debbugs.gnu.org; Sat, 26 Feb 2011 18:40:27 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.124.53.157]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LH8008ULGZEG040@a-mtaout20.012.net.il>; Sat, 26 Feb 2011 18:40:27 +0200 (IST) In-reply-to: <20110226143116.GB6286@srevilak.net> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sat, 26 Feb 2011 11:41:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:44393 Archived-At: > Date: Sat, 26 Feb 2011 09:31:16 -0500 > From: Steve Revilak > Cc: > > (1) Start emacs in daemon mode, as follows: > env TMPDIR=$HOME/tmp emacs -Q --eval "(prefer-coding-system 'utf-8)" --daemon > > (2) Use emacsclient to connect to the server started in step (1), > editing a new text file. > rm -f a.txt > env TMPDIR=$HOME/tmp emacsclient a.txt > > (3) In the buffer for a.txt, type the lines that appear below. Do not > press return after typing "ccc" > > aaa > bbb > > ccc > > (4) With point at the end of line "ccc", press RETURN. If "ccc" > appeared in line 5 of the buffer, then the cursor will appear at > line 6, column 2. > > Expected behavior: after pressing RETURN, the cursor should have > appeared line line 6, column 0. I found the reason for this: when keyboard-coding-system is utf-8, typing RET is decoded as C-j. If you start the Emacs daemon like this: emacs -Q --eval "(prefer-coding-system 'utf-8-unix)" --daemon ^^^^^^^^^^ the problem goes away. This happens because, unlike set-keyboard-coding-system, which adds "-unix" to its argument, we don't do the same when we set up default-keyboard-coding-system. (This problem is quite old; I guess no one used default-keyboard-coding-system until the change I made in terminal.c exposed this bug.) I propose the following change to fix this: --- lisp/international/mule-cmds.el~0 2011-01-08 12:45:14.000000000 -0500 +++ lisp/international/mule-cmds.el 2011-02-26 11:32:22.483284753 -0500 @@ -368,7 +368,8 @@ (coding-system-get coding-system 'ascii-compatible-p))) (setq default-file-name-coding-system coding-system))) (setq default-terminal-coding-system coding-system) - (setq default-keyboard-coding-system coding-system) + (setq default-keyboard-coding-system + (coding-system-change-eol-conversion coding-system 'unix)) ;; Preserve eol-type from existing default-process-coding-systems. ;; On non-unix-like systems in particular, these may have been set ;; carefully by the user, or by the startup code, to deal with the