[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#54227: 29.0.50; [PATCH] Inconsistencies with Eshell variable interpo
From: |
Jim Porter |
Subject: |
bug#54227: 29.0.50; [PATCH] Inconsistencies with Eshell variable interpolation |
Date: |
Sat, 5 Mar 2022 12:06:00 -0800 |
On 3/3/2022 11:50 AM, Eli Zaretskii wrote:
Thanks, this now LGTM.
Thanks.
I found one more issue with the code though: the subscript operator
doesn't work on subcommands. For example, from "emacs -Q --eval '(eshell)'":
~ $ echo ${*echo -e "hi\nbye"}[0]
("hi" "bye")
Since `${COMMAND}' forms split the output line-by-line, you'd expect
this to say "hi", but the subscript operator is a no-op in this case.
This was previously documented to work in the docstring for
`eshell-apply-indices':
For example, to retrieve the second element of a user's record in
'/etc/passwd', the variable reference would look like:
${grep johnw /etc/passwd}[: 2]
I also updated the manual to indicate that this is possible (though I
didn't provide any direct examples), since I thought this already worked
based on that docstring.
Attached is a patch with some tests for this.
Just a note: using subscript on `$<COMMAND>' forms is probably not
super-useful (at least not currently), though I added support for it
anyway for consistency and future improvement. Since the result of that
form is the name of a temp file, there's not much reason to do something
like `$<COMMAND>[0]'. However in the future, if the subscript operator
were more advanced, you could do something like `$<COMMAND>[/ *]' to
split the file name by directory separators. (The "*" is a suggested
feature in the "Bugs and ideas" section to return the whole list.)
0001-Support-applying-indices-to-more-Eshell-dollar-expan.patch
Description: Text document
- bug#54227: 29.0.50; [PATCH] Inconsistencies with Eshell variable interpolation, Jim Porter, 2022/03/03
- bug#54227: 29.0.50; [PATCH] Inconsistencies with Eshell variable interpolation, Lars Ingebrigtsen, 2022/03/03
- bug#54227: 29.0.50; [PATCH] Inconsistencies with Eshell variable interpolation, Eli Zaretskii, 2022/03/03
- bug#54227: 29.0.50; [PATCH] Inconsistencies with Eshell variable interpolation, Eli Zaretskii, 2022/03/03
- bug#54227: 29.0.50; [PATCH] Inconsistencies with Eshell variable interpolation, Jim Porter, 2022/03/03
- bug#54227: 29.0.50; [PATCH] Inconsistencies with Eshell variable interpolation, Eli Zaretskii, 2022/03/03
- bug#54227: 29.0.50; [PATCH] Inconsistencies with Eshell variable interpolation, Jim Porter, 2022/03/03
- bug#54227: 29.0.50; [PATCH] Inconsistencies with Eshell variable interpolation, Eli Zaretskii, 2022/03/03
- bug#54227: 29.0.50; [PATCH] Inconsistencies with Eshell variable interpolation,
Jim Porter <=
- bug#54227: 29.0.50; [PATCH] Inconsistencies with Eshell variable interpolation, Jim Porter, 2022/03/05
- bug#54227: 29.0.50; [PATCH] Inconsistencies with Eshell variable interpolation, Eli Zaretskii, 2022/03/07
- bug#54227: 29.0.50; [PATCH] Inconsistencies with Eshell variable interpolation, Jim Porter, 2022/03/07
- bug#54227: 29.0.50; [PATCH] Inconsistencies with Eshell variable interpolation, Eli Zaretskii, 2022/03/08