GNU bug report logs - #26055
25.1; Eshell dollar expansion $var[i] not working

Previous Next

Package: emacs;

Reported by: Chunyang Xu <mail <at> xuchunyang.me>

Date: Sat, 11 Mar 2017 09:36:02 UTC

Severity: minor

Tags: confirmed, fixed, patch

Found in version 25.1

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Chunyang Xu <mail <at> xuchunyang.me>
To: 26055 <at> debbugs.gnu.org
Subject: bug#26055: 25.1; Eshell dollar expansion $var[i] not working
Date: Sat, 11 Mar 2017 17:35:05 +0800
I execute the following commands in Eshell

~ $ setq l (quote (a b c))
(a b c)
~ $ echo $l[1]
~ $ nth 1 $l
b
~ $

I expect 'echo $l[1]' should print 'b'

~ $ setq s 'foo bar baz'
foo bar baz
~ $ echo $s[1]
~ $ nth 1 (split-string s)
bar
~ $ 

and 'echo $s[1]' should print 'bar' because in
(info "(eshell) Dollars Expansion") it says

‘$var[i]’
     Expands to the ‘i’th element of the value bound to ‘var’.  If the
     value is a string, it will be split at whitespace to make it a
     list.  Again, raises an error if the value is not a sequence.

Do I misunderstand this? Besides, the manual also says

‘$var[hello]’
     Calls ‘assoc’ on ‘var’ with ‘"hello"’, expecting it to be an alist
     (*note Association Lists: (elisp)Association List Type.).

it looks like to me they are using the same syntax, if so, how can
Eshell know which is which?

~ $ setq al (quote (("1" . one) ("2" . two)))
(("1" . one)
 ("2" . two))
~ $ echo $al[1]
one
~ $






This bug report was last modified 7 years and 337 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.