Open krader1961 opened 3 years ago
Obviously there are details that need discussion. Such as what to report for the output of set &where
when the environment variable was inherited and not explicitly set by Elvish. The output for that case should probably be something like "inherited" (without a line number).
A user recently asked on IM why they were getting this error even though up until recently their Elvish shell had no trouble finding the volta
external command:
Exception: exec: "volta": executable file not found in $PATH
It turned out they had modified their ~/.config/elvish/rc.elv to include this line:
set paths = [/opts/bin /bin /usr/bin]
They figured it out, with hints from me, but it would have been easier to resolve the issue if there were a way to report where the var had most recently been set.
There was a recent question on Gitter/IM about how to track where an env var was last set. The execution tracing change I'm working on will provide one way to answer that question. For example, consider if ~/.x.elv contains these lines:
Then this is what tracing the execution of that script would output:
However, it would be nice if Elvish supported something like ViM's tracking where vars are set so that the information could be directly queried as in this example:
Tracking where each var is set is (relatively) straightforward. The question is how to expose that information. One possibility is to leverage the recently introduced
set
command by adding an option that would output that information. Something like this hypothetical example (building on the previous ~/x.elv script):