unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Sebastian Tennant <sebyte@smolny.plus.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Shell aliases as shell-commands
Date: Wed, 21 Jan 2009 10:51:26 +0000	[thread overview]
Message-ID: <tz7trky9.fsf@vps203.linuxvps.org> (raw)
In-Reply-To: barmar-96B846.00465021012009@mara100-84.onlink.net

Quoth Barry Margolin <barmar@alum.mit.edu>:
> In article <mailman.5330.1232446602.26697.help-gnu-emacs@gnu.org>,
>  Sebastian Tennant <sebyte@smolny.plus.com> wrote:
>
>> Quoth Peter Dyballa <Peter_Dyballa@Web.DE>:
>> > Am 20.01.2009 um 10:09 schrieb Sebastian Tennant:
>> >
>> >> It's 'M-x shell-command' I'm thinking about.
>> >
>> > Forget it!  Shell-command is not meant for interactive use as in a
>> > shell with aliases and such comfort.
>> 
>> But my aliases are so handy!!! I want them (without having to run an
>> interactive shell), and Emacs can give them to me, I know it can :)
>
> Can you define them as functions instead of aliases?

The issue was over instructing the shell to source my ~/.bashrc (which
contains both aliases and functions).

I mistakenly thought that the way to get a shell to read init files was
to specify a login shell (bash -l -c <command>), but that isn't the way
to do it, rather, you should force interactive behaviour with the '-i'
switch (bash -i -c <command>).  Do this and all your aliases and
functions are to hand.

Here are the two functions I posted to emacs.sources that force
interactive shells and put all your aliases and function defs at your
fingertips.

 http://article.gmane.org/gmane.emacs.sources/3147

The previous post (3146) contains a little bit of explanation but don't
use the code from 3146 or you'll break shell-command (slightly).

If you have lots of aliases and functions you'd like to access via

  M-! <command>

you may like to rebind M-! to interactive-shell-command, like so:

 (global-set-key "M-!" 'interactive-shell-command)

Sebastian





  reply	other threads:[~2009-01-21 10:51 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-19 21:11 Shell aliases as shell-commands Sebastian Tennant
2009-01-19 22:02 ` Peter Dyballa
2009-01-20  9:09   ` Sebastian Tennant
2009-01-20  9:38     ` Peter Dyballa
2009-01-20 10:18       ` Sebastian Tennant
2009-01-20 11:43         ` Peter Dyballa
2009-01-20 15:40           ` Sebastian Tennant
2009-01-20 16:43             ` Peter Dyballa
2009-01-20 17:09             ` Thierry Volpiatto
2009-01-20 18:03               ` Sebastian Tennant
     [not found]       ` <mailman.5330.1232446602.26697.help-gnu-emacs@gnu.org>
2009-01-20 11:02         ` Teemu Likonen
2009-01-20 11:10           ` Sebastian Tennant
2009-01-21  5:46         ` Barry Margolin
2009-01-21 10:51           ` Sebastian Tennant [this message]
2009-01-21 10:40         ` Michael Heerdegen
2009-01-21 15:26           ` Sebastian Tennant
2009-01-21 15:49             ` Peter Dyballa
2009-01-21 17:07               ` Sebastian Tennant
2009-01-21 18:26                 ` Peter Dyballa
     [not found]             ` <mailman.5445.1232552977.26697.help-gnu-emacs@gnu.org>
2009-01-22 11:52               ` Michael Heerdegen
2009-01-22 13:51                 ` Peter Dyballa
2009-01-22 20:26                   ` Sebastian Tennant
2009-01-22 13:57                 ` Thierry Volpiatto
     [not found]                 ` <mailman.5510.1232633053.26697.help-gnu-emacs@gnu.org>
2009-01-22 17:55                   ` Michael Heerdegen
2009-01-22 20:35                     ` Sebastian Tennant
     [not found]           ` <mailman.5443.1232551479.26697.help-gnu-emacs@gnu.org>
2009-02-17 15:14             ` David Combs
2009-02-17 23:18               ` Peter Dyballa
     [not found]         ` <mailman.5332.1232449359.26697.help-gnu-emacs@gnu.org>
2009-02-17 15:08           ` David Combs
     [not found] <mailman.5279.1232399379.26697.help-gnu-emacs@gnu.org>
2009-01-19 22:53 ` Chetan
2009-01-20  9:07   ` Sebastian Tennant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tz7trky9.fsf@vps203.linuxvps.org \
    --to=sebyte@smolny.plus.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).