]> git.eshelyaron.com Git - emacs.git/commit
Add support for negative indices and index ranges in Eshell
authorJim Porter <jporterbugs@gmail.com>
Fri, 20 Jan 2023 21:54:20 +0000 (13:54 -0800)
committerJim Porter <jporterbugs@gmail.com>
Sat, 28 Jan 2023 02:03:10 +0000 (18:03 -0800)
commitdabe0b7d40778496ecb308f54999248ea286d89b
treea51119134da0ea2332b82d94bb3d8401252d530c
parent4287d56bad5201cf0946526bb0e27c17426bd969
Add support for negative indices and index ranges in Eshell

* lisp/eshell/esh-util.el (eshell-integer-regexp): New defvar.

* lisp/eshell/esh-var.el (eshell-parse-indices): Expand docstring.
(eshell-parse-index): New function.
(eshell-apply-indices): Use 'eshell-parse-index' to determine whether
to treat the first index as a regexp.  Simplify the implementation a
bit.
(eshell-index-range): New pcase macro...
(eshell-index-value): ... use it, and restructure the implementation.

* test/lisp/eshell/esh-var-tests.el (esh-var-test/interp-var-indices):
New function...
(esh-var-test/interp-var-indices/list)
(esh-var-test/interp-var-indices/vector)
(esh-var-test/interp-var-indices/ring)
(esh-var-test/interp-var-indices/split): ... use it.
(esh-var-test/interp-var-string-split-indices)
(esh-var-test/interp-var-regexp-split-indices)
(esh-var-test/interp-var-assoc): Expand tests to cover things that
look like numbers or ranges, but aren't.

* doc/misc/eshell.texi (Variables): Describe how to get all arguments
of the last command.
(Dollars Expansion): Explain negative indices and index ranges.
(Bugs and ideas): Remove now-implemented ideas.

* etc/NEWS: Announce this change.
doc/misc/eshell.texi
etc/NEWS
lisp/eshell/esh-util.el
lisp/eshell/esh-var.el
test/lisp/eshell/esh-var-tests.el