GNU bug report logs - #54227
29.0.50; [PATCH] Inconsistencies with Eshell variable interpolation

Previous Next

Package: emacs;

Reported by: Jim Porter <jporterbugs <at> gmail.com>

Date: Thu, 3 Mar 2022 06:36:01 UTC

Severity: normal

Tags: patch

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jim Porter <jporterbugs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 54227 <at> debbugs.gnu.org
Subject: bug#54227: 29.0.50; [PATCH] Inconsistencies with Eshell variable interpolation
Date: Sat, 5 Mar 2022 12:06:00 -0800
[Message part 1 (text/plain, inline)]
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 (text/plain, attachment)]

This bug report was last modified 3 years and 137 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.