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?
Henry Mazza
  • 764
  • 1
  • 6
  • 18
  • 6
    very badly asked question IMHO - can you re-edit to be a bit clearer / specific about what you're asking. also, consider splitting into separate questions. – cristobalito Oct 06 '10 at 21:39

2 Answers2

9

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
  • 2,942
  • 20
  • 17
  • 2
    eshell gives you an uniform shell across platforms (i.e. an ls-command that works the same way on both Linux and Windows). – slu Oct 07 '10 at 06:06
  • 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 Oct 07 '10 at 20:33
2

Have a look at this introduction to Eshell: http://www.masteringemacs.org/articles/2010/12/13/complete-guide-mastering-eshell/

It probably does not cover every aspect of this powerful tool, but it's quite informative.

Thorsten
  • 3,451
  • 3
  • 20
  • 25