unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* shell-command, its relatives, and aliases
@ 2008-11-13 15:27 Bill Rising
  2008-11-14 13:22 ` Kevin Rodgers
  0 siblings, 1 reply; 3+ messages in thread
From: Bill Rising @ 2008-11-13 15:27 UTC (permalink / raw)
  To: help-gnu-emacs


I would like to use aliases in (shell-command ...) or (call-process  
region ...). Even if I tell the latter to behave as a login shell, and  
make sure that the aliases are available to the login shell, I cannot  
get them to execute.

The shell can see the aliases without any problem, because I can send  
the -alias- command and get the list of aliases.

It seems to me that elisp is trying to see if the command is defined  
before running it, instead of simply letting the shell chew on  
whatever was sent to it. This could be a grave misconception.

In any case, is there are way to be able to use aliases within any of  
the 'execute this line/region without starting a buffer with a shell'  
commands?

Thanks,

Bill






^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: shell-command, its relatives, and aliases
  2008-11-13 15:27 shell-command, its relatives, and aliases Bill Rising
@ 2008-11-14 13:22 ` Kevin Rodgers
  2008-11-21 13:44   ` Bill Rising
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Rodgers @ 2008-11-14 13:22 UTC (permalink / raw)
  To: help-gnu-emacs

Bill Rising wrote:
> 
> I would like to use aliases in (shell-command ...) or (call-process 
> region ...). Even if I tell the latter to behave as a login shell, and 
> make sure that the aliases are available to the login shell, I cannot 
> get them to execute.
> 
> The shell can see the aliases without any problem, because I can send 
> the -alias- command and get the list of aliases.
> 
> It seems to me that elisp is trying to see if the command is defined 
> before running it, instead of simply letting the shell chew on whatever 
> was sent to it. This could be a grave misconception.
> 
> In any case, is there are way to be able to use aliases within any of 
> the 'execute this line/region without starting a buffer with a shell' 
> commands?

call-process-region does not invoke the shell at all.  If you want to
use any shell features (e.g. redirection, aliases) you need to use
shell-command-on-region.

There are several ways to make aliases available in the shell invoked
by Emacs.  I would just explicitly read the shell definitions e.g.

	M-| . ~/my_aliases.bash && alias_1 arg_1

Or you could create the ~/.emacs_bash file and read the shell
definitions there (automatically) -- see the Interactive Shell
node of the Emacs manual.

-- 
Kevin Rodgers
Denver, Colorado, USA





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: shell-command, its relatives, and aliases
  2008-11-14 13:22 ` Kevin Rodgers
@ 2008-11-21 13:44   ` Bill Rising
  0 siblings, 0 replies; 3+ messages in thread
From: Bill Rising @ 2008-11-21 13:44 UTC (permalink / raw)
  To: Kevin Rodgers; +Cc: help-gnu-emacs

On Nov 14, 2008, at 7:22 , Kevin Rodgers wrote:

> Bill Rising wrote:
>> I would like to use aliases in (shell-command ...) or (call-process  
>> region ...). Even if I tell the latter to behave as a login shell,  
>> and make sure that the aliases are available to the login shell, I  
>> cannot get them to execute.
>> The shell can see the aliases without any problem, because I can  
>> send the -alias- command and get the list of aliases.
>> It seems to me that elisp is trying to see if the command is  
>> defined before running it, instead of simply letting the shell chew  
>> on whatever was sent to it. This could be a grave misconception.
>> In any case, is there are way to be able to use aliases within any  
>> of the 'execute this line/region without starting a buffer with a  
>> shell' commands?
>
> call-process-region does not invoke the shell at all.  If you want to
> use any shell features (e.g. redirection, aliases) you need to use
> shell-command-on-region.

OK.

> There are several ways to make aliases available in the shell invoked
> by Emacs.  I would just explicitly read the shell definitions e.g.
>
> 	M-| . ~/my_aliases.bash && alias_1 arg_1
>
> Or you could create the ~/.emacs_bash file and read the shell
> definitions there (automatically) -- see the Interactive Shell
> node of the Emacs manual.

I created the ~/.emacs_bash file, and it sources the ~/.bash_aliases I  
have defined.

I'll go back and fiddle with (shell-commmand-on-region ...) again.

Thanks,

Bill




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-21 13:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-13 15:27 shell-command, its relatives, and aliases Bill Rising
2008-11-14 13:22 ` Kevin Rodgers
2008-11-21 13:44   ` Bill Rising

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).