emacs-devel
[Top][All Lists]
Advanced

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

Re: Compile Mode and "host" Emacs


From: Sebastian Wiesner
Subject: Re: Compile Mode and "host" Emacs
Date: Tue, 29 Oct 2013 14:18:28 +0100

2013/10/29 Nathan Trapuzzano <address@hidden>:
> Sebastian Wiesner <address@hidden> writes:
>
>> Uhm, you misunderstood me.  I didn't ask how to get the path to the
>> Emacs executable within the running Emacs instance itself.
>>
>> Rather, I wanted to know how to get the path to the Emacs executable
>> **from within a running subprocess**, started by `M-x compile`.
>>
>> For instance, assume that I do "M-x compile RET foo.sh", then how can
>> I get the path to the Emacs executable **within foo.sh**.
>>
>> I have "$EMACS" and "$INSIDE_EMACS", but the values of these variables
>> are pretty much useless.
>
> I don't think there's any portable way.

That's unfortunate.

I cannot but wonder what (stupid?) rationale let to the design of
"$EMACS" and "$INSIDE_EMACS", if I have no chance to find out *what*
Emacs I am actually inside of…

>  If you're running on Linux

I am not, nor could I guarantee that my users do.

> you know the process's direct parent is emacs

I can guarantee that neither.

> A better way would probably be to set some environment variable to the
> full path in your init file, and then using that from the compile
> process:
>
> ;;;; .emacs
>
> (setenv "EMACS_EXE_PATH"
>         (file-truename (concat (file-name-as-directory
>                                  invocation-directory)
>                                  invocation-name)))

I am not in control of my users' configurations, nor can I reasonably
demand them to change their "init.el" just to support a single script.
 Besides, if I tell them to change their "init.el", I might just as
well tell them to select the target Emacs via the corresponding option
of my script right away.

>
> Nathan



reply via email to

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