tags:

views:

83

answers:

1

Just found that unfinished manual, but it's really unfineshed. Right on the climax. I still don't get it.

  • What is that? An eLisp interpreter?
  • How do you tell emacs to edit a file from there?
  • What is the difference?
  • What are the eshell only commands?
+6  A: 

Eshell is a command interpreter like a normal shell, but it does not run bash or any other shell underneath. Like bash, it has several types of commands: while bash has aliases, functions, and falls back to $PATH, eshell has aliases, lisp functions, eshell functions, and falls back to $PATH.

So, for example, you can run:

~ $ find-file foo.txt

and the lisp function find-file will be executed non-interactively (unlike M-x), meaning all necessary arguments must be passed in. This is one way to tell emacs to edit a file from eshell. It's probably faster to run C-x C-f, since it will default to the directory that eshell is currently in.

When you run:

~ $ ls

it actually runs the function eshell/ls, which will get a directory listing without calling /bin/ls. There are similar builtins; if you run C-h f eshell/ <TAB> you can get a list of them.

One of the major points of the eshell builtin functions is to make commands fit into other existing emacs functions. For example, grep will go into the *grep* buffer so that you can quickly jump to the results.

It also has aliases, which are somewhat similar to bash aliases, but act a bit like functions in the way they handle arguments. For example, in bash, you might say

alias ll='ls -l'

while in eshell you would say

alias ll ls -l '$*'

and both of those mean the same thing. The $* means basically "expand all arguments", and it's necessary to quote it. You can run alias to see all aliases you've created.

Eric Warmenhoven
eshell gives you an uniform shell across platforms (i.e. an ls-command that works the same way on both Linux and Windows).
slu
Perfect! Just what I wanted, a mix of tutorial, workflow and reference source. Sad the documentation isn't very complete. There are other things I'd like to know, like how to customize the prompt. I think I got to learn a little elisp and dive into the code when I get some time.
Henry Mazza