unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: 55838@debbugs.gnu.org
Subject: bug#55838: 29.0.50; Eshell string-split subscript indexing splits too much
Date: Tue, 7 Jun 2022 18:36:09 -0700	[thread overview]
Message-ID: <fa5d20e3-b9eb-35c0-51c7-a2cc103470ef@gmail.com> (raw)

 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.





             reply	other threads:[~2022-06-08  1:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08  1:36 Jim Porter [this message]
2022-06-08  1:41 ` bug#55838: 29.0.50; [PATCH] Eshell string-split subscript indexing splits too much 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fa5d20e3-b9eb-35c0-51c7-a2cc103470ef@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=55838@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).