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

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

Re: Shell aliases as shell-commands


From: Thierry Volpiatto
Subject: Re: Shell aliases as shell-commands
Date: Thu, 22 Jan 2009 14:57:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Michael Heerdegen <address@hidden> writes:

> Hello,
>
> I agree that that my solution with BASH_ENV is not very clean. I would
> suggest the following elisp code which works without setting env vars:
>
> (defadvice shell-command (before my-shell-command activate)
>   (ad-set-arg
>    0
>    (concat "source ~/.bashrc; shopt -s -q expand_aliases;\n "
>       (ad-get-arg 0))))
>
> (you could replace .bashrc by an individual file especially written
> for that purpose).
>
> What do you think about it?

Just want to mention (again) that eshell-command work out of the box for
aliases. No config is needed. 
The aliases are stored by default in .emacs.d/.eshell and are
different of those you have in .bashrc, that is a good thing:
You may have alias in your bashrc that are good for interactive shell
but no good for non-interactive shells.
And that avoid modifying bash with shopt (strange things can happen)

And you have file-name completion also.
To add an alias:
M-x eshell-command
alias Mcle mount /dev/sdb1

Now (i bind eshell-command to C-!)
C-! Mcle ==> mount my usbkey

-- 
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France





reply via email to

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