unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: rms@gnu.org
Cc: emacs-pretest-bug@gnu.org,
	Chris Moore <christopher.ian.moore@gmail.com>,
	handa@m17n.org
Subject: Re: carriage-return no longer works quite right in shell-mode
Date: Sun, 10 Feb 2008 21:55:51 -0500	[thread overview]
Message-ID: <jwvwspccje0.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <E1JOMMp-0001kD-32@fencepost.gnu.org> (Richard Stallman's message of "Sun, 10 Feb 2008 19:17:51 -0500")

> 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 <stdio.h>
> 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




  reply	other threads:[~2008-02-11  2:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-05 19:03 carriage-return no longer works quite right in shell-mode Chris Moore
2008-02-11  0:17 ` Richard Stallman
2008-02-11  2:55   ` Stefan Monnier [this message]
2008-02-12 12:24     ` Chris Moore
2008-02-29  8:39     ` Romain Francoise
2008-02-29 11:31       ` Kenichi Handa
2008-02-29 15:21         ` Romain Francoise
2008-03-04 11:44           ` Kenichi Handa
2008-03-04 11:42         ` Kenichi Handa
2008-03-04 15:46           ` Stefan Monnier
2008-03-05  2:00             ` Kenichi Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvwspccje0.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=christopher.ian.moore@gmail.com \
    --cc=emacs-pretest-bug@gnu.org \
    --cc=handa@m17n.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).