[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#55838: 29.0.50; Eshell string-split subscript indexing splits too mu
From: |
Jim Porter |
Subject: |
bug#55838: 29.0.50; Eshell string-split subscript indexing splits too much |
Date: |
Tue, 7 Jun 2022 18:36:09 -0700 |
From "emacs -Q -f eshell":
M-: (setq foo "a\nb:c")
~ $ echo $foo
a
b:c
~ $ echo $foo[: 0]
("a" "b")
The first command is normal, and just shows that Eshell outputs the
string with no manipulation. In the second command, we split the string
on ":" and get the 0th element. However, that gets split *again* (on
newlines) and returns a list.
I think this is overly aggressive. It's due to `eshell-apply-indices'
calling `eshell-convert' on the split element(s) of the string. However,
`eshell-convert' is primarily designed to turn output from external
command line programs into a Lispy form (so it splits by line to make a
list, among other things). This would normally happen when doing
something like this:
~ $ echo ${cat some-file.txt}
("line 1" "line 2" ...)
In the original case above, I think the split-subscript operator [: 0]
should only be doing the one thing the user requested: split on ":" and
get the 0th element.
Patch forthcoming momentarily. Just getting a bug number.
- bug#55838: 29.0.50; Eshell string-split subscript indexing splits too much,
Jim Porter <=