From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.help Subject: Re: Shell aliases as shell-commands Date: Thu, 22 Jan 2009 14:57:23 +0100 Message-ID: <87mydj78ak.fsf@tux.homenetwork> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1232633266 19850 80.91.229.12 (22 Jan 2009 14:07:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 22 Jan 2009 14:07:46 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 22 15:08:58 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LQ0E6-0004l3-P5 for geh-help-gnu-emacs@m.gmane.org; Thu, 22 Jan 2009 15:08:11 +0100 Original-Received: from localhost ([127.0.0.1]:33215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LQ0Cp-0007Nm-Fp for geh-help-gnu-emacs@m.gmane.org; Thu, 22 Jan 2009 09:06:51 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LQ0AF-00051E-JL for help-gnu-emacs@gnu.org; Thu, 22 Jan 2009 09:04:11 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LQ0AE-0004zc-1n for help-gnu-emacs@gnu.org; Thu, 22 Jan 2009 09:04:11 -0500 Original-Received: from [199.232.76.173] (port=36789 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LQ0AD-0004zW-ON for help-gnu-emacs@gnu.org; Thu, 22 Jan 2009 09:04:09 -0500 Original-Received: from main.gmane.org ([80.91.229.2]:37210 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LQ0AD-0007CL-5u for help-gnu-emacs@gnu.org; Thu, 22 Jan 2009 09:04:09 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LQ0AB-0005AT-C0 for help-gnu-emacs@gnu.org; Thu, 22 Jan 2009 14:04:07 +0000 Original-Received: from 137.77.197-77.rev.gaoland.net ([77.197.77.137]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 22 Jan 2009 14:04:07 +0000 Original-Received: from thierry.volpiatto by 137.77.197-77.rev.gaoland.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 22 Jan 2009 14:04:07 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 37 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 137.77.197-77.rev.gaoland.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:/k7hRPdRnQuu7QnMmIKdf+9lL64= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:61561 Archived-At: Michael Heerdegen 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