Commit graph

8 commits

Author SHA1 Message Date
Stefan Kangas
9c0da894b9 ; Improve time-convert call in recently changed test
* test/lisp/eshell/em-pred-tests.el
(eshell-parse-file-name-attributes): Use t instead of nil as
second argument to 'time-convert'.
Suggested by Stefan Monnier <monnier@iro.umontreal.ca>.
2022-08-07 13:16:53 +02:00
Stefan Kangas
5ab557be62 ; Adjust time-convert call to recent change
* test/lisp/eshell/em-pred-tests.el
(eshell-parse-file-name-attributes): Adjust test to recent change.
2022-08-06 13:03:38 +02:00
Jim Porter
598d7c5d1c Optionally signal an error if an Eshell predicate fails to match anything
* lisp/eshell/em-pred.el (eshell-error-if-no-glob): Declare it.
(eshell-apply-modifiers): Add STRING-DESC argument and signal an error
if there are no matches and 'eshell-error-if-no-glob' is set.
(eshell-parse-arg-modifier): Pass modifier string to
'eshell-apply-modifiers'.

* test/lisp/eshell/em-pred-tests.el (eshell-eval-predicate): Simplify.
(em-pred-test/no-matches): New test.

* doc/misc/eshell.texi (Bugs and ideas): Remove todo entry about this
change.
2022-06-26 16:51:21 +02:00
Jim Porter
bb40507fed Handle escaped characters in Eshell argument predicates/modifiers
* lisp/eshell/em-pred.el (eshell-get-delimited-modifier-argument):
Unescape escaped characters.

* test/lisp/eshell/em-pred-tests.el (em-pred-test/predicate-escaping):
New test (bug#55204).
2022-05-01 20:41:21 +02:00
Jim Porter
ade1424a97 Use a common set of string delimiters for all Eshell predicates/modifiers
* lisp/eshell/em-pred.el (eshell-pred-delimiter-pairs): New variable.
(eshell-get-comparison-modifier-argument)
(eshell-get-numeric-modifier-argument)
(eshell-get-delimited-modifier-argument): New functions...
(eshell-pred-user-or-group, eshell-pred-file-time)
(eshell-pred-file-links, eshell-pred-file-size)
(eshell-pred-substitute, eshell-join-memebers, eshell-split-members):
... and use them here.
(eshell-include-members): Pass 'mod-char' and use
'eshell-get-delimited-modifier-argument'.
(eshell-pred-file-type, eshell-pred-file-mode): Use 'when-let'.
(eshell-modifier-alist): Pass modifier char to
'eshell-include-members'.

* test/lisp/eshell/em-pred-tests.el
(em-pred-test/predicate-delimiters): New test.
(em-pred-test/predicate-uid, em-pred-test/predicate-gid,
em-pred-test/modifier-include, em-pred-test/modifier-exclude): Remove
cases covered by 'em-pred-test/predicate-delimiters'.
(em-pred-test/modifier-substitute): Add test cases for new delimiter
styles.

* doc/misc/eshell.texi (Argument Predication and Modification):
Explain how string parameters are delimited.
(Argument Modifiers): Document some special delimiter behavior with
the 's/PATTERN/REPLACE/' modifier (bug#55204).

* etc/NEWS: Announce this change, and move the
'eshell-eval-using-options' entry to the Eshell section.
2022-05-01 20:41:18 +02:00
Jim Porter
1dd8a00325 Fix Eshell predicate tests when running from 'make check'
* test/lisp/eshell/em-pred-tests.el (eshell-partial-let-func): Get
original function after macro-expansion.
2022-04-17 21:51:17 +02:00
Jim Porter
3dc73569b4 Add 'G' argument predicate in Eshell
* lisp/eshell/em-pred.el (eshell-predicate-alist): Add 'G' predicate.
(eshell-predicate-help-string): Document it.  (Bug#54470)

* test/lisp/eshell/em-pred-tests.el
(em-pred-test/predicate-effective-gid): New test.

* doc/misc/eshell.text (Argument Predication): Document 'G' predicate.
2022-04-17 10:29:07 +03:00
Jim Porter
6358cbc21a Add unit tests and documentation for Eshell predicates/modifiers
* lisp/eshell/esh-cmd.el (eshell-eval-argument): New function.
* lisp/eshell/esh-util.el (eshell-file-attributes): Pass original
value of FILE to 'file-attributes'.
* lisp/eshell/em-pred.el (eshell-predicate-alist): Change socket char
to '=', since 's' conflicts with setuid.
(eshell-modifier-alist): Fix 'E' (eval) modifier by using
'eshell-eval-argument'.  Also improve performance of 'O' (reversed
sort) modifier.
(eshell-modifier-help-string): Fix documentation of global
substitution modifier.
(eshell-pred-substitute): Fix infinite loop in some global
substitutions.
(eshell-join-members): Fix joining with implicit " " delimiter.
(Bug#54470)

* test/lisp/eshell/em-pred-tests.el: New file.

* doc/misc/eshell.texi (Argument Predication): New section.
2022-04-17 10:28:23 +03:00