GNU bug report logs - #72849
[PATCH] Keep project's exec-path during with-temp-buffer call

Previous Next

Package: emacs;

Reported by: Evgenii Klimov <eugene.dev <at> lipklim.org>

Date: Wed, 28 Aug 2024 01:23:02 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 72849 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: kobarity <kobarity <at> gmail.com>
Cc: eugene.dev <at> lipklim.org, 72849 <at> debbugs.gnu.org
Subject: Re: bug#72849: [PATCH] Keep project's exec-path during
 with-temp-buffer call
Date: Thu, 29 Aug 2024 19:25:49 +0300
> Date: Fri, 30 Aug 2024 01:08:25 +0900
> From: kobarity <kobarity <at> gmail.com>
> Cc: 72849 <at> debbugs.gnu.org
> 
> Eli Zaretskii wrote:
> > > Date: Wed, 28 Aug 2024 00:13:25 +0100
> > > From:  Evgenii Klimov via "Bug reports for GNU Emacs,
> > >  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> > > 
> > > `with-temp-buffer' doesn't respect buffer-local environment variables,
> > > `exec-path' in this case.  Which results in executables not being found,
> > > or the wrong versions of executables being picked up.  E.g. if
> > > environment variable is modified via .dir-local file or direnv/envrc
> > > package.
> > 
> > Hmm, this doesn't look clean to me: exec-path is just one variable,
> > what makes it special here?
> > 
> > Moreover, it sounds like python-shell-with-environment, which
> > python-shell-prompt-detect calls, already attempts to have
> > buffer-local value of exec-path to be available to Python, so why
> > isn't that working for you?  And if it isn't work, I think we should
> > amend python-shell-with-environment to do this, so we don't need to do
> > it "by hand".
> > 
> > kobarity, any comments or suggestions?
> 
> The problem is that `with-temp-buffer' creates a new buffer, so the
> buffer local value of `exec-path' is not maintained in the new buffer.
> It is used to find the Python interpreter unless the interpreter is
> specified using the absolute path.
> 
> I think Evgenii's patch is logically correct, but it would be better
> to create a modified version of `with-temp-buffer' which keeps
> `exec-path' in the new buffer.  The attached is my proposal to do so.

Thanks, but what about python-shell-with-environment: doesn't it
already try to do this, including preserving exec-path from the
original buffer?




This bug report was last modified 265 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.