Subject: 3rd party shell or not?

From: Peter Breton <[email-masked]>
Date: Thu, 29 Aug 1996 11:22:07 -0400

I've followed the discussions about 3rd party shells with interest,
and I'm wondering whether one is better off using one (bugs and all) 
or trying instead to use Emacs shell-mode and add-ons to add features 
to the native shell.  This assumes, of course, that you run shells inside 
emacs almost all the time, since if you run it outside emacs all these
advantages vanish.

Let me play the part of an advocate of Emacs + native shell. (Of course,
I use NT almost exclusively, and its' native shell is (from what I hear)
considerably better than the win95 one.)

1) As scripting languages, any of the native shells suck. However, I would
counter that I'd simply use Perl5 or Python as a scripting language, which
is very probably at least as powerful as what the 3rd party shells provide,
and cross-platform to boot. The only thing you lose is shell functions 
(which not all the 3rd party shells provide anyway).

2) Shell-mode provides:

  a) Visual recall/editing
  b) Filename completion
  c) Command completion
  d) History substitution (!!, !-n, !$, !*, etc)
  e) User-defined completion (which none of the shells do, AFAIK)
  f) Emulation of some of the shells features (fignore, echoing commands, etc)
     These are listed in the manual, or you can inspect comint.el and 
     shell.el.

   And of course:
  *) Key-bindings
  *) Integration with other emacs features

3) Emacs packages (not in standard distribution)

  I've been looking at adapting Simon Marshall's shellc and shelldb packages
  for NTEmacs (it looks pretty straightforward). These allow completion
  of command options, usernames, hostnames, etc, much like tcsh.

4) User add-ons

  a) You could fake aliases with abbrevs (as a quick-n-dirty solution),
     something like this:

	(defun pb-enhanced-space (arg)
	  (interactive "p")
	  (let ((comint-commandp))
	    (save-excursion
	      (comint-bol nil)
	      (setq comint-commandp (looking-at "[ \t]*\\(\\sw*\\)$")))
	    (if comint-commandp
		(expand-abbrev))
	    (comint-magic-space arg)))

  b) You could define a completion function to do aliases

  c) You could define a completion function to emulate CDPATH

What I see still missing:

1) Fileglobbing in emacs. The native file globbing isn't as powerful as
a traditional Unix shell. The NT Perl distribution has a globbing
program (perlglob), perhaps this could be used.

2) The NT shell lets you associate programs with file extensions, I don't
think the Win95 shell does. However, you could do this inside emacs in a
very powerful way, by having a regexp/command pair, much like auto-mode-alist
or interpreter-mode-alist. If a command matched the regexp, the appropriate
command would be inserted.

Annoying bugs:

1) Directory tracking is very easy to fool. The docs say that it is "a
half-assed solution" (that's an exact quote! :), under NTEmacs it seems
even easier to trick.

Comments? Did I miss anything?

			Peter