nix-community / nix-emacs

A set of useful Emacs modes and functions for users of Nix and Nix OS.
226 stars 32 forks source link

Fix nix-executable-find #56

Open crazazy opened 3 years ago

crazazy commented 3 years ago

I found that the former version of nix-executable-find didn't work. I've tested this one and it seems to work now

svenkeidel commented 3 years ago

@crazazy, thanks for your contribution. For the record could you elaborate what went wrong and how your PR fixes it?

crazazy commented 2 years ago

I think this is how it works, but I'm not 100% sure. So in the old version, the exec-path variable didn't actually get changed within executable-find, but actually creates a new binding within the let form and within the let form only. make-local-variable changes the value of exec-path, but only in the current buffer. This means we temporarily change the value of exec-path buffer-wide instead of let-binding wide, which does affect the behavior of executable-find

Having said that, I believe there is a flaw in my implementation as well, since the variable is still affected if you don't change the buffer.