all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: bug-gnu-emacs@gnu.org
Subject: bug#4343: comint-carriage-motion for async-shell-command
Date: Sat, 05 Sep 2009 00:02:33 +0300	[thread overview]
Message-ID: <878wguo23a.fsf@mail.jurta.org> (raw)

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/






             reply	other threads:[~2009-09-04 21:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87tyzby5xi.fsf@mail.jurta.org>
2009-09-04 21:02 ` Juri Linkov [this message]
2009-09-08 18:54   ` bug#4343: comint-carriage-motion for async-shell-command Stefan Monnier
2009-09-09  0:59     ` Juri Linkov
2009-09-09 14:52       ` Stefan Monnier
2009-09-10  1:05   ` bug#4343: marked as done (comint-carriage-motion for async-shell-command) Emacs bug Tracking System

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

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

  git send-email \
    --in-reply-to=878wguo23a.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=4343@emacsbugs.donarmstrong.com \
    --cc=bug-gnu-emacs@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 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.