all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#1973: Bug in simple.el (Emacs version 22.2.1)
@ 2009-01-24 21:14 Stefan Monnier
  2009-02-04  9:47 ` Sebastian Tennant
  0 siblings, 1 reply; 17+ messages in thread
From: Stefan Monnier @ 2009-01-24 21:14 UTC (permalink / raw
  To: Sebastian Tennant; +Cc: 1973

> > I guess it's using shell-mode, but somehow fails to setup the process's
> > output filter?
> Now you're making it sound like a bug, just as I'm starting to accept
> that it's a misfeature :)

One part is whether it should use shell-mode or not.
Another is whether, when using shell-mode, it should behave like
M-x shell.

The second part is clearly a bug.  If we decide it shouldn't use
shell-mode, then the bug needn't be fixed.  But given that it currently
uses shell-mode, it seems that (contrary to what I thought) the current
intention is for it to behave like shell-mode, in which case it should
be fixed.

> And I've found a solution, but it's ugly:

>  (add-hook 'shell-mode-hook
>            (lambda ()
>              (set-process-filter proc 'comint-output-filter)))

> No one likes to see the guts of a function (local variable 'proc') in
> their mode hooks.

Yes, that's not a good option.  Better use neither shell-mode-hook, nor
some magic variable name.  I think that all that's needed is a good
(set-process-filter (get-buffer-process <buf>) 'comint-output-filter)
at the right place.  Tho, maybe a better option is to change the way the
process is started along the lines of what you originally proposed.

> We have two buffers (*shell* and *Async Command Output*) that both claim
> to be in Shell mode, yet process output is handled completely
> differently in each case.

Indeed, that's a bug.

> Why is *Async Command Output* in Shell mode at all if we're not to
> assume it will only be used for shell commands (that require ^M
> character handling)?

It's probably historical: shell mode hasn't always processed those
chars, so in the past the lack of comint-output-filter was simply
not noticed.

> Even replacing the call to shell-mode with a call to comint-mode makes
> no difference to the way ^M characters are handled.  In either case the
> process filter must be explicitly set to 'comint-ouput-filter.  I'd
> expect something as visually arresting as mangled output to be handled
> by a mode setting, but hey ho.

This is a more difficult decision: should calling a major-mode affect
the filter of a process that happens to be running in this buffer?
Usually, the expectation is that shell-mode (or comint-mode) is not
called directly, so the process filter is set by the calling code.

> If it were up to me, I'd rewrite the asynchronous part of shell-command
> so that make-comint-in-buffer is used to create a Comint mode buffer
> called *Async Shell Command Output* and leave it at that.

I'm beginning to agree.


        Stefan






^ permalink raw reply	[flat|nested] 17+ messages in thread
* bug#1973: Bug in simple.el (Emacs version 22.2.1)
@ 2009-01-20 20:10 Sebastian Tennant
  2009-01-21  4:59 ` Kevin Rodgers
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Sebastian Tennant @ 2009-01-20 20:10 UTC (permalink / raw
  To: bug-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 352 bytes --]

Hello all,

Asynchronous commands called via shell-command, for example:

 (shell-command "apt-get update &")

fill the buffer *Async Shell Command Output* with Ctrl-Ms, which I'm
sure is not what's intended.

My patch (attached) fixes this by using make-comint-in-buffer, rather
than start-process, to call the asynchronous process.

HTH,

Sebastian


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: simple.el.diff --]
[-- Type: text/x-diff, Size: 730 bytes --]

--- /usr/share/emacs/22.2/lisp/simple-patched.el	2009-01-20 19:51:29.528333079 +0000
+++ /usr/share/emacs/22.2/lisp/simple.el	2008-03-11 01:57:32.000000000 +0000
@@ -1892,11 +1892,10 @@
 		  (erase-buffer)
 		  (display-buffer buffer)
 		  (setq default-directory directory)
-		  (setq proc (get-buffer-process
-			      (make-comint-in-buffer
-			       "Shell" buffer shell-file-name nil
-			       shell-command-switch command)))
+		  (setq proc (start-process "Shell" buffer shell-file-name
+					    shell-command-switch command))
 		  (setq mode-line-process '(":%s"))
+		  (require 'shell) (shell-mode)
 		  (set-process-sentinel proc 'shell-command-sentinel)
 		  ))
 	    (shell-command-on-region (point) (point) command

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2009-02-04  9:47 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-24 21:14 bug#1973: Bug in simple.el (Emacs version 22.2.1) Stefan Monnier
2009-02-04  9:47 ` Sebastian Tennant
  -- strict thread matches above, loose matches on Subject: below --
2009-01-20 20:10 Sebastian Tennant
2009-01-21  4:59 ` Kevin Rodgers
2009-01-21 10:34   ` Sebastian Tennant
2009-01-21 22:04 ` Stefan Monnier
2009-01-22  8:45   ` Sebastian Tennant
2009-01-22 15:09     ` Stefan Monnier
2009-01-22 18:07       ` Sebastian Tennant
2009-01-22 21:30         ` Stefan Monnier
2009-01-22 23:15           ` Sebastian Tennant
2009-01-23  7:53             ` Stefan Monnier
2009-01-23 10:46               ` Sebastian Tennant
2009-01-23 18:01                 ` Sebastian Tennant
2009-01-25 17:58                   ` Sebastian Tennant
2009-01-22 14:00 ` Sebastian Tennant
2009-01-22 18:27   ` 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.