Subject: Re: bug#1973: Bug in simple.el (Emacs version 22.2.1)

From: "Stefan Monnier" <[email-masked]>
Date: Thu, 22 Jan 2009 10:09:55 -0500

>>> Asynchronous commands called via shell-command, for example:
>>> (shell-command "apt-get update &")
>>> fill the buffer *Async Shell Command Output* with Ctrl-Ms, which I'm
>>> sure is not what's intended.
>> 
>>> My patch (attached) fixes this by using make-comint-in-buffer, rather
>>> than start-process, to call the asynchronous process.
>> 
>> Such a feature would be good, indeed.  

> Sorry Stefan, I'm not sure what feature it is you are refering to.

The feature of interpreting ^M in the output.

> There seems to be a bug within shell mode that prevents it from handling
> Ctrl-Ms properly.

It's not a bug.  shell-command just runs a command and gives you the output
of the command.  Some commands presume the output is displayed by some
kind of terminal and will use terminal commands like ^M (or even ANSI
color escape sequences), whereas shell-command was not designed for
this purpose.

>> I'm not sure that just using make-comint-in-buffer is good enough.
>> Maybe we should provide a new command instead, along the lines of
>> comint-run, or maybe even change comint-run so that it accepts a shell
>> command rather than an executable name.
> Why?

Because I'm not sure in what kinds of circumstances people use
shell-command with an "&" at the end.

> In any case, I suspect we should extend rather than alter, comint mode
> being the basis for dozens of other 'interpreter modes'.

`comint-run' is a command (i.e. for interactive use).  I do see that it
is occasionally misused from Elisp code (which should use make-comint
instead), so we should be somewhat careful indeed when changing it.

        Stefan