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#59960: 30.0.50; Eshell's $* variable (used to define aliases) doesn't work as expected Date: Sun, 11 Dec 2022 10:04:22 +0200 Message-ID: <83fsdmv01l.fsf@gnu.org> References: <9d1df9de-5ecc-0499-de5f-28d34f6a821d@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="996"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59960@debbugs.gnu.org To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 11 09:05:22 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 1p4HKs-000Aar-56 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 11 Dec 2022 09:05:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p4HKb-0001Zg-Ad; Sun, 11 Dec 2022 03:05:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p4HKY-0001TM-Lv for bug-gnu-emacs@gnu.org; Sun, 11 Dec 2022 03:05:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p4HKY-00010f-1e for bug-gnu-emacs@gnu.org; Sun, 11 Dec 2022 03:05:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p4HKX-0006dV-KA for bug-gnu-emacs@gnu.org; Sun, 11 Dec 2022 03:05:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 11 Dec 2022 08:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59960 X-GNU-PR-Package: emacs Original-Received: via spool by 59960-submit@debbugs.gnu.org id=B59960.167074587325495 (code B ref 59960); Sun, 11 Dec 2022 08:05:01 +0000 Original-Received: (at 59960) by debbugs.gnu.org; 11 Dec 2022 08:04:33 +0000 Original-Received: from localhost ([127.0.0.1]:46194 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4HK5-0006d9-3d for submit@debbugs.gnu.org; Sun, 11 Dec 2022 03:04:33 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54432) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4HK1-0006d3-PY for 59960@debbugs.gnu.org; Sun, 11 Dec 2022 03:04:32 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p4HJw-0005PH-BI; Sun, 11 Dec 2022 03:04:24 -0500 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=OciUkNSpdpWiZwmgAw87p7+k4j/cSN9YDNOhD3OuRrM=; b=AktO2J9TFaOF IY3NL3e2Nf3XKwkPKOJ1c8NnrAzH9vOgE2YdCgaQwkhHemG0/YaeWgl5aRMupLuHTt0VGeHag3huW RF0PqOi/ORaFk/RYhJlH4/RmvCPFN9r1maiQ+/YP6pOqko9TKkThtTYTaqXgvPUdanQ5CL9kvpqNR bF6Mrqkj0PozyJpjwQ/LqoO+6jD8CrP9arvZAsaQzJeRcmk9kOT1TLHYHOParTCCm539yvDC9j34v nodzDl+5BUXTsCHoZLn4bP2IwiztcylX023U0tBhSYPc86sAN7XskJ68g3EgzotdeipWW583euRZ2 MmxR+o5BZ8uJb0Nui3hjNw==; Original-Received: from [87.69.77.57] (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 1p4HJv-0002pK-Pc; Sun, 11 Dec 2022 03:04:24 -0500 In-Reply-To: <9d1df9de-5ecc-0499-de5f-28d34f6a821d@gmail.com> (message from Jim Porter on Sat, 10 Dec 2022 22:13:39 -0800) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:250580 Archived-At: > Date: Sat, 10 Dec 2022 22:13:39 -0800 > From: Jim Porter > > This bug report originally comes from a Reddit post[1] where a user > found that aliasing the Eshell built-in "mv" and "cp" commands didn't > work properly. I'll show a slightly simpler example though. Starting > from "emacs -Q -f eshell": > > ~ $ alias my-echo "echo A $* Z" > ~ $ my-echo b c d > ("A" > ("b" "c" "d") > "Z") > > ~ $ echo A b c d Z > ("A" "b" "c" "d" "Z") > > As you can see above, the "$*" special variable inserts the list of > arguments passed to the alias *as a sublist*. That might be what you > want sometimes, but more likely, you'd want to insert the arguments > in-place, like with ",@" in Emacs Lisp backquote forms. (Note: for > external processes, this isn't an issue because Eshell flattens all the > arguments to external commands.) > > Attached is a draft patch to fix this. It adds a new "$@expr" variable > expansion to Eshell which lets you splice a list in-place: > > ~ $ alias my-echo 'echo A $@* Z' > ~ $ my-echo b c d > ("A" "b" "c" "d" "Z") > > Currently, this only works in simple situations like the above. It > should work for any variable, but likely won't work with Eshell for > loops, inside double quotes, etc. It would be nice to get this working > in a wider variety of places in Eshell command forms before merging. > Still, even what's here is already pretty useful, I think. I'm posting > this now mainly to get feedback on whether this is the right direction > to go in the first place. AFAICT, the fact that $* produces a sub-list is not mentioned in the documentation part of the patch. I think it should, if only to explain why a special expansion is needed.