bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59960: 30.0.50; Eshell's $* variable (used to define aliases) doesn'


From: Jim Porter
Subject: bug#59960: 30.0.50; Eshell's $* variable (used to define aliases) doesn't work as expected
Date: Sun, 11 Dec 2022 20:36:13 -0800

On 12/11/2022 12:04 AM, Eli Zaretskii wrote:
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.

Ok, I've expanded the documentation here to (hopefully) make things clearer. I've also added support for a wider variety of places where the splice operator works. In addition to simple scenarios like this:

  ~ $ setq var (list 1 2 3)
  ~ $ echo var is $var
  ("var" "is"
   (1 2 3))
  ~ $ echo var is $@var
  ("var" "is" 1 2 3)

You can now use it inside double-quotes:

  ~ $ echo "var is $var"
  var is (1 2 3)
  ~ $ echo "var is $@var"
  var is 1 2 3

The general rule is that "$@var" should work as though you typed "$var[0] $var[1] ... $var[N]". That means this works too:

  ~ $ echo var is A$@var
  ("var" "is" "A1" 2 3)

(This last one probably isn't very practical, but it obeys the general rule I mentioned above.)

I'm sure there are other places the splice operator might be nice to have (e.g. for loops), but the above covers common places this might get used, and it shouldn't be too difficult to add support in other places if there's demand.

Attachment: 0001-Support-completion-of-variables-with-the-length-oper.patch
Description: Text document

Attachment: 0002-Add-support-for-the-splice-operator-in-Eshell.patch
Description: Text document

Attachment: 0003-Rename-eshell-flatten-args-token-to-eshell-splice-im.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]