On 7/11/2022 7:47 PM, Jim Porter wrote: > Normally in Eshell, you can index variables to get the nth element, e.g. > "echo $exec-path[0]" would print the first element in your `exec-path' > variable. However, this doesn't always work for "alias" variables. From [snip] > There's also a related issue with alias variables that reference other > alias variables... The attached patches fix these issues. To help make this a bit easier to follow, the first patch just adds tests and documentation. The only code change I made was to move the '$INSIDE_EMACS' alias from em-dirs.el to esh-var.el. That's because, in theory, a person might choose not to use em-dirs.el (e.g. if they wanted their own implementation of directory handling), and it would be pretty surprising for the '$INSIDE_EMACS' variable to go away then too. The second patch fixes the behavior of alias variables pointing to other alias variables. While this is technically a change in existing behavior, I think it's what the code intended, given the pre-existing documentation for the '$+' variable. Finally, the third patch makes sure indexing works on all the alias variables. I tweaked the behavior of a couple of the alias variable functions and also added a flag to members of `eshell-variable-aliases-list' to use the "simple" behavior of passing the result to `eshell-apply-indices'.