From: Colin Brough on
Just started using emacs compilation mode for processing some latex
documents. Happen to be using a script to wrap up a couple of bits of
processing into one command - and the script is in my own bin
directory, in this case ~/bin/script/

However, emacs isn't picking up my PATH, which is set in ~/.bashrc,
when it is launched from the GTK launcher (I'm using Ubuntu, on this
machine 8.04, on another 9.10), as the shell it launches for the
compilation is non-interactive ("sh -c compile-command", I think).

So invoking 'compile' and giving it the name of the script isn't
working. Giving the full path on the first compilation isn't ideal, as
the script itself makes use of other scripts also in ~/bin/script and
in ~/bin/bin... Is there a clean way of telling the compilation mode
to add to the default PATH for the shell it invokes? I can't make head
nor tail of the documentation round the various variables...

In particular, compilation-environment looks promising, but its giving
me errors when I try to set the PATH like:

("PATH=$PATH:/home/cmb/bin/bin:/home/cmb/bin/script")

Variable expansion isn't being done... Do I just have to grit my teeth
and explicitly set the full path?

Cheers

Colin

--

----------------------------------------------------------------------
Colin Brough Colin.Brough(a)blueyonder.invalid
(Replace .invalid with .co.uk to reply)
From: Colin Brough on
Robert Marshall wrote:
> On Tue, 02 Feb 2010, Colin Brough wrote:
>
>> Just started using emacs compilation mode for processing some latex
>> documents. Happen to be using a script to wrap up a couple of bits of
>> processing into one command - and the script is in my own bin
>> directory, in this case ~/bin/script/
>>
>> However, emacs isn't picking up my PATH, which is set in ~/.bashrc,
>> when it is launched from the GTK launcher (I'm using Ubuntu, on this
>> machine 8.04, on another 9.10), as the shell it launches for the
>> compilation is non-interactive ("sh -c compile-command", I think).
>>
> ...
>> In particular, compilation-environment looks promising, but its giving
>> me errors when I try to set the PATH like:
>>
>> ("PATH=$PATH:/home/cmb/bin/bin:/home/cmb/bin/script")
>>
>> Variable expansion isn't being done... Do I just have to grit my teeth
>> and explicitly set the full path?
>>
>
> Does
> (add-to-list 'exec-path "/home/cmb/bin/bin")
>
> Work for you? it should!

Well, exec-path certainly has the directory added to its reported
value after adding the above code to .emacs... but it doesn't get
added the PATH used when 'compile' is invoked. If I Esc-X compile with
the script 'pdf' (which is in /home/cmb/bin/script, and present on
exec-path) I get:

-*- mode: compilation; default-directory:
"~/MainsOfFintry/Services/2010/Projector/" -*-
Compilation started at Tue Feb 2 22:12:21

pdf
/bin/bash: pdf: command not found

Compilation exited abnormally with code 127 at Tue Feb 2 22:12:21


I wrote a script to "echo $PATH > $FILE", and Esc-X compile that (full
path to the script), the result is:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

In other words, no /home/cmb/bin/script... So the default PATH for the
compile command isn't taken from exec-path.

Cheers

Colin

--

----------------------------------------------------------------------
Colin Brough Colin.Brough(a)blueyonder.invalid
(Replace .invalid with .co.uk to reply)
From: Richard Kettlewell on
Colin Brough <Colin.Brough(a)blueyonder.invalid> writes:

> Just started using emacs compilation mode for processing some latex
> documents. Happen to be using a script to wrap up a couple of bits of
> processing into one command - and the script is in my own bin
> directory, in this case ~/bin/script/
>
> However, emacs isn't picking up my PATH, which is set in ~/.bashrc,
> when it is launched from the GTK launcher (I'm using Ubuntu, on this
> machine 8.04, on another 9.10), as the shell it launches for the
> compilation is non-interactive ("sh -c compile-command", I think).
>
> So invoking 'compile' and giving it the name of the script isn't
> working. Giving the full path on the first compilation isn't ideal, as
> the script itself makes use of other scripts also in ~/bin/script and
> in ~/bin/bin... Is there a clean way of telling the compilation mode
> to add to the default PATH for the shell it invokes? I can't make head
> nor tail of the documentation round the various variables...
>
> In particular, compilation-environment looks promising, but its giving
> me errors when I try to set the PATH like:
>
> ("PATH=$PATH:/home/cmb/bin/bin:/home/cmb/bin/script")
>
> Variable expansion isn't being done... Do I just have to grit my teeth
> and explicitly set the full path?

(setenv "PATH" (concat "/home/cmb/bin/script" ":" (getenv "PATH")))

--
http://www.greenend.org.uk/rjk/
From: Colin Brough on
Richard Kettlewell wrote:
> Colin Brough <Colin.Brough(a)blueyonder.invalid> writes:
> (setenv "PATH" (concat "/home/cmb/bin/script" ":" (getenv "PATH")))

Bingo, that's the thing. Knew it had to be simple once I was pointed
in the right direction!

Cheers

Colin

--

----------------------------------------------------------------------
Colin Brough Colin.Brough(a)blueyonder.invalid
(Replace .invalid with .co.uk to reply)