* bug#4343: comint-carriage-motion for async-shell-command @ 2009-09-04 21:02 ` Juri Linkov 2009-09-08 18:54 ` Stefan Monnier 2009-09-10 1:05 ` bug#4343: marked as done (comint-carriage-motion for async-shell-command) Emacs bug Tracking System 0 siblings, 2 replies; 5+ messages in thread From: Juri Linkov @ 2009-09-04 21:02 UTC (permalink / raw) To: bug-gnu-emacs 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/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#4343: comint-carriage-motion for async-shell-command 2009-09-04 21:02 ` bug#4343: comint-carriage-motion for async-shell-command Juri Linkov @ 2009-09-08 18:54 ` Stefan Monnier 2009-09-09 0:59 ` Juri Linkov 2009-09-10 1:05 ` bug#4343: marked as done (comint-carriage-motion for async-shell-command) Emacs bug Tracking System 1 sibling, 1 reply; 5+ messages in thread From: Stefan Monnier @ 2009-09-08 18:54 UTC (permalink / raw) To: Juri Linkov; +Cc: bug-gnu-emacs, 4343 > 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#4343: comint-carriage-motion for async-shell-command 2009-09-08 18:54 ` Stefan Monnier @ 2009-09-09 0:59 ` Juri Linkov 2009-09-09 14:52 ` Stefan Monnier 0 siblings, 1 reply; 5+ messages in thread From: Juri Linkov @ 2009-09-09 0:59 UTC (permalink / raw) To: Stefan Monnier; +Cc: 4343 >> 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/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#4343: comint-carriage-motion for async-shell-command 2009-09-09 0:59 ` Juri Linkov @ 2009-09-09 14:52 ` Stefan Monnier 0 siblings, 0 replies; 5+ messages in thread From: Stefan Monnier @ 2009-09-09 14:52 UTC (permalink / raw) To: Juri Linkov; +Cc: 4343 > 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#4343: marked as done (comint-carriage-motion for async-shell-command) 2009-09-04 21:02 ` bug#4343: comint-carriage-motion for async-shell-command Juri Linkov 2009-09-08 18:54 ` Stefan Monnier @ 2009-09-10 1:05 ` Emacs bug Tracking System 1 sibling, 0 replies; 5+ messages in thread From: Emacs bug Tracking System @ 2009-09-10 1:05 UTC (permalink / raw) To: Juri Linkov [-- Attachment #1: Type: text/plain, Size: 889 bytes --] Your message dated Thu, 10 Sep 2009 03:55:21 +0300 with message-id <87tyzby5xi.fsf@mail.jurta.org> and subject line Re: bug#4343: comint-carriage-motion for async-shell-command has caused the Emacs bug report #4343, regarding comint-carriage-motion for async-shell-command to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com immediately.) -- 4343: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=4343 Emacs Bug Tracking System Contact owner@emacsbugs.donarmstrong.com with problems [-- Attachment #2: Type: message/rfc822, Size: 3628 bytes --] From: Juri Linkov <juri@jurta.org> To: bug-gnu-emacs@gnu.org Subject: comint-carriage-motion for async-shell-command Date: Sat, 05 Sep 2009 00:02:33 +0300 Message-ID: <878wguo23a.fsf@mail.jurta.org> 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/ [-- Attachment #3: Type: message/rfc822, Size: 2147 bytes --] From: Juri Linkov <juri@jurta.org> To: Stefan Monnier <monnier@iro.umontreal.ca> Cc: 4343-done@emacsbugs.donarmstrong.com Subject: Re: bug#4343: comint-carriage-motion for async-shell-command Date: Thu, 10 Sep 2009 03:55:21 +0300 Message-ID: <87tyzby5xi.fsf@mail.jurta.org> >> 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/ ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-09-10 1:05 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <87tyzby5xi.fsf@mail.jurta.org> 2009-09-04 21:02 ` bug#4343: comint-carriage-motion for async-shell-command Juri Linkov 2009-09-08 18:54 ` 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
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.