From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#55838: 29.0.50; [PATCH] Eshell string-split subscript indexing splits too much Date: Wed, 08 Jun 2022 16:38:59 +0300 Message-ID: <83edzz5l70.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18709"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 55838@debbugs.gnu.org To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 08 15:40:23 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nyvv4-0004ml-SP for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Jun 2022 15:40:22 +0200 Original-Received: from localhost ([::1]:33610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyvv3-0001kV-TU for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Jun 2022 09:40:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyvuk-0001kK-Jv for bug-gnu-emacs@gnu.org; Wed, 08 Jun 2022 09:40:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48888) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyvuk-0001hV-9E for bug-gnu-emacs@gnu.org; Wed, 08 Jun 2022 09:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nyvuk-0001kM-3S for bug-gnu-emacs@gnu.org; Wed, 08 Jun 2022 09:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Jun 2022 13:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55838 X-GNU-PR-Package: emacs Original-Received: via spool by 55838-submit@debbugs.gnu.org id=B55838.16546955556653 (code B ref 55838); Wed, 08 Jun 2022 13:40:02 +0000 Original-Received: (at 55838) by debbugs.gnu.org; 8 Jun 2022 13:39:15 +0000 Original-Received: from localhost ([127.0.0.1]:42785 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyvty-0001jE-QO for submit@debbugs.gnu.org; Wed, 08 Jun 2022 09:39:15 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59812) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyvtw-0001iz-JT for 55838@debbugs.gnu.org; Wed, 08 Jun 2022 09:39:12 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:33030) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyvtq-0001cb-RO; Wed, 08 Jun 2022 09:39:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=zSDxVOLpOAnEt1Ystcf9vehYiS92iIAlF9SfL3SKoYg=; b=b54XKFfUSX5j 5SHuKhFdwGNF86gDEUIaChC9MngyOy5Eo7gSyuWR9ErsnTM0a2+7wHGNNQv5h+uxX3mfFKibu+eYO DZQ7C79XnbNW+ygYHh3dFnsZayxc4vD6ZDF6EShO9OQHgbtuznd6J2RMeGI17bJb3OpHvwlw3X2RL WsQjUNob/szMCGb4lknvFzowSq9Q92eS4x6ia6Jge2pXlT94w4ltQLtlxQSd3isnsLk9MMHj2/tdy YWHqJ+0CRwDMN+r68BF+rzFD0kCNN2tgzMHyF8azkTykLfnhIRhxK6Q1jRMIurOD9tmAYVb3tYu5Z 61vmS/UL5CHLPClU31SYrQ==; Original-Received: from [87.69.77.57] (port=2108 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyvtq-0005rI-4B; Wed, 08 Jun 2022 09:39:06 -0400 In-Reply-To: (message from Jim Porter on Tue, 7 Jun 2022 18:41:30 -0700) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:233973 Archived-At: > From: Jim Porter > Date: Tue, 7 Jun 2022 18:41:30 -0700 > > > 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. > > Here's a patch for this. It changes the behavior of > `eshell-apply-indices' to use `eshell-convert-to-number' (when the > expansion isn't wrapped in double-quotes) instead of the more-aggressive > `eshell-convert'. I think `eshell-convert-to-number' is the right thing > here, since Eshell already converts number-like strings to actual > numbers in most cases. > > As a note, if you wanted the old behavior, you could do something like this: > > ~ $ echo $foo[: 0][0 1] > ("a" "b") > > There's also a suggestion in the "Bugs and ideas" section of the Eshell > manual to add "*" as a subscript to mean "all indices", so you could do > the above in a more generic fashion like: > > ~ $ echo $foo[: 0][*] > ;; Doesn't currently work, but it could. I don't have any objections based on actual experience, and I don't know what was the original design goals of this feature in Eshell. However, please note that you are changing the behavior significantly, and the only reason is that it doesn't make much sense to you. I wonder whether this is a strong enough motivation to make such incompatible behavior changes. Eshell is not a "normal" shell, in that it attempts to make sense even if Lisp expressions are mixed with Posix-ish shell features, so what may not make sense in Bash, Zsh, and their ilk is not necessarily nonsensical in Eshell. So maybe we should raise the bar for considering reasons for behavior changes as valid?