summaryrefslogtreecommitdiff
path: root/test/lisp/eshell
Commit message (Collapse)AuthorAgeFilesLines
* ; Add 2024 to copyright yearsPo Lu2024-01-0220-20/+20
|
* Fix remote path setting in EshellJim Porter2023-09-071-0/+15
| | | | | | | | | | | | This ensures that we supply Tramp with the local PATH so that it can do its job of starting the local "ssh", or whatever the method uses (bug#65551). * lisp/eshell/esh-proc.el (eshell-gather-process-output): Add special handling for remote processes. * test/lisp/eshell/esh-proc-tests.el (esh-var-test/remote/remote-path): New test.
* Don't add an extraneous slash in remote PATH list in EshellJim Porter2023-08-271-0/+30
| | | | | | | | | | | | | Previously, in a remote directory, '(eshell-get-path)' would return a list of strings like "/ssh:localhost://usr/bin". While that shouldn't break most things, it's not strictly correct either. See bug#65551. * lisp/eshell/esh-util.el (eshell-get-path): Use 'concat' instead of 'file-name-concat'. * test/lisp/eshell/esh-util-tests.el: Require 'tramp' and 'eshell-tests-helpers'. (esh-util-test/path/get, eshell-util-test/path/get-remote): New tests.
* ; Make sure 'eshell-command' tests don't prompt the userJim Porter2023-04-011-0/+4
| | | | | | | * test/lisp/eshell/eshell-tests.el (eshell-test/eshell-command/background) (eshell-test/eshell-command/background-pipeline): Wait for the process to finish.
* ; Fix last changeEli Zaretskii2023-04-011-1/+1
| | | | | * test/lisp/eshell/eshell-tests.el (eshell-test/eshell-command/background-pipeline): Fix last change.
* Fix new Eshell tests on MS-WindowsEli Zaretskii2023-04-011-2/+2
| | | | | | * test/lisp/eshell/eshell-tests.el (eshell-test/eshell-command/background) (eshell-test/eshell-command/background-pipeline): Allow for ".exe" in the program's name. This fixes these tests on MS-Windows.
* Fix using background commands in 'eshell-command'Jim Porter2023-03-311-0/+47
| | | | | | | | | | | | | | Do not merge to master. This regressed due to the patch for bug#53715, which changed how Eshell pipelines return the processes in the pipeline (bug#62556). * lisp/eshell/esh-cmd.el (eshell-eval-command): Allow process-pairs. * test/lisp/eshell/eshell-tests.el (eshell-test/eshell-command/simple) (eshell-test/eshell-command/pipeline) (eshell-test/eshell-command/background) (eshell-test/eshell-command/background-pipeline): New tests.
* Don't try to make a pipe process for remote processes in EshellJim Porter2023-01-231-0/+13
| | | | | | | | | | | Tramp currently isn't able to handle this, so the result will just produce an error (bug#61024). * lisp/eshell/esh-proc.el (eshell-gather-process-output): Check for a remote 'default-directory' before trying to make a pipe process. * test/lisp/eshell/esh-proc-tests.el (esh-var-test/output/remote-redirect): New test.
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-0120-20/+20
|
* Treat escaped newlines in Eshell as the empty stringJim Porter2022-12-072-31/+105
| | | | | | | | | | | | | | | | | | | | | | | | | This fixes a regression introduced during Emacs 29's development. * lisp/eshell/esh-arg.el (eshell-parse-argument): Handle 'eshell-empty-token' as the result of an argument-parsing hook. (eshell-parse-argument-hook): Document 'eshell-empty-token'. (eshell-parse-backslash): Return 'eshell-empty-token' when encountering an escaped newline. * test/lisp/eshell/eshell-tests.el (eshell-test/escape-nonspecial) (eshell-test/escape-nonspecial-unicode) (eshell-test/escape-nonspecial-quoted) (eshell-test/escape-special-quoted): Move from here... * test/lisp/eshell/esh-arg-tests.el (esh-arg-test/escape/nonspecial) (esh-arg-test/escape/nonspecial-unicode) (esh-arg-test/escape-quoted/nonspecial) (esh-arg-test/escape-quoted/special): ... to here. (esh-arg-test/escape/special, esh-arg-test/escape/newline) (esh-arg-test/escape-quoted/newline): New tests. * doc/misc/eshell.texi (Arguments): Explain escaping logic in more detail (bug#59622).
* ; * test/lisp/eshell/esh-var-tests.el: Fix incorrect paren placement.Jim Porter2022-11-251-2/+2
|
* Fix failing eshell alias testsStefan Kangas2022-11-061-9/+11
| | | | | * test/lisp/eshell/esh-var-tests.el (esh-var-test/alias/function) (esh-var-test/alias/symbol-pair): Fix tests. (Bug#59062)
* Add the "doas" alias to eshell.Brian Cully2022-11-051-0/+75
| | | | | | | | | | | | | * lisp/eshell/em-tramp.el (eshell/doas): new function. (eshell--method-wrap-directory): new function. (eshell/sudo): accept '-s'/'--shell' for interactive use. * test/lisp/eshell/em-tramp-tests.el (em-tramp-test/sudo-shell) (em-tramp-test/sudo-user-shell) (em-tramp-test/doas-basic) (em-tramp-test/doas-user) (em-tramp-test/doas-shell) (em-tramp-test/doas-user-shell): new tests. * etc/NEWS: mention new 'doas' eshell command. * doc/misc/eshell.texi: add 'doas' command documentation.
* Only strip newlines when stringifying a value for EshellJim Porter2022-11-031-0/+57
| | | | | | | | * lisp/eshell/esh-util.el (eshell-stringify): Use 'string-trim-right' instead of stripping the last character of the result of 'pp-to-string' (bug#58810). * test/lisp/eshell/esh-util-tests.el: New file.
* Improve handling of $PATH in Eshell for remote directoriesJim Porter2022-10-173-7/+161
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-util.el (eshell-path-env, eshell-parse-colon-path): Make obsolete. (eshell-path-env-list): New variable. (eshell-connection-default-profile): New connection-local profile. (eshell-get-path): Reimplement using 'eshell-path-env-list'; add LITERAL-P argument. (eshell-set-path): New function. * lisp/eshell/esh-var.el (eshell-variable-aliases-list): Add entry for $PATH. (eshell-var-initialize): Add 'eshell-path-env-list' to 'eshell-subcommand-bindings'. * lisp/eshell/esh-ext.el (eshell-search-path): Use 'file-name-concat' instead of 'concat'. (eshell/addpath): Use 'eshell-get-path' and 'eshell-set-path'. * lisp/net/tramp-integration.el: Only apply Eshell hooks when 'eshell-path-env-list' is unbound. * test/lisp/eshell/esh-var-tests.el (esh-var-test/path-var/local-directory) (esh-var-test/path-var/remote-directory, esh-var-test/path-var/set) (esh-var-test/path-var/set-locally) (esh-var-test/path-var-preserve-across-hosts): New tests. * test/lisp/eshell/esh-ext-tests.el: New file. * test/lisp/eshell/eshell-tests-helpers.el (with-temp-eshell): Set 'eshell-last-dir-ring-file-name' to nil. (eshell-tests-remote-accessible-p, eshell-last-input) (eshell-last-output): New functions. (eshell-match-output, eshell-match-output--explainer): Use 'eshell-last-input' and 'eshell-last-output'. * doc/misc/eshell.texi (Variables): Document $PATH. * etc/NEWS: Announce this change (bug#57556).
* Allow setting the values of variable aliases in EshellJim Porter2022-10-171-0/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes commands like "COLUMNS=40 some-command" work as expected. * lisp/eshell/esh-cmd.el (eshell-subcommand-bindings): Remove 'process-environment' from here... * lisp/eshell/esh-var.el (eshell-var-initialize): ... and add to here, along with 'eshell-variable-aliases-list'. (eshell-inside-emacs): Convert to a 'defvar-local' to make it settable in a particular Eshell buffer. (eshell-variable-aliases-list): Make $?, $$, and $* read-only and update docstring. (eshell-set-variable): New function... (eshell-handle-local-variables, eshell/export, eshell/unset): ... use it. (eshell/set, pcomplete/eshell-mode/set): New functions. (eshell-get-variable): Get the variable alias's getter function when appropriate and use a safer method for checking function arity. * test/lisp/eshell/esh-var-tests.el (esh-var-test/set/env-var) (esh-var-test/set/symbol, esh-var-test/unset/env-var) (esh-var-test/unset/symbol, esh-var-test/setq, esh-var-test/export) (esh-var-test/local-variables, esh-var-test/alias/function) (esh-var-test/alias/function-pair, esh-var-test/alias/string) (esh-var-test/alias/string/prefer-lisp, esh-var-test/alias/symbol) (esh-var-test/alias/symbol-pair, esh-var-test/alias/export) (esh-var-test/alias/local-variables): New tests. * doc/misc/eshell.texi (Built-ins): Add 'set' and update 'unset' documentation. (Variables): Expand documentation of how to get/set variables.
* ; Allow ignoring errors when calling 'eshell-match-command-output'Jim Porter2022-10-172-12/+16
| | | | | | | | | | | * test/lisp/eshell/eshell-tests-helpers.el (eshell-match-command-output): New argument IGNORE-ERRORS. * test/lisp/eshell/esh-var-tests.el (esh-var-test/last-status-var-lisp-command) (esh-var-test/last-status-var-lisp-form) (esh-var-test/last-status-var-lisp-form-2): Ignore errors when calling 'eshell-match-command-output'.
* Allow using a symbol as an index into an alist in EshellJim Porter2022-09-141-4/+8
| | | | | | | | | * lisp/eshell/esh-var.el (eshell-index-value): If INDEX is a symbol, use 'assoc' for indexing. * test/lisp/eshell/esh-var-tests.el (esh-var-test/interp-var-assoc) (esh-var-test/quoted-interp-var-assoc): Add checks for indexing via symbol (bug#57787).
* ; Fix a race condition in an Eshell testJim Porter2022-09-081-2/+4
| | | | | | * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/sigpipe-exits-process): Use "|&" when creating the pipeline to prevent an extra pipe process from being started.
* Let external Eshell processes send stdout and stderr to different placesJim Porter2022-09-041-0/+30
| | | | | | | | | | | | | * lisp/eshell/esh-proc.el (eshell-put-process-properties): Pass INDEX. (eshell-gather-process-output): Create a pipe process for stderr when stderr goes somewhere different than stdout. (eshell-insertion-filter, eshell-sentinel): Consult ':eshell-handle-index' property. * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/output/stdout-to-buffer) (esh-proc-test/output/stderr-to-buffer) (esh-proc-test/exit-status/with-stderr-pipe): New tests (bug#21605).
* Put Eshell's bookkeeping data for external processes on the process objectJim Porter2022-09-041-12/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | This allows tracking this information for process objects not recorded in 'eshell-process-list', which will be useful for pipe processes for stderr output. * lisp/eshell/esh-proc.el (eshell-process-list): Add docstring. (eshell-record-process-object): Only record the process object and whether it's a subjob. (eshell-remove-process-entry): Adapt to changes in 'eshell-record-process-object'. (eshell-record-process-properties): New function... (eshell-gather-process-output): ... call it. (eshell-insertion-filter, eshell-sentinel): Use new process properties, don't require process to be in 'eshell-process-list'. * test/lisp/eshell/esh-proc-tests.el (esh-proc-test--output-cmd): New variable. (esh-proc-test--detect-pty-cmd): Add docstring. (esh-proc-test/output/to-screen) (esh-proc-test/output/stdout-and-stderr-to-buffer) (esh-proc-test/exit-status/success, esh-proc-test/exit-status/failure) (esh-proc-test/kill-process/foreground-only): New tests. (esh-proc-test/kill-background-process): Rename to... (esh-proc-test/kill-process/background-prompt): ... this, and use 'eshell-wait-for-subprocess' instead of 'sit-for'.
* Add support for more kinds of redirect operators in EshellJim Porter2022-09-041-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-arg.el: Require cl-lib. (eshell-finish-arg): Allow passing multiple ARGUMENTS. (eshell-quote-argument): Handle the case when 'eshell-finish-arg' was passed multiple arguments. * lisp/eshell/esh-cmd.el (eshell-do-pipelines) (eshell-do-pipelines-synchronously): Only set stdout output handle. * lisp/eshell/esh-io.el (eshell-redirection-operators-alist): New constant. (eshell-io-initialize): Prefer sharp quotes for functions. (eshell-parse-redirection, eshell-strip-redirections): Add support for more redirection forms. (eshell-copy-output-handle, eshell-set-all-output-handles): New functions. * test/lisp/eshell/esh-io-tests.el (esh-io-test/redirect-all/overwrite, esh-io-test/redirect-all/append) (esh-io-test/redirect-all/insert, esh-io-test/redirect-copy) (esh-io-test/redirect-copy-first, esh-io-test/redirect-pipe): New tests. * doc/misc/eshell.texi (Redirection): Document new redirection syntax. (Pipelines): Document '|&' syntax. (Bugs and ideas): Update item about redirection syntax. * etc/NEWS: Announce this change.
* Simplify Eshell handle functions and add tests/documentationJim Porter2022-09-044-19/+249
| | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-arg.el (eshell-parse-argument-hook): Explain how to use 'eshell-finish-arg'. * lisp/eshell/esh-io.el (eshell-create-handles): Only call 'eshell-get-target' for stderr if necessary. (eshell-protect-handles): Use 'dotimes'. (eshell-set-output-handle): Pass HANDLES and fix an edge case with setting a duplicate TARGET. * test/lisp/eshell/eshell-tests-helpers.el (eshell-with-temp-buffer): New macro. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/quoted-lisp-form) (esh-cmd-test/backquoted-lisp-form) (esh-cmd-test/backquoted-lisp-form/splice): New tests. * test/lisp/eshell/eshell-tests.el (eshell-test/redirect-buffer) (eshell-test/redirect-buffer-escaped): Move to... * test/lisp/eshell/esh-io-tests.el: ... here, and add other I/O tests. * doc/misc/eshell.texi (Arguments): Add documentation for special argument types. (Input/Output): Expand documentation for redirection and pipelines.
* Don't fail Eshell ERT tests when an internal signal gets raisedJim Porter2022-08-311-7/+13
| | | | | | | | | * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/pipeline-connection-type/middle) (esh-proc-test/pipeline-connection-type/last): Set 'debug-on-error' to nil. Ref: https://lists.gnu.org/archive/html/emacs-devel/2022-08/msg01452.html
* Handle 'eshell-pipe-broken' when evaluating Lisp forms in EshellJim Porter2022-08-291-4/+0
| | | | | | | | | | | | | | * lisp/eshell/esh-cmd.el (eshell-exec-lisp): Handle 'eshell-pipe-broken'. * lisp/eshell/esh-io.el (eshell-output-object-to-target): Only signal 'eshell-pipe-broken' if the process being written to has finished. * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/pipeline-connection-type/middle) (esh-proc-test/pipeline-connection-type/last): Remove ':unstable'. Ref: https://lists.gnu.org/archive/html/emacs-devel/2022-08/msg00524.html
* Mark another esh-proc test as unstableStefan Kangas2022-08-211-0/+2
| | | | | | * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/pipeline-connection-type/middle): Mark test as unstable as it fails quite a lot.
* Mark esh-proc test as unstableLars Ingebrigtsen2022-08-211-0/+2
| | | | | | * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/pipeline-connection-type/last): Mark test as unstable as it fails quite a lot.
* Fix non-interactive use of conditionals in EshellJim Porter2022-08-151-64/+55
| | | | | | | | | | | | | | | | | | * lisp/eshell/esh-cmd.el (eshell-rewrite-if-command): Fix misplaced 't' symbol; it should be passed to 'eshell-invokify-arg'. (eshell-do-eval): Pass 'synchronous-p' to recursive calls in some missing cases. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/if-statement, (esh-cmd-test/if-else-statement) (esh-cmd-test/if-else-statement-lisp-form) (esh-cmd-test/if-else-statement-lisp-form-2) (esh-cmd-test/if-else-statement-ext-cmd) (esh-cmd-test/unless-statement) (esh-cmd-test/unless-else-statement) (esh-cmd-test/unless-else-statement-lisp-form) (esh-cmd-test/unless-else-statement-ext-cmd): Use 'eshell-command-result-equal'.
* Add 'eshell-command-result-equal' with an ERT explainerJim Porter2022-08-157-273/+254
| | | | | | | | | | | | | * test/lisp/eshell/eshell-tests-helpers.el (eshell-command-result--equal, eshell-command-result--equal-explainer) (eshell-command-result-equal): New functions. * test/lisp/eshell/em-basic-tests.el * test/lisp/eshell/em-dirs-tests.el * test/lisp/eshell/esh-cmd-tests.el * test/lisp/eshell/esh-proc-tests.el * test/lisp/eshell/esh-var-tests.el * test/lisp/eshell/eshell-tests.el: Use 'eshell-command-result-equal'.
* Provide ERT explainer for 'eshell-match-command-output'Jim Porter2022-08-159-208/+222
| | | | | | | | | | | | | | | | | | | | | | | | | This was formerly named 'eshell-command-result-p', but "result" isn't quite the right terminology, since this function specifically tested the output of a command, not its Lisp result (as 'eshell-command-result' would return). * test/lisp/eshell/eshell-tests-helpers.el (eshell-insert-command): Provide a more-complete docstring. (eshell-match-result): Rename to... (eshell-match-output): ... this. (eshell-match-output--explainer): New function. (eshell-command-result-p): Rename to... (eshell-match-command-output): ... this. * test/lisp/eshell/em-alias-tests.el * test/lisp/eshell/em-dirs-tests.el * test/lisp/eshell/em-extpipe-tests.el * test/lisp/eshell/em-script-tests.el * test/lisp/eshell/esh-cmd-tests.el * test/lisp/eshell/esh-proc-tests.el * test/lisp/eshell/esh-var-tests.el * test/lisp/eshell/eshell-tests-helpers.el * test/lisp/eshell/eshell-tests.el: Use 'eshell-match-command-output'.
* Fix a recently-added Eshell test on MS-WindowsEli Zaretskii2022-08-131-4/+7
| | | | | | | * test/lisp/eshell/esh-var-tests.el (esh-var-test/last-result-var-ext-cmd): Fix the test on MS-Windows by making sure the internal 'format' command is invoked. (Bug#57129)
* Make '$?' and '$$' variables more consistent in EshellJim Porter2022-08-122-1/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, '$?' (last exit code) was only useful for external commands, and '$$' (last result) was only useful for Lisp commands. * lisp/eshell/esh-cmd.el (eshell-lisp-form-nil-is-failure): New option. (eshell-lisp-command): Set last exit code to 1 when the command signals an error, and 2 if it returns nil (for Lisp forms only). * lisp/eshell/esh-proc.el (eshell-sentinel): Set last result to t if the command succeeded. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/while-loop-lisp-form, esh-cmd-test/until-loop-lisp-form) (esh-cmd-test/if-else-statement-lisp-form) (esh-cmd-test/if-else-statement-lisp-form-2) (esh-cmd-test/unless-else-statement-lisp-form): New tests. * test/lisp/eshell/esh-var-tests.el (esh-var-test/last-status-var-lisp-command) (esh-var-test/last-status-var-lisp-form) (esh-var-test/last-status-var-lisp-form-2) (esh-var-test/last-status-var-ext-cmd) (esh-var-test/last-status-var-ext-cmd): New tests. (esh-var-test/last-result-var2): Rename from this... ( esh-var-test/last-result-var-twice): ... to this. * doc/misc/eshell.texi (Variables): Update documentation about '$?' and '$$'. (Control Flow): Mention that '(lisp forms)' can be used as conditionals. * etc/NEWS: Announce this change (bug#57129).
* Allow using dollar expansions in Eshell conditionalsJim Porter2022-08-121-10/+50
| | | | | | | | | | | | | | | | | * lisp/eshell/esh-cmd.el (eshell-structure-basic-command): Forms beginning with 'eshell-escape-arg' are "data-wise". * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/while-loop) (esh-cmd-test/until-loop, esh-cmd-test/if-statement) (esh-cmd-test/if-else-statement, esh-cmd-test/unless-statement) (esh-cmd-test/unless-else-statement): Use variable interpolation. (esh-cmd-test/while-loop-ext-cmd, esh-cmd-test/until-loop-ext-cmd) (esh-cmd-test/if-else-statement-ext-cmd) (esh-cmd-test/unless-else-statement-ext-cmd): New tests, adapted from the existing ones. * doc/misc/eshell.texi (Control Flow): Update documentation for conditionals (bug#57129).
* Only set Eshell execution result metavariables when non-nilJim Porter2022-08-122-53/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This simplifies usage of 'eshell-close-handles' in several places and makes it work more like the docstring indicated it would. * lisp/eshell/esh-io.el (eshell-close-handles): Only store EXIT-CODE and RESULT if they're non-nil. Also, use 'dotimes' and 'dolist' to simplify the implementation. * lisp/eshell/em-alias.el (eshell-write-aliases-list): * lisp/eshell/esh-cmd.el (eshell-rewrite-for-command) (eshell-structure-basic-command): Adapt calls to 'eshell-close-handles'. * test/lisp/eshell/eshell-tests.el (eshell-test/simple-command-result) (eshell-test/lisp-command, eshell-test/lisp-command-with-quote) (eshell-test/for-loop, eshell-test/for-name-loop) (eshell-test/for-name-shadow-loop, eshell-test/lisp-command-args) (eshell-test/subcommand, eshell-test/subcommand-args) (eshell-test/subcommand-lisp): Move from here... * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/simple-command-result, esh-cmd-test/lisp-command) (esh-cmd-test/lisp-command-with-quote, esh-cmd-test/for-loop) (esh-cmd-test/for-name-loop, esh-cmd-test/for-name-shadow-loop) (esh-cmd-test/lisp-command-args, esh-cmd-test/subcommand) (esh-cmd-test/subcommand-args, esh-cmd-test/subcommand-lisp): ... to here. (esh-cmd-test/and-operator, esh-cmd-test/or-operator) (esh-cmd-test/for-loop-list, esh-cmd-test/for-loop-multiple-args) (esh-cmd-test/while-loop, esh-cmd-test/until-loop) (esh-cmd-test/if-statement, esh-cmd-test/if-else-statement) (esh-cmd-test/unless-statement, esh-cmd-test/unless-else-statement): New tests. * doc/misc/eshell.texi (Invocation): Explain '&&' and '||'. (for loop): Move from here... (Control Flow): ... to here, and add documentation for other control flow forms.
* ; Improve time-convert call in recently changed testStefan Kangas2022-08-071-1/+1
| | | | | | | * 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>.
* ; Adjust time-convert call to recent changeStefan Kangas2022-08-061-1/+1
| | | | | * test/lisp/eshell/em-pred-tests.el (eshell-parse-file-name-attributes): Adjust test to recent change.
* Allow creating processes where only one of stdin or stdout is a PTYJim Porter2022-08-051-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/lisp.h (emacs_spawn): * src/callproc.c (emacs_spawn): Add PTY_IN and PTY_OUT arguments to specify which streams should be set up as a PTY. (call_process): Adjust call to 'emacs_spawn'. * src/process.h (Lisp_Process): Replace 'pty_flag' with 'pty_in' and 'pty_out'. * src/process.c (is_pty_from_symbol): New function. (make-process): Allow :connection-type to be a cons cell, and allow using a stderr process with a PTY for stdin/stdout. (create_process): Handle creating a process where only one of stdin or stdout is a PTY. * lisp/eshell/esh-proc.el (eshell-needs-pipe, eshell-needs-pipe-p): Remove. (eshell-gather-process-output): Use 'make-process' and set ':connection-type' as needed by the value of 'eshell-in-pipeline-p'. * lisp/net/tramp.el (tramp-handle-make-process): * lisp/net/tramp-adb.el (tramp-adb-handle-make-process): * lisp/net/tramp-sh.el (tramp-sh-handle-make-process): Don't signal an error when ':connection-type' is a cons cell. * test/src/process-tests.el (process-test-sentinel-wait-function-working-p): Allow passing PROC in, and rework into... (process-test-wait-for-sentinel): ... this. (process-test-sentinel-accept-process-output) (process-test-sentinel-sit-for, process-test-quoted-batfile) (process-test-stderr-filter): Use 'process-test-wait-for-sentinel'. (make/process/test-connection-type): New function. (make-process/connection-type/pty, make-process/connection-type/pty-2) (make-process/connection-type/pipe) (make-process/connection-type/pipe-2) (make-process/connection-type/in-pty) (make-process/connection-type/out-pty) (make-process/connection-type/pty-with-stderr-buffer) (make-process/connection-type/out-pty-with-stderr-buffer): New tests. * test/lisp/eshell/esh-proc-tests.el (esh-proc-test--detect-pty-cmd): New variable. (esh-proc-test/pipeline-connection-type/no-pipeline) (esh-proc-test/pipeline-connection-type/first) (esh-proc-test/pipeline-connection-type/middle) (esh-proc-test/pipeline-connection-type/last): New tests. * doc/lispref/processes.texi (Asynchronous Processes): Document new ':connection-type' behavior. (Output from Processes): Remove caveat about ':stderr' forcing 'make-process' to use pipes. * etc/NEWS: Announce this change (bug#56025).
* Ensure Eshell variable aliases properly handle indexingJim Porter2022-07-123-2/+71
| | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/em-dirs.el (eshell-dirs-initialize): Properly handle indexing for variable aliases. * lisp/eshell/esh-var (eshell-variable-aliases-list): Properly handle indexing for variable aliases, and add SIMPLE-FUNCTION entry for aliases. (eshell-get-variable): Update how variable alias functions are called. * test/lisp/eshell/em-alias-tests.el (em-alias-test/alias-arg-vars-indices) (em-alias-test/alias-arg-vars-split-indices) (em-alias-test/alias-all-args-var-split-indices): * test/lisp/eshell/em-dirs-tests.el (em-dirs-test/pwd-var-indices) (em-dirs-test/oldpwd-var-indices) (em-dirs-test/directory-ring-var-indices): * test/lisp/eshell/esh-var-tests.el (esh-var-test/inside-emacs-var-split-indices) (esh-var-test/last-result-var-split-indices): New tests. (esh-var-test/last-arg-var-split-indices): Expand test to check conversion behavior inside double quotes (bug#56509).
* Allow Eshell variable aliases to point to other aliasesJim Porter2022-07-121-4/+6
| | | | | | | | | | | | | | In particular, this resolves an issue where '$+' referenced the real environment variable '$PWD' instead of the Eshell variable alias of the same name. This meant that changing directories in Eshell wouldn't update the value of '$+'. * lisp/eshell/esh-var.el (eshell-get-variable): Allow Eshell variable aliaes to point to other aliases. * test/lisp/eshell/em-dirs-tests.el (em-dirs-test/pwd-var) (em-dirs-test/short-pwd-var): Adapt tests to check this case (bug#56509).
* Improve tests/organization for built-in variablesJim Porter2022-07-125-9/+221
| | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/em-dirs.el (eshell-inside-emacs) (eshell-dirs-initialize): Move 'INSIDE_EMACS' from here... * lisp/eshell/esh-var.el (eshell-inside-emacs) (eshell-variable-aliases-alist): ... to here, and improve doc string. * test/lisp/eshell/eshell-tests.el (eshell-test/inside-emacs-var): Move from here... * test/lisp/eshell/esh-var-tests.el (esh-var-test/inside-emacs-var): ... to here. (esh-var-test/last-arg-var-indices) (esh-var-test/last-arg-var-split-indices): New tests. * test/lisp/eshell/em-alias-tests.el: * test/lisp/eshell/em-dirs-tests.el: * test/lisp/eshell-em-script-tests.el: New files. * doc/misc/eshell.texi (Built-ins): Fix 'cd' documentation; it works with the directory ring, not the directory stack. Move built-in variables documentation from here... (Variables): ... to here, and add documentation for missing built-in variables.
* When closing an Eshell process target, send EOF three timesJim Porter2022-06-261-1/+0
| | | | | | | | | | * lisp/eshell/esh-io.el (eshell-close-target): Send EOF 3 times. * test/lisp/eshell/em-extpipe-tests.el (em-extpipe-tests--deftest): Re-enable these tests on EMBA. This patch is adapted by one from Ken Brown, who uncovered the reason for this bug (bug#56025).
* Make Eshell globs ending in "/" match directories onlyJim Porter2022-06-261-2/+13
| | | | | | | | | | | | | | * lisp/eshell/em-glob.el (eshell-glob-convert): Return whether to match directories only. (eshell-glob-entries): Add ONLY-DIRS argument. * test/lisp/eshell/em-glob-tests.el (em-glob-test/match-any-directory): New test. (em-glob-test/match-recursive) (em-glob-test/match-recursive-follow-symlinks): Add test cases for when "**/" or "***/" are the last components in a glob. * etc/NEWS: Announce this change (bug#56227).
* Convert Eshell globs ahead of time instead of doing it repeatedlyJim Porter2022-06-261-0/+15
| | | | | | | | | | * lisp/eshell/em-glob.el (eshell-glob-recursive): New variable. (eshell-glob-convert-1, eshell-glob-convert): New functions. (eshell-extended-glob): Use 'eshell-glob-convert'. (eshell-glob-entries): Adapt function to use pre-converted globs. * test/lisp/eshell-em-glob-tests.el (em-glob-test/match-dot-files): New test.
* Optionally signal an error if an Eshell predicate fails to match anythingJim Porter2022-06-261-4/+22
| | | | | | | | | | | | | | * 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.
* Don't use 'list' command in Eshell command formsJim Porter2022-06-101-2/+3
| | | | | | | | | | | When executed like a command, 'list' looks for external programs named 'list' first before falling back to the Lisp function of the same name. This causes unexpected behavior, since the Lisp function is what we want in these tests. * test/lisp/eshell/esh-var-tests.el (esh-var-test/interp-cmd-indices) (esh-var-test/quoted-interp-cmd-indices): Use 'listify' instead of 'list'.
* Account for remapped faces in $COLUMNS and $LINES in EshellJim Porter2022-06-091-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/window.h (window_body_unit): New enum... (window_body_width): ... use it. * src/window.c (window_body_unit_from_symbol): New function. (window_body_height, window_body_width): Make PIXELWISE a 'window_body_unit'. (window-body-height, window-body-width): Accept 'remap' for PIXELWISE. (window-lines-pixel-dimensions, window_change_record_windows) (run_window_change_functions, resize_frame_windows, grow_mini_window) (shrink_mini_window, scroll-left, scroll-right): Update calls to 'window_body_height' and 'window_body_width'. * src/indent.c (compute_motion): Update calls to 'window_body_width'. * lisp/eshell/em-ls.el (eshell-ls-find-column-widths) (eshell-ls-find-column-lengths): Use 'window-body-width'. * lisp/eshell/esh-var.el (eshell-variable-aliases-list): Use 'window-body-width' and 'window-body-height'. * test/lisp/eshell/esh-var-tests.el (esh-var-test/window-height) (esh-var-test/window-width): Rename to... (esh-var-test/lines-var, esh-var-test/columns-var): ... and update expected value. * doc/lispref/windows.texi (Window Sizes): Document new behavior of PIXELWISE argument for 'window-body-width' and 'window-body-height'. * etc/NEWS: Announce this change (bug#55696).
* Don't split Eshell expansions by line when using split-subscript operatorJim Porter2022-06-081-1/+8
| | | | | | | | | * lisp/eshell/esh-var.el (eshell-apply-indices): Use 'eshell-convert-to-number' instead of 'eshell-convert'. * test/lisp/eshell/esh-var-tests.el (esh-var-test/interp-convert-var-split-indices): Expand test (bug#55838).
* Reset 'eshell-in-pipeline-p' when interpolating commandsJim Porter2022-05-251-0/+29
| | | | | | | | | * lisp/eshell/esh-cmd.el (eshell-subcommand-bindings) (eshell-command-to-value): Set 'eshell-in-pipeline-p' to nil. * test/lisp/eshell/eshell-tests.el (eshell-test/subcommand-reset-in-pipeline) (eshell-test/lisp-reset-in-pipeline): New tests (bug#55620).
* Keep subcommands in pipelines from clobbering the head/tail processesJim Porter2022-05-241-0/+16
| | | | | | | | | | | | | * lisp/eshell/esh-cmd.el (eshell-execute-pipeline): Use 'make-symbol' for headproc and tailproc. (eshell-do-pipelines, eshell-do-pipelines-synchronously): Adapt to the above. * test/lisp/eshell/eshell-tests.el (eshell-test/pipe-subcommand) (eshell-test/pipe-subcommand-with-pipe): New test. * doc/misc/eshell.texi (Bugs and ideas): Remove item about piping to process from loop; this commit fixes it (bug#55590).
* Stop esh-var-tests leaving temp files behindGlenn Morris2022-05-041-1/+6
| | | | | * test/lisp/eshell/esh-var-tests.el (esh-var-test/quoted-interp-temp-cmd): Don't leave temporary files.