Skip to content

Conversation

@SergiyKolesnikov
Copy link
Contributor

Many Emacs IDE features depend on external tools, such as, LSP servers, interpreters, compilers, and linters. To ensure Emacs can locate the executables for these tools, both the environment variables and the exec-path variable (see "(Emacs) Shell") must be configured correctly.

Many Emacs IDE features depend on external tools, such as, LSP servers,
interpreters, compilers, and linters. To ensure Emacs can locate the
executables for these tools, both the environment variables and the =exec-path=
variable (see [[info:Emacs#Shell][info "(Emacs) Shell"]]) must be configured
correctly.
@jeffbowman
Copy link
Contributor

I'm skeptical if we need this in all cases. The project you reference mentions MacOS, which does have a problem with the exec-path in Emacs. In Linux, this doesn't seem to be a problem. Run emacs -Q then M-x describe-variable RET exec-path RET to see the value. The same seems to be true for MS Windows as well.

Thus, in my experience, the exec-path is set "correctly" by Emacs on startup for at least Linux and MS Windows. You may need to check if Emacs is running in MacOS.

@SergiyKolesnikov
Copy link
Contributor Author

It is a general issue caused by Emacs inheriting the environment of its parent process.

For example, here are the values of exec-path that I get on my Debian by running emacs -Q and then M-x describe-variable RET exec-path RET:

From Gnome Terminal (bash)

("/home/user/.local/bin" "/usr/local/sbin" "/usr/local/bin"
 "/usr/sbin" "/usr/bin" "/home/user/.emacs.d/elpy/rpc-venv/bin"
 "/home/user/.local/share/coursier/bin"
 "/usr/libexec/emacs/30.1/x86_64-linux-gnu")

From Gnome Run Dialog (Alt+F2)

("/usr/local/sbin" "/usr/local/bin" "/usr/sbin" "/usr/bin"
 "/usr/libexec/emacs/30.1/x86_64-linux-gnu")

If you only run Emacs from your shell you will never run into any problems. As soon as Emacs is started by some other process it may not work as expected.

@jeffbowman
Copy link
Contributor

@jvdydev @sthesing thoughts on this? Not necessarily opposed, just on the fence on the need.

@jvdydev
Copy link
Contributor

jvdydev commented Oct 26, 2025

I personally haven't had this issue (granted, I'm not on macOS nor GNOME).

If this only is an issue for select setups (as described), I would lean towards putting it behind a documented customisation flag or as a documented example to avoid loading additional things in environments where this isn't an issue (Windows, more custom Linux setups, ...).

I haven't tested if this also happens on e.g. dmenu/rofi (and related alternatives), I tend to launch Emacs using a WM shortcut or a terminal (both of which seem to inherent the "correct" (expected) environment).

@SergiyKolesnikov
Copy link
Contributor Author

SergiyKolesnikov commented Oct 27, 2025

If this only is an issue for select setups (as described)

This is a common problem for setups that use Emacs in combination with external tools and alternate between terminal, WM, or daemon for launching Emacs. That is why, in this PR, I suggest to add exec-path-from-shell to the optional IDE module, which is most likely to use external tools (such as LSP servers) and therefore most likely to have this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants