* ^M chars in *Async Command Output*
@ 2009-01-23 8:25 Sebastian Tennant
0 siblings, 0 replies; 6+ messages in thread
From: Sebastian Tennant @ 2009-01-23 8:25 UTC (permalink / raw
To: help-gnu-emacs
Hi all,
When I issue asynchronous commands using shell-command, for example:
M-! apt-get update & RET
buffer *Async Command Output* is filled with ^M characters and the
output is generally a mess.
Apparently not all Emacsen behave in this way though.
If you have a moment, could you perform a similar test and let us know
if the same thing happens to you. Include the Emacs version number in
your follow-up, and if it _does_ happen to you and you have a little
more time, whether you consider it a feature or a bug?
Your assistance is much appreciated.
Sebastian
--
Emacs' AlsaPlayer - Music Without Jolts
Lightweight, full-featured and mindful of your idyllic happiness.
http://home.gna.org/eap
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ^M chars in *Async Command Output*
[not found] <mailman.5557.1232699065.26697.help-gnu-emacs@gnu.org>
@ 2009-01-23 9:37 ` Andreas Politz
2009-01-23 9:42 ` Andreas Politz
2009-01-23 10:25 ` Sebastian Tennant
0 siblings, 2 replies; 6+ messages in thread
From: Andreas Politz @ 2009-01-23 9:37 UTC (permalink / raw
To: help-gnu-emacs
Sebastian Tennant wrote:
> Hi all,
>
> When I issue asynchronous commands using shell-command, for example:
>
> M-! apt-get update & RET
>
> buffer *Async Command Output* is filled with ^M characters and the
> output is generally a mess.
>
> Apparently not all Emacsen behave in this way though.
>
> If you have a moment, could you perform a similar test and let us know
> if the same thing happens to you. Include the Emacs version number in
> your follow-up, and if it _does_ happen to you and you have a little
> more time, whether you consider it a feature or a bug?
>
> Your assistance is much appreciated.
>
> Sebastian
I tried it with aptitude, it's the same. The process uses carriage-returns
to display the progress `widget' this show up as '^M' in emacs buffer.
Somehow this processes think they are running in a terminal, I think
because asynchronous shell-commands are runnning/started in a shell.
In a terminal :
$ echo -e 'Hello\rWorld'
$ World
In emacs :
M-! echo -e 'Hello\rWorld' &
Hello ^MWorld
Maybe a process-filter-function is the solution or pipe the command
through the utility 'col', like
M-! apt-get update | col &
-ap
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ^M chars in *Async Command Output*
2009-01-23 9:37 ` ^M chars in *Async Command Output* Andreas Politz
@ 2009-01-23 9:42 ` Andreas Politz
2009-01-23 10:25 ` Sebastian Tennant
1 sibling, 0 replies; 6+ messages in thread
From: Andreas Politz @ 2009-01-23 9:42 UTC (permalink / raw
To: help-gnu-emacs
Andreas Politz wrote:
> Sebastian Tennant wrote:
>> Hi all,
>>
>> When I issue asynchronous commands using shell-command, for example:
>>
>> M-! apt-get update & RET
>>
>> buffer *Async Command Output* is filled with ^M characters and the
>> output is generally a mess.
>>
>> Apparently not all Emacsen behave in this way though.
>>
>> If you have a moment, could you perform a similar test and let us know
>> if the same thing happens to you. Include the Emacs version number in
>> your follow-up, and if it _does_ happen to you and you have a little
>> more time, whether you consider it a feature or a bug?
>>
>> Your assistance is much appreciated.
>>
>> Sebastian
>
> I tried it with aptitude, it's the same. The process uses carriage-returns
> to display the progress `widget' this show up as '^M' in emacs buffer.
> Somehow this processes think they are running in a terminal, I think
> because asynchronous shell-commands are runnning/started in a shell.
>
> In a terminal :
>
> $ echo -e 'Hello\rWorld'
> $ World
>
> In emacs :
>
> M-! echo -e 'Hello\rWorld' &
> Hello ^MWorld
>
> Maybe a process-filter-function is the solution or pipe the command
> through the utility 'col', like
> M-! apt-get update | col &
Mh, the important thing is the pipe not the command, so `cat' would
bet the better choice.
>
> -ap
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ^M chars in *Async Command Output*
2009-01-23 9:37 ` ^M chars in *Async Command Output* Andreas Politz
2009-01-23 9:42 ` Andreas Politz
@ 2009-01-23 10:25 ` Sebastian Tennant
[not found] ` <mailman.5625.1232778837.26697.help-gnu-emacs@gnu.org>
1 sibling, 1 reply; 6+ messages in thread
From: Sebastian Tennant @ 2009-01-23 10:25 UTC (permalink / raw
To: help-gnu-emacs
Quoth Andreas Politz <politza@fh-trier.de>:
> I tried it with aptitude, it's the same. The process uses carriage-returns
> to display the progress `widget' this show up as '^M' in emacs buffer.
> Somehow this processes think they are running in a terminal, I think
> because asynchronous shell-commands are runnning/started in a shell.
>
> In a terminal :
>
> $ echo -e 'Hello\rWorld'
> $ World
>
> In emacs :
>
> M-! echo -e 'Hello\rWorld' &
> Hello ^MWorld
>
> Maybe a process-filter-function is the solution or pipe the command
> through the utility 'col', like
> M-! apt-get update | col &
>
> -ap
Many thanks Andreas. I hadn't heard of col before. It's useful but no
good for processes that require user input (such as apt).
A function; (comint-carriage-motion), and a variable;
comint-inhibit-carriage-motion, exist precisely for this purpose.
How best to apply them to buffer *Async Command Output* is something I'm
still working on.
Sebastian
--
Emacs' AlsaPlayer - Music Without Jolts
Lightweight, full-featured and mindful of your idyllic happiness.
http://home.gna.org/eap
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ^M chars in *Async Command Output*
[not found] ` <mailman.5625.1232778837.26697.help-gnu-emacs@gnu.org>
@ 2009-01-24 8:25 ` Andreas Politz
2009-01-25 17:41 ` Sebastian Tennant
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Politz @ 2009-01-24 8:25 UTC (permalink / raw
To: help-gnu-emacs
Sebastian Tennant wrote:
> Quoth Sebastian Tennant <sebyte@smolny.plus.com>:
>> A function; (comint-carriage-motion), and a variable;
>> comint-inhibit-carriage-motion, exist precisely for this purpose.
>>
>> How best to apply them to buffer *Async Command Output* is something I'm
>> still working on.
>
> And it turns out neither of these are any help!
>
> The best (shortest) solution I can find is this:
>
> (add-hook 'shell-mode-hook
> (lambda ()
> (when (equal (buffer-name (current-buffer)) "*Async Shell Command*")
> (set-process-filter proc 'comint-output-filter))))
>
> It's ugly, (proc is a local variable!), but short of patching
> shell-command it does the trick for now.
>
> Sebastian
It's better than what I first came up with.
Anyway, the local variable is not nessecary.
(defun shell-command-filter-hook nil
"Filter all shell command output via `comint-output-filter'."
(let ((proc (get-buffer-process "*Async Shell Command*")))
(when proc
(set-process-filter proc 'comint-output-filter))))
-ap
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ^M chars in *Async Command Output*
2009-01-24 8:25 ` Andreas Politz
@ 2009-01-25 17:41 ` Sebastian Tennant
0 siblings, 0 replies; 6+ messages in thread
From: Sebastian Tennant @ 2009-01-25 17:41 UTC (permalink / raw
To: help-gnu-emacs
Quoth Andreas Politz <politza@fh-trier.de>:
> [...] the local variable is not nessecary.
>
> (defun shell-command-filter-hook nil
> "Filter all shell command output via `comint-output-filter'."
> (let ((proc (get-buffer-process "*Async Shell Command*")))
> (when proc
> (set-process-filter proc 'comint-output-filter))))
The problem only afflicts asynchronous shell commands so better still
would be test this condition in the hook itself:
(defun async-shell-command-filter-hook nil
"Filter asynchronous shell command output via `comint-output-filter'."
(when (equal (buffer-name (current-buffer)) "*Async Shell Command*")
(let ((proc (get-buffer-process (current-buffer))))
(when proc (set-process-filter proc 'comint-output-filter)))))
People can then simply do:
(add-hook 'shell-mode-hook 'async-shell-command-filter-hook)
I filed a bug report against simple.el on this matter (a little
prematurely no doubt) but if we can get this hook added it will have
definitely been worthwhile.
Thanks for your help Andreas.
Sebastian
--
Emacs' AlsaPlayer - Music Without Jolts
Lightweight, full-featured and mindful of your idyllic happiness.
http://home.gna.org/eap
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-01-25 17:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.5557.1232699065.26697.help-gnu-emacs@gnu.org>
2009-01-23 9:37 ` ^M chars in *Async Command Output* Andreas Politz
2009-01-23 9:42 ` Andreas Politz
2009-01-23 10:25 ` Sebastian Tennant
[not found] ` <mailman.5625.1232778837.26697.help-gnu-emacs@gnu.org>
2009-01-24 8:25 ` Andreas Politz
2009-01-25 17:41 ` Sebastian Tennant
2009-01-23 8:25 Sebastian Tennant
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.