bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#57556: 28.1; Eshell not finding executables in PATH when tramp-integ


From: Jim Porter
Subject: bug#57556: 28.1; Eshell not finding executables in PATH when tramp-integration loaded
Date: Thu, 29 Sep 2022 20:54:43 -0700

On 9/22/2022 10:55 AM, Michael Albinus wrote:
There will be another patch by Jim. But this is for Emacs 29 only I
guess, and it will override this change then w/o regression.

It took a lot longer than anticipated, but here's a patch series to give Eshell full support for a Tramp-aware $PATH. This ended up considerably more elaborate than intended, mostly because of patch #3.

If people prefer, I could file a separate bug # for this set of changes, but I thought it would be better to track it here.

Here's a brief summary of everything I changed, and my reasoning. I'm still thinking about some of the changes myself, but I think this is complete enough for others to take a look at and provide feedback if they want.

Patch #2: Obsolete 'eshell/define'
----------------------------------------

I'm pretty sure this function never worked, since it adds Eshell variable aliases in a form that the rest of the code can't handle. If I'm wrong about this and someone can show how it should work, I'm happy to get rid of this patch and replace it with any fixes necessitated by my other patches.

Patch #3: Allow setting variable aliases
----------------------------------------

Since the plan is to make $PATH into a variable alias so that Eshell can do the right thing when changing directories to a different host, I wanted to be sure users can *set* variable aliases so that updating $PATH will be easy. This adds the ability to do that, along with a new "set" command in Eshell. That lets you set either environment variables or Lisp variables (note that "#'" is just Eshell's way of spelling "'", since a single-quote is used for literal strings in Eshell):

  set ENV_VAR value
  set #'lisp-var value

I debated on the name, since people might think it's more like Bash's "set" than Lisp's "set", but Eshell already has "setq", so I think "set" makes sense.

However, you can set these in other ways too:

  export ENV_VAR=value
  setq lisp-var value

Really, the "set" function is probably optional, but it seemed more convenient to me when I was trying these patches out, and I think it's a nice middle ground between Lispiness and sh-ness.

Patch #4: Make $PATH a variable alias
----------------------------------------

This stores the $PATH in an alist indexed by host, similar to 'grep-host-defaults-alist'. For consistency, it now derives its value from '(exec-path)' everywhere (formerly, it used '(getenv "PATH") for local hosts and '(exec-path)' for Tramp).

This is likely an incompatible change for some users if they call (setenv "PATH" "foobar") in their init scripts, but it's easy enough to fix: just make the corresponding changes to 'exec-path' too. That said, if people think compatibility is more important, I could change this to use '(getenv "PATH")' for local directories.

These changes would probably be good to test on MS-Windows as well, since MS-Windows uses a different path-separator, so the code has to be pretty careful to use the right separator for the right system. I don't have Emacs builds set up on an MS-Windows system at the moment (though I've been meaning to).

Attachment: 0001-Allow-ignoring-errors-when-calling-eshell-match-comm.patch
Description: Text document

Attachment: 0002-Obsolete-eshell-define.patch
Description: Text document

Attachment: 0003-Allow-setting-the-values-of-variable-aliases-in-Eshe.patch
Description: Text document

Attachment: 0004-Improve-handling-of-PATH-in-Eshell-for-remote-direct.patch
Description: Text document

Attachment: 0005-Print-the-correct-PATH-when-Eshell-s-which-fails-to-.patch
Description: Text document


reply via email to

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