all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#26055: 25.1; Eshell dollar expansion $var[i] not working
@ 2017-03-11  9:35 Chunyang Xu
  2017-03-14  4:03 ` npostavs
  0 siblings, 1 reply; 4+ messages in thread
From: Chunyang Xu @ 2017-03-11  9:35 UTC (permalink / raw)
  To: 26055


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
~ $







^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-17  4:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-11  9:35 bug#26055: 25.1; Eshell dollar expansion $var[i] not working Chunyang Xu
2017-03-14  4:03 ` npostavs
2017-06-10  0:33   ` npostavs
2017-06-17  4:17     ` npostavs

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.