[Top][All Lists]

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

Re: Compile Mode and "host" Emacs

From: Nathan Trapuzzano
Subject: Re: Compile Mode and "host" Emacs
Date: Tue, 29 Oct 2013 09:10:34 -0400
User-agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux)

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.  If you're running on Linux and
you know the process's direct parent is emacs, you could do something

executable=$(readlink -f /proc/$PPID/exe)

where $PPID is the parent's process id, which can be obtained in various
ways.  Of course, this only works if emacs is the direct parent.

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

;;;; .emacs

(setenv "EMACS_EXE_PATH"
        (file-truename (concat (file-name-as-directory


reply via email to

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