hruvulum
hruvulum

Reputation: 105

How do I add a new shell command to eshell?

Please help me debug the following definition of a simple eshell function. Yes, I am aware that I can define l as an alias, but I need to learn how to write eshell functions.

(defun eshell/l (&rest args)
  "a shortcut for ls that automatically adds some flags to the ls"
  (apply #'eshell/ls "-h" "-F" "-t" args))

That almost does the right thing. The bug is that the output of the ls command is inserted after the new prompt.

Upvotes: 0

Views: 392

Answers (2)

Yaroslav Lyakh
Yaroslav Lyakh

Reputation: 71

It can be done simpler:

(defun eshell/l (&rest args)
  "a shortcut for ls that automatically adds some flags to the ls"
  (eshell/ls "-h" "-F" "-t" args))

I'm not sure about "-F" (seems does not work on Emacs 24.3 on Windows 7)

Upvotes: 2

Vash2593
Vash2593

Reputation: 119

Eshell implements alias for this kind of command: http://www.masteringemacs.org/articles/2010/12/13/complete-guide-mastering-eshell/

Upvotes: 0

Related Questions