diff options
| author | Jim Porter | 2023-08-17 12:23:26 -0700 |
|---|---|---|
| committer | Jim Porter | 2023-08-21 11:42:46 -0700 |
| commit | cf52cdb121b9419f169c501e7d8499aa418a0d5c (patch) | |
| tree | 4c41447107dfd379dbeb1307046c0fb6803ac7f4 /doc/misc | |
| parent | 82d8732505d267b5152320300b3ebd1a2727bead (diff) | |
| download | emacs-cf52cdb121b9419f169c501e7d8499aa418a0d5c.tar.gz emacs-cf52cdb121b9419f169c501e7d8499aa418a0d5c.zip | |
Allow splicing Eshell globs in-place
This means that Eshell globs can now expand the same way as if the
user had typed each matching file individually.
* lisp/eshell/em-glob.el (eshell-glob-splice-results): New option.
(eshell-no-command-globbing, eshell-add-glob-modifier): Handle spliced
globs.
(eshell-extended-glob): Always return a list when splicing.
* lisp/eshell/em-pred.el (eshell-parse-arg-modifier): Ensure
'eshell-splice-args' is always at the end of the list of modifiers if
present.
* test/lisp/eshell/em-glob-tests.el
(em-glob-test/expand/splice-results)
(em-glob-test/expand/no-splice-results)
(em-glob-test/expand/explicitly-splice-results)
(em-glob-test/expand/explicitly-listify-results): New tests.
(em-glob-test/no-matches): Check result when
'eshell-glob-splice-results' is nil/non-nil.
* doc/misc/eshell.texi (Arguments): Expand explanation about argument
flattening.
(Globbing): Document splicing behavior of globs.
* etc/NEWS: Announce this change.
Diffstat (limited to 'doc/misc')
| -rw-r--r-- | doc/misc/eshell.texi | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi index 6890728a81d..59c07457158 100644 --- a/doc/misc/eshell.texi +++ b/doc/misc/eshell.texi | |||
| @@ -317,9 +317,10 @@ specify an argument of some other data type, you can use a Lisp form | |||
| 317 | (1 2 3) | 317 | (1 2 3) |
| 318 | @end example | 318 | @end example |
| 319 | 319 | ||
| 320 | Additionally, many built-in Eshell commands (@pxref{Built-ins}) will | 320 | When calling external commands (and many built-in Eshell commands, |
| 321 | flatten the arguments they receive, so passing a list as an argument | 321 | too) Eshell will flatten the arguments the command receives, so |
| 322 | will ``spread'' the elements into multiple arguments: | 322 | passing a list as an argument will ``spread'' the elements into |
| 323 | multiple arguments: | ||
| 323 | 324 | ||
| 324 | @example | 325 | @example |
| 325 | ~ $ printnl (list 1 2) 3 | 326 | ~ $ printnl (list 1 2) 3 |
| @@ -1466,18 +1467,28 @@ other arguments around it. For example, if @var{numbers} is the list | |||
| 1466 | 1467 | ||
| 1467 | @node Globbing | 1468 | @node Globbing |
| 1468 | @section Globbing | 1469 | @section Globbing |
| 1469 | @vindex eshell-glob-case-insensitive | ||
| 1470 | Eshell's globbing syntax is very similar to that of Zsh | 1470 | Eshell's globbing syntax is very similar to that of Zsh |
| 1471 | (@pxref{Filename Generation, , , zsh, The Z Shell Manual}). Users | 1471 | (@pxref{Filename Generation, , , zsh, The Z Shell Manual}). Users |
| 1472 | coming from Bash can still use Bash-style globbing, as there are no | 1472 | coming from Bash can still use Bash-style globbing, as there are no |
| 1473 | incompatibilities. | 1473 | incompatibilities. |
| 1474 | 1474 | ||
| 1475 | By default, globs are case sensitive, except on MS-DOS/MS-Windows | 1475 | @vindex eshell-glob-case-insensitive |
| 1476 | Globs are case sensitive by default, except on MS-DOS/MS-Windows | ||
| 1476 | systems. You can control this behavior via the | 1477 | systems. You can control this behavior via the |
| 1477 | @code{eshell-glob-case-insensitive} option. You can further customize | 1478 | @code{eshell-glob-case-insensitive} option. |
| 1478 | the syntax and behavior of globbing in Eshell via the Customize group | 1479 | |
| 1479 | @code{eshell-glob} (@pxref{Easy Customization, , , emacs, The GNU | 1480 | @vindex eshell-glob-splice-results |
| 1480 | Emacs Manual}). | 1481 | By default, Eshell expands the results of a glob as a sublist into the |
| 1482 | list of arguments. You can change this to splice the results in-place | ||
| 1483 | by setting @code{eshell-glob-splice-results} to a non-@code{nil} | ||
| 1484 | value. If you want to splice a glob in-place for just one use, you | ||
| 1485 | can use a subcommand form like @samp{$@@@{listify @var{my-glob}@}}. | ||
| 1486 | (Conversely, you can explicitly expand a glob as a sublist via | ||
| 1487 | @samp{$@{listify @var{my-glob}@}}.) | ||
| 1488 | |||
| 1489 | You can further customize the syntax and behavior of globbing in | ||
| 1490 | Eshell via the Customize group @code{eshell-glob} (@pxref{Easy | ||
| 1491 | Customization, , , emacs, The GNU Emacs Manual}). | ||
| 1481 | 1492 | ||
| 1482 | @table @samp | 1493 | @table @samp |
| 1483 | 1494 | ||
| @@ -2386,8 +2397,6 @@ be Eshell's job? | |||
| 2386 | This would be so that if a Lisp function calls @code{print}, everything | 2397 | This would be so that if a Lisp function calls @code{print}, everything |
| 2387 | will happen as it should (albeit slowly). | 2398 | will happen as it should (albeit slowly). |
| 2388 | 2399 | ||
| 2389 | @item If a globbing pattern returns one match, should it be a list? | ||
| 2390 | |||
| 2391 | @item Make sure syntax table is correct in Eshell mode | 2400 | @item Make sure syntax table is correct in Eshell mode |
| 2392 | 2401 | ||
| 2393 | So that @kbd{M-@key{DEL}} acts in a predictable manner, etc. | 2402 | So that @kbd{M-@key{DEL}} acts in a predictable manner, etc. |