bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#1973: Bug in simple.el (Emacs version 22.2.1)


From: Sebastian Tennant
Subject: bug#1973: Bug in simple.el (Emacs version 22.2.1)
Date: Fri, 23 Jan 2009 18:01:13 +0000
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

Quoth Sebastian Tennant <sebyte@smolny.plus.com>:
> The question for me now is how to make buffer *Async Command Output*
> behave like buffer *shell*, an odd thing to be doing given that they are
> both in Shell mode!

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.

This works because shell-mode is called after the process is started.

--- shell-command snippet ---

 (with-current-buffer buffer
   (setq buffer-read-only nil)
   (erase-buffer)
   (display-buffer buffer)
   (setq default-directory directory)
   (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))

--- end of snippet ---

The whole thing's a bit of a mess if you ask me.

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.

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)?

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.

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.  After all,
the command that creates the buffer is called shell-command so let's
assume that's what the buffer is for.

I can't think of a single shell command that would depend on ^M
characters _not_ being handled in this way for its output to display
properly.  Can you think of any?

Sebastian

P.S.  Are there any buffer naming conventions in respect to
      capitalisation of words?  The lowercase 's' in *shell* has always
      struck me as odd alongside *Messages*, *Buffer List* e.t.c.

-- 
Emacs' AlsaPlayer - Music Without Jolts
Lightweight, full-featured and mindful of your idyllic happiness.
http://home.gna.org/eap








reply via email to

[Prev in Thread] Current Thread [Next in Thread]