unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#55838: 29.0.50; Eshell string-split subscript indexing splits too much
@ 2022-06-08  1:36 Jim Porter
  2022-06-08  1:41 ` bug#55838: 29.0.50; [PATCH] " Jim Porter
  0 siblings, 1 reply; 5+ messages in thread
From: Jim Porter @ 2022-06-08  1:36 UTC (permalink / raw)
  To: 55838

 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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-06-08 23:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08  1:36 bug#55838: 29.0.50; Eshell string-split subscript indexing splits too much Jim Porter
2022-06-08  1:41 ` bug#55838: 29.0.50; [PATCH] " Jim Porter
2022-06-08 12:11   ` bug#55838: 29.0.50; " Lars Ingebrigtsen
2022-06-08 13:38   ` bug#55838: 29.0.50; [PATCH] " Eli Zaretskii
2022-06-08 23:06     ` Jim Porter

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).