GNU bug report logs - #4343
comint-carriage-motion for async-shell-command

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> jurta.org>

Date: Fri, 4 Sep 2009 21:25:06 UTC

Severity: normal

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 4343 in the body.
You can then email your comments to 4343 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4343; Package emacs. (Fri, 04 Sep 2009 21:25:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> jurta.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 04 Sep 2009 21:25:06 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: bug-gnu-emacs <at> gnu.org
Subject: comint-carriage-motion for async-shell-command
Date: Sat, 05 Sep 2009 00:02:33 +0300
Often an asynchronous shell command run with M-& produces the output
that looks like garbage when programs use carriage control characters ^M
to display progress with percentages.

Even the `compile' command is better in this regard because its
`compilation-filter' handles carriage motion using the function
`comint-carriage-motion'.

The following patch does the same for asynchronous commands in
`shell-command'.  It seems it was intended to do this anyway because
`*Async Shell Command*' uses `shell-mode'.  But `shell-mode' doesn't set
the filter that processes carriage control characters.  It is the `shell'
command that sets the filter via `comint-exec' before enabling `shell-mode'.
So it's necessary to set the filter explicitly in `shell-command'
after enabling `shell-mode':

Index: lisp/simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.1008
diff -u -r1.1008 simple.el
--- lisp/simple.el	28 Aug 2009 04:21:17 -0000	1.1008
+++ lisp/simple.el	4 Sep 2009 21:02:21 -0000
@@ -2214,7 +2220,11 @@
 		  (setq mode-line-process '(":%s"))
 		  (require 'shell) (shell-mode)
 		  (set-process-sentinel proc 'shell-command-sentinel)
+		  ;; Use the comint filter for proper handling of carriage motion
+		  ;; (see `comint-inhibit-carriage-motion'),.
+		  (set-process-filter proc 'comint-output-filter)
 		  ))
 	    (shell-command-on-region (point) (point) command
 				     output-buffer nil error-buffer)))))))

-- 
Juri Linkov
http://www.jurta.org/emacs/




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4343; Package emacs. (Tue, 08 Sep 2009 19:00:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 08 Sep 2009 19:00:04 GMT) Full text and rfc822 format available.

Message #10 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Juri Linkov <juri <at> jurta.org>
Cc: 4343 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
Subject: Re: bug#4343: comint-carriage-motion for async-shell-command
Date: Tue, 08 Sep 2009 14:54:58 -0400
> The following patch does the same for asynchronous commands in
> `shell-command'.  It seems it was intended to do this anyway because
> `*Async Shell Command*' uses `shell-mode'.  But `shell-mode' doesn't set
> the filter that processes carriage control characters.  It is the `shell'
> command that sets the filter via `comint-exec' before enabling `shell-mode'.
> So it's necessary to set the filter explicitly in `shell-command'
> after enabling `shell-mode':

That looks right.  Could you try and check whether there's more of
comint's setup code that could be copied here?  And try and move this
into a new function `comint-setup-process' which both compile.el and M-&
could then use?


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4343; Package emacs. (Tue, 08 Sep 2009 19:00:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 08 Sep 2009 19:00:07 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4343; Package emacs. (Wed, 09 Sep 2009 03:20:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> jurta.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 09 Sep 2009 03:20:04 GMT) Full text and rfc822 format available.

Message #20 received at 4343 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 4343 <at> debbugs.gnu.org
Subject: Re: bug#4343: comint-carriage-motion for async-shell-command
Date: Wed, 09 Sep 2009 03:59:29 +0300
>> The following patch does the same for asynchronous commands in
>> `shell-command'.  It seems it was intended to do this anyway because
>> `*Async Shell Command*' uses `shell-mode'.  But `shell-mode' doesn't set
>> the filter that processes carriage control characters.  It is the `shell'
>> command that sets the filter via `comint-exec' before enabling `shell-mode'.
>> So it's necessary to set the filter explicitly in `shell-command'
>> after enabling `shell-mode':
>
> That looks right.  Could you try and check whether there's more of
> comint's setup code that could be copied here?

Other than setting `comint-output-filter', `comint-exec' also starts
a process.  But starting a process is not necessary in `shell-command'
that starts it explicitly.

> And try and move this into a new function `comint-setup-process' which
> both compile.el and M-& could then use?

They can't be merged because `compilation-filter' runs a compile-specific
hook `compilation-filter-hook'.

-- 
Juri Linkov
http://www.jurta.org/emacs/



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4343; Package emacs. (Wed, 09 Sep 2009 15:00:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 09 Sep 2009 15:00:05 GMT) Full text and rfc822 format available.

Message #25 received at 4343 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> jurta.org>
Cc: 4343 <at> debbugs.gnu.org
Subject: Re: bug#4343: comint-carriage-motion for async-shell-command
Date: Wed, 09 Sep 2009 10:52:15 -0400
> Other than setting `comint-output-filter', `comint-exec' also starts
> a process.  But starting a process is not necessary in `shell-command'
> that starts it explicitly.

OK, then.

>> And try and move this into a new function `comint-setup-process' which
>> both compile.el and M-& could then use?

> They can't be merged because `compilation-filter' runs a compile-specific
> hook `compilation-filter-hook'.

Too bad.  Please install your patch, then.


        Stefan



Reply sent to Juri Linkov <juri <at> jurta.org>:
You have taken responsibility. (Thu, 10 Sep 2009 01:05:04 GMT) Full text and rfc822 format available.

Notification sent to Juri Linkov <juri <at> jurta.org>:
bug acknowledged by developer. (Thu, 10 Sep 2009 01:05:05 GMT) Full text and rfc822 format available.

Message #30 received at 4343-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 4343-done <at> debbugs.gnu.org
Subject: Re: bug#4343: comint-carriage-motion for async-shell-command
Date: Thu, 10 Sep 2009 03:55:21 +0300
>> Other than setting `comint-output-filter', `comint-exec' also starts
>> a process.  But starting a process is not necessary in `shell-command'
>> that starts it explicitly.
>
> OK, then.
>
>>> And try and move this into a new function `comint-setup-process' which
>>> both compile.el and M-& could then use?
>
>> They can't be merged because `compilation-filter' runs a compile-specific
>> hook `compilation-filter-hook'.
>
> Too bad.  Please install your patch, then.

Done.

-- 
Juri Linkov
http://www.jurta.org/emacs/



bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Thu, 08 Oct 2009 14:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 252 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.