help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EShell Alias for a 'cd' followed by 'ls'


From: Michael Heerdegen
Subject: Re: EShell Alias for a 'cd' followed by 'ls'
Date: Thu, 19 Nov 2020 22:19:12 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Christopher Dimech <dimech@gmx.com> writes:

> The only caveat is that the aliases will go into an
> official release and cannot require users to type them.

I'm not an Eshell expert, but AFAIK `eshell/alias' is the corresponding
Elisp function.

So for example this would work:

#+begin_src emacs-lisp
(add-hook 'eshell-mode-hook
          (defun my-eshell-add-aliases ()
            (cl-loop
             for alias in
             '(("mkcd" "mkdir $1; cd $1")
               ;;...
               )
             do (apply 'eshell/alias alias))))
#+end_src

That modifies the alias save file as side effect.

The aliases are stored in the variable `eshell-command-aliases-list'.
That variable doesn't seem to be intended to be modified directly,
though.

Michael.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]