]> git.eshelyaron.com Git - emacs.git/commit
Fix parsing of indices in Eshell expansions
authorJim Porter <jporterbugs@gmail.com>
Wed, 2 Mar 2022 02:36:08 +0000 (18:36 -0800)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 3 Mar 2022 13:59:33 +0000 (14:59 +0100)
commit990f36fa108092c8b93692bb80c6fbd0b6b8f391
tree726029d61639874422e89f5f1cd1be30c5aa7752
parentcccee7e840102488e01f9bb7c2220392d358f4f0
Fix parsing of indices in Eshell expansions

Previously, more-complex index expansions, like '$var[":" 0]' or
'$var[$(expr) 0]' failed to parse correctly.

* lisp/eshell/esh-var.el (Commentary): Clarify indexing and length
expansions.
(eshell-parse-indices): Expand docstring and support parsing inside
double-quotes.
(eshell-eval-indices): New function.
(eshell-parse-variable): Use it.

* test/lisp/eshell/esh-var-tests.el (eshell-test-value): New defvar.
(esh-var-test/interp-var-indices,
(esh-var-test/interp-var-split-indices)
(esh-var-test/interp-var-string-split-indices)
(esh-var-test/interp-var-regexp-split-indices)
(esh-var-test/interp-var-assoc, esh-var-test/interp-var-length-list)
(esh-var-test/interp-var-length-string)
(esh-var-test/interp-var-length-alist)
(esh-var-test/quoted-interp-var-indices)
(esh-var-test/quoted-interp-var-split-indices)
(esh-var-test/quoted-interp-var-string-split-indices)
(esh-var-test/quoted-interp-var-regexp-split-indices)
(esh-var-test/quoted-interp-var-assoc)
(esh-var-test/quoted-interp-var-length-list)
(esh-var-test/quoted-interp-var-length-string)
(esh-var-test/quoted-interp-var-length-alist): New tests.

* doc/misc/eshell.texi (Dollars Expansion): Expand and reword
documentation for indexing and length expansions.
doc/misc/eshell.texi
lisp/eshell/esh-var.el
test/lisp/eshell/esh-var-tests.el