arch detail

arch detail

Monday, August 28, 2006

The Joy of Eshell

Fellow emacsers:

Today I got embarassed because Friday at work I'd used M-x shell in front of a coworker to commit a source change to Subversion. Emacs' shell doesn't hide passwords, so I unintentionally typed mine in plain-text... in front of someone I would like to actually impress.

Whoops.

Naturally, this morning, I decided to see if anyone had though to deal with this problem, and I discovered Linkeshell which has actually been part of emacs since v. 21. Just run M-x eshell.

There are quite a few things that make eshell different than having emacs open a shell inside of its goofy psuedo-terminal buffer. First of all, it's actually a shell. Just for emacs. Written in elisp. Here are some highlights:
  • you can redirect stdout to an emacs buffer. Try env > # <buffer scratch>
  • it can be used anywhere that can run emacs, e.g. Win32, or DOS, or a good toaster. Now you don't have to install BASH on Windows to use your Windows box like a Real Computer.
  • your aliases are automatically saved between sessions.
  • you can use emacs functions like shell commands! Try alias emacs="find-file $1" for an experience in silky-smoothness.
  • up and down arrows behave like most shells, cycling through your history. However, left and right arrow allow you place the cursor *behind* the prompt and select text from the output of your last command. I've been looking for this feature in a shell for years now. Eshell makes it easy to copy, say, the PID from a ps and paste it into a "kill."
  • it's elisp, so it's easily configurable and extensible.
There are some problems - see the wishlist on the wiki. Doing a for loop into a pipe doesn't really work correctly. But that's what BASH one-liners are for.

No comments: