unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Sebastian Tennant <sebyte@smolny.plus.com>
To: bug-gnu-emacs@gnu.org
Subject: bug#1973: Bug in simple.el (Emacs version 22.2.1)
Date: Fri, 23 Jan 2009 18:01:13 +0000	[thread overview]
Message-ID: <1vutoqae.fsf@vps203.linuxvps.org> (raw)
In-Reply-To: ocxy711h.fsf@vps203.linuxvps.org

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	other threads:[~2009-01-23 18:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87ocqnneu3.fsf@cyd.mit.edu>
2009-01-20 20:10 ` bug#1973: Bug in simple.el (Emacs version 22.2.1) 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 [this message]
2009-01-25 17:58                     ` Sebastian Tennant
2009-01-22 14:00   ` Sebastian Tennant
2009-01-22 18:27     ` Sebastian Tennant
2009-08-11  4:45   ` bug#1973: marked as done (Bug in simple.el (Emacs version 22.2.1)) Emacs bug Tracking System
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
     [not found] <63k0dk26.fsf@vps203.linuxvps.org>
     [not found] ` <jwveiyno719.fsf-monnier+emacs@gnu.org>
2009-01-29  7:06   ` bug#2103: Bug in simple.el Sebastian Tennant
2009-08-11  4:45     ` bug#2103: marked as done (Bug in simple.el) 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=1vutoqae.fsf@vps203.linuxvps.org \
    --to=sebyte@smolny.plus.com \
    --cc=1973@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).