GNU bug report logs -
#57370
28.1; eshell/addpath does not work when called noninteractively
Previous Next
Reported by: Colton Lewis <coltonlewis <at> google.com>
Date: Tue, 23 Aug 2022 21:09:01 UTC
Severity: normal
Found in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 8/23/2022 1:36 PM, Colton Lewis via Bug reports for GNU Emacs, the
Swiss army knife of text editors wrote:
> Discovered this trying to add a path from my init file and I just could
> not make it work.
>
> 1. Create an executable script ~/test-bin/test.sh
> 2. emacs -Q
> 3. Eval the elisp snippet `(require 'eshell) (eshell/addpath "~/test-bin")`
> 4. Start eshell
> 5. test.sh
> 6. Observe command not found error
>
> Substituting `(eshell/addpath (file-truename "~/test-bin"))` gives the same
> problem.
>
> This should have the same effect as starting eshell immediately and
> executing `addpath ~/test-bin`, which has the expected result.
I can't speak to the other issues you mentioned in this bug, but I
wouldn't expect calls to any 'eshell/FOO' function to work outside of an
Eshell prompt. Many of them assume the presence of various
local/internal Eshell variables, so they wouldn't work if you called
them from a different context.
To run some Eshell command, you could use 'eshell-command' or
'eshell-command-result', as in:
(eshell-command-result "echo hi there")
=> ("hi" "there")
However, that's not useful for calling 'eshell/addpath', since Eshell
buffers have their own local 'process-environment'. You'd just be
updating PATH in a temporary Eshell buffer, and then it'd go away
immediately when the buffer is closed.
> The only workaround I've found is to modify PATH directly with setenv
> and getenv.
I think that's the best method. You could probably do it via
'eshell-mode-hook' if you wanted to change the PATH only for Eshell.
This bug report was last modified 2 years and 265 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.