views:

164

answers:

1

i have currently switched over to emacs (aquamacs) and am in the process of migrating my entire workflow into it one step at a time (org-mode, dired, etc., from pathfinder, notational velocity, etc.).

the one thing i have yet to try (and seems to be the biggest obstacle thus far) is the built-in emacs shell (shell and/or eshell, here on referred to as "eshell"), due to having zsh setup perfectly for me. unsure if there is a way to essentially mirror/minimize the conversion/adaptation steps required.....

my questions:

  1. can eshell be treated as a superset of zsh (i.e., eshell can do everything that zsh can, plus more)? i assume eshell lacks quite a bit compared to standard shells (bash, zsh, ksh, tcsh, etc.), otherwise it would be one of the standard shells (correct me if i'm wrong to think about it that way).

  2. what are the main limitations in using eshell over zsh? any folks switch from zsh to eshell and feel there are aspects of zsh you critically miss?

  3. anyone know of any links/resources doing a zsh/eshell feature comparison?

  4. further, any resources on making the change from one's usual shell to eshell? advice on workflow migration?

  5. if eshell isn't as "powerful" as zsh, then what advantage does eshell have over zsh? any tips and tricks on using eshell within emacs that would illustrate the time spent learning it?

  6. should one just give up on eshell and continue using zsh if it does everything i think i need? or are the few "power workflows" worth it (of which i'm not aware of)?

thnx in advance.

+9  A: 

Regarding M-x eshell:

  1. Eshell is not a stand-alone shell; it's implemented in pure elisp, so can't be run outside emacs, which is why it's not one of the standard shells. It doesn't have its own scripting language like bash/zsh/etc. have; it has elisp, and some command interpretation stuff to make calling elisp a little cleaner.

  2. I can't speak to zsh vs eshell, but I've mostly switched from bash to eshell. 95% of the time, eshell does everything I want or need without any problems. I don't use it for ssh. Also, you can't background a process once it's started (but you can start it backgrounded).

  3. It's going to be really hard, because zsh has a full scripting language, whereas eshell is basically an interface to the elisp interpreter. What are you looking for in an interactive shell? Eshell can probably do most of it. Conditional statements and loops on the command line? Sure. Aliases, functions, wildcards, programmable completion? Sure.

  4. The way I migrated was to basically start from scratch. Every time I ran into something that I didn't like or I wished it did, I'd figure out how to get it to do what I want. For example, eshell uses pcomplete.el for programmable completion, so adding completion functions is pretty easy.

  5. Integration with emacs is the big win for me. You can have elisp functions piped to shell commands. For a silly example, try:

    message "hello world" | cut -f 1 -d ' '
    Some commands (notably grep) get put in emacs buffers, so e.g. you can quickly jump to the results.

  6. Depends on how much time you really spend in emacs. If you do everything in emacs, it's useful, because sometimes it's easier to pipe together elisp commands with other commands through eshell. If you don't find yourself copy&pasting between emacs and your shell too frequently, it's probably not going to be a win, and you're going to have to spend time customizing it to the point you're comfortable with it.

As an alternative to eshell, M-x shell runs your normal shell underneath which interprets all the commands (so doesn't have access to elisp functions), while command-line editing (and therefore programmable completion, history, etc.) is done by emacs. I use it for ssh.

One other alternative is M-x term, which is a terminal emulator inside emacs, and usually runs a shell underneath, and the shell does all of its normal things. Then there's absolutely no conversion/adaptation steps required.

Eric Warmenhoven
eric, since yours is the only reply, by default you win "best answer". thnx 4 the info.
mt3