From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#4343: comint-carriage-motion for async-shell-command Date: Sat, 05 Sep 2009 00:02:33 +0300 Organization: JURTA Message-ID: <878wguo23a.fsf@mail.jurta.org> Reply-To: Juri Linkov , 4343@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1252099651 31703 80.91.229.12 (4 Sep 2009 21:27:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Sep 2009 21:27:31 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 04 23:27:25 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MjgJV-00056V-5j for geb-bug-gnu-emacs@m.gmane.org; Fri, 04 Sep 2009 23:27:21 +0200 Original-Received: from localhost ([127.0.0.1]:56690 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjgJU-0007Id-KJ for geb-bug-gnu-emacs@m.gmane.org; Fri, 04 Sep 2009 17:27:20 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MjgJH-0007E0-AF for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2009 17:27:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MjgJC-0007D5-MI for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2009 17:27:06 -0400 Original-Received: from [199.232.76.173] (port=44882 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjgJC-0007Cx-IE for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2009 17:27:02 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:43619) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MjgJB-0002FJ-CU for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2009 17:27:01 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n84LQwHV008572; Fri, 4 Sep 2009 14:26:59 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n84LP6Cv008147; Fri, 4 Sep 2009 14:25:06 -0700 Resent-Date: Fri, 4 Sep 2009 14:25:06 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Juri Linkov Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Fri, 04 Sep 2009 21:25:06 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 4343 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.12520991857130 (code B ref -1); Fri, 04 Sep 2009 21:25:06 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 4 Sep 2009 21:19:45 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n84LJh1p007126 for ; Fri, 4 Sep 2009 14:19:44 -0700 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MjgC7-0005Im-1e for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2009 17:19:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MjgC2-0005Eg-5j for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2009 17:19:42 -0400 Original-Received: from [199.232.76.173] (port=46362 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjgC1-0005Ed-VX for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2009 17:19:38 -0400 Original-Received: from smtp-out1.starman.ee ([85.253.0.3]:42125 helo=mx1.starman.ee) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MjgC1-00018l-Ew for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2009 17:19:37 -0400 X-Virus-Scanned: by Amavisd-New at mx1.starman.ee Original-Received: from mail.starman.ee (82.131.70.181.cable.starman.ee [82.131.70.181]) by mx1.starman.ee (Postfix) with ESMTP id 7A01A3F4478 for ; Sat, 5 Sep 2009 00:19:31 +0300 (EEST) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Fri, 04 Sep 2009 17:27:06 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:30805 Archived-At: 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/