You can type elisp expressions without outer parens, like
λ kbd "C-x f"
or
λ define-key
Try it! it returns
usage: define-key: (KEYMAP KEY DEF)
It's a bit like an alien fish
. Oddly similar because in both shells, parens delineate nested function calls. The equivalent in Bash would be using grave accents, e.g. echo `concalc 1+2`
. Try
λ echo (+ 1 2)
λ define-key $global-map (kbd "C-x t") #'crux-transpose-windows
λ list-timers
So cool! You really should try. If you don't have an Emacs open, open it and type M-x eshell. Type these commands out by hand.
More things to try:
λ concat a b
λ setq a 2
λ + a 3
Hear this:
Unlike regular system shells, Eshell never invokes kernel functions
directly, such as ‘exec(3)’. Instead, it uses the Lisp functions
available in the Emacs Lisp library. It does this by transforming the
input line into a callable Lisp form.
[2024-04-08 Mon] That it just does lisp becomes obvious if you type a command that doesn't exist. Compare it in eshell versus shell.
To see the Lisp form that will be invoked, type:
λ eshell-parse-command "echo hello"
λ eshell-parse-command "echo hello; echo multiple words; setq a 2 b 3"
Also
λ which ls
One use I've for Eshell that's not possible in any other shell: after editing ~/.profile or ~/.xsessionrc or similar files, I can make it apply to the running emacs environment with simply
λ . ~/.profile
This is not possible in any other shell because they're external processes, whereas Eshell's "process" is the Emacs process.
May not seem important to source ~/.profile
, but I feel there's something about the fact you can that proves there's no other sane shell choice. Emacs is supposed to be your HCI (human-computer interface). Why create roadblocks?
By the way, so you know, . .profile
is is not the same as source .profile
(in plain Bash, it is the same).
If you're looking for how to do something, try the info manual at C-h i d m Eshell <RET>
. They tell you how to do for loops and whatever else you need.