From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: Re: carriage-return no longer works quite right in shell-mode Date: Sun, 10 Feb 2008 21:55:51 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1202698582 4756 80.91.229.12 (11 Feb 2008 02:56:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 Feb 2008 02:56:22 +0000 (UTC) Cc: emacs-pretest-bug@gnu.org, Chris Moore , handa@m17n.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 11 03:56:45 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JOOqa-0007fG-Lo for ged-emacs-devel@m.gmane.org; Mon, 11 Feb 2008 03:56:44 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JOOq7-0002El-9p for ged-emacs-devel@m.gmane.org; Sun, 10 Feb 2008 21:56:15 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JOOq2-0002CM-Tb for emacs-devel@gnu.org; Sun, 10 Feb 2008 21:56:10 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JOOq0-00027c-0y for emacs-devel@gnu.org; Sun, 10 Feb 2008 21:56:10 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JOOpz-00027L-LA for emacs-devel@gnu.org; Sun, 10 Feb 2008 21:56:07 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JOOpz-0004Fb-6J for emacs-devel@gnu.org; Sun, 10 Feb 2008 21:56:07 -0500 Original-Received: from mx10.gnu.org ([199.232.76.166]) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1JOOpy-0006xd-Tq for emacs-pretest-bug@gnu.org; Sun, 10 Feb 2008 21:56:06 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1JOOpv-0004F1-RQ for emacs-pretest-bug@gnu.org; Sun, 10 Feb 2008 21:56:06 -0500 Original-Received: from 76-10-146-187.dsl.teksavvy.com ([76.10.146.187] helo=ceviche.home) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JOOpv-0004Eh-CU; Sun, 10 Feb 2008 21:56:03 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id E38E4B402C; Sun, 10 Feb 2008 21:55:51 -0500 (EST) In-Reply-To: (Richard Stallman's message of "Sun, 10 Feb 2008 19:17:51 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-Greylist: delayed 2014 seconds by postgrey-1.27 at monty-python; Sun, 10 Feb 2008 21:56:03 EST X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:88713 gmane.emacs.pretest.bugs:21016 Archived-At: > I recently updated Emacs from the CVS trunk and one of the programs > I run inside a shell-mode buffer has stopped formatting its > output correctly. How old was your previous Emacs? > It uses carriage return characters to re-write the same line over and > over, and leaves the cursor at the beginning of the line. Here's a > simplified example that no longer works in Emacs: > #include > main() { > int i; > for (i = 0; i < 10; i++) { > printf(" count: %d\r", i); > fflush(stdout); > sleep(1); > } > printf("\n"); > } > Instead of re-writing the same part of the buffer over and over, I see: > count: 0 count: 1 count: 2 > in the buffer - the carriage return isn't returning the carriage like > it used to. Hmm... I see that indeed. > I notice that apt-get does still work - that leaves the cursor at the > end of the line, which I guess is the important difference. Yes. Funnily enough, in Emacs-22 the two behave identically because when your program sends "count: N\r", Emacs passes the "count: N" to the `shell' package, but keeps the \r for later because it needs to first see if the following char is a \n or not in order to know whether to drop the \r or not. I.e. the details of decoding DOS-style EOLs caused Emacs to turn one form into the other. So it indeed, looks like a problem introduced by the unicode merge: for some reason, the unicode code just sends the \r eagerly before it can tell whether the next char is a \n. I'll keep it in my todo list, but it may take me a little while to get back to it, so if someone wants to do it before, he's welcome, Stefan