aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/eshell (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ; Fix typosStefan Kangas2023-12-102-2/+2
|
* ; Fix docstring typo in Eshell testsJim Porter2023-11-121-1/+1
| | | | | * test/lisp/eshell/em-hist-tests.el (em-hist-test/check-history-file): Fix typo.
* Add some more Eshell history testsJim Porter2023-11-101-36/+91
| | | | | | | | | | | | * test/lisp/eshell/em-hist-tests.el (em-hist-test/check-history-file): New function. Use it throughout this file. (em-hist-test/history-append): Rename to... (em-hist-test/write-history/append): ... this. (em-hist-test/history-read): Rename to... (em-hist-test/write-history/overwrite): ... this. (em-hist-test/write-history/append-multiple-eshells) (em-hist-test/write-history/overwrite-multiple-shells): New tests. (em-hist-test/write-history/read-only): Check the resulting history.
* Improve read/append behavior of eshell history commandLiu Hui2023-11-101-0/+34
| | | | | | | | | | | | | | | * lisp/eshell/em-hist.el (eshell-hist--new-items): New variable. (eshell-hist-initialize): Initialize 'eshell-hist--new-items' to 0. (eshell/history): Change the behavior of 'history -a' to "append new history in current buffer to history file". Clarify the help text of 'history -r'. (eshell-add-input-to-history): Increase counter of new history items. (eshell-read-history): Respect 'eshell-hist-ignoredups' option. (eshell-write-history): If the optional argument APPEND is non-nil, appending new history items rather than the whole history. * test/lisp/eshell/em-hist-tests.el (em-hist-test/history-append) (em-hist-test/history-read): New tests (bug#66768).
* Add a new Eshell special reference type for markersJim Porter2023-10-242-2/+68
| | | | | | | | | | | | | | | | | | * lisp/eshell/esh-arg.el (eshell-get-marker, eshell-insert-marker) (eshell-complete-marker-ref): New functions... (eshell-special-ref-alist): ... Add them to the new "marker" entry. * test/lisp/eshell/esh-arg-tests.el (esh-arg-test/special-reference/marker) (esh-arg-test/special-reference/nested) (esh-arg-test/special-reference/lisp-form): * test/lisp/eshell/em-cmpl-tests.el (em-cmpl-test/special-ref-completion/type) (em-cmpl-test/special-ref-completion/marker): New tests. * doc/misc/eshell.texi (Arguments): Document the new special ref type. * etc/NEWS: Announce this change (bug#66458).
* Support arbitrary Eshell arguments inside special referencesJim Porter2023-10-242-4/+29
| | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-arg.el (eshell-current-argument-plain): New variable. (eshell-parse-special-reference): Use 'eshell-parse-arguments'. (eshell-get-buffer): New function. (eshell-insert-buffer-name): Properly quote the buffer name. * lisp/eshell/esh-proc.el (eshell-read-process-name): Move to "Special references" section. (eshell-insert-process): Properly quote the process name. * lisp/eshell/em-extpipe.el (eshell-parse-external-pipeline): * lisp/eshell/esh-io.el (eshell-parse-redirection): Don't do anything when 'eshell-argument-plain' is non-nil. * test/lisp/eshell/esh-arg-tests.el (esh-arg-test/special-reference/quoted) (esh-arg-test/special-reference/var-expansion): New tests. (esh-arg-test/special-reference/special): Rename to... (esh-arg-test/special-reference/special-characters): ... this. * test/lisp/eshell/em-extpipe-tests.el (em-extpipe-tests--deftest): Properly quote the buffer name. (em-extpipe-test-4, em-extpipe-test-7): Use 'eshell-get-buffer'.
* Fix behavior of Eshell prompt when yanking output into itJim Porter2023-10-111-0/+19
| | | | | | | | | | * lisp/eshell/esh-util.el (eshell--unmark-string-as-output): New function... * lisp/eshell/esh-mode.el (eshell-mode): ... use it. * test/lisp/eshell/eshell-tests.el (eshell-test/yank-output): New test (bug#66469).
* Support Eshell iterative evaluation in the backgroundJim Porter2023-10-023-5/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This really just generalizes Eshell's previous support for iterative evaluation of a single current command to a list of multiple commands, of which at most one can be in the foreground (bug#66066). * lisp/eshell/esh-cmd.el (eshell-last-async-procs) (eshell-current-command): Make obsolete in favor of... (eshell-foreground-command): ... this (eshell-background-commands): New variable. (eshell-interactive-process-p): Make obsolete. (eshell-head-process, eshell-tail-process): Use 'eshell-foreground-command'. (eshell-cmd-initialize): Initialize new variables. (eshell-add-command, eshell-remove-command) (eshell-commands-for-process): New functions. (eshell-parse-command): Make 'eshell-do-subjob' the outermost call. (eshell-do-subjob): Call 'eshell-resume-eval' to split this command off from its parent forms. (eshell-eval-command): Use 'eshell-add-command'. (eshell-resume-command): Use 'eshell-commands-for-process'. (eshell-resume-eval): Take a COMMAND argument. Return ':eshell-background' form for deferred background commands. (eshell-do-eval): Remove check for 'eshell-current-subjob-p'. This is handled differently now. * lisp/eshell/eshell.el (eshell-command): Wait for all processes to exit when running synchronously. * lisp/eshell/esh-mode.el (eshell-intercept-commands) (eshell-watch-for-password-prompt): * lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): * lisp/eshell/em-smart.el (eshell-smart-display-move): Use 'eshell-foreground-command'. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/background/simple-command) (esh-cmd-test/background/subcommand): New tests. (esh-cmd-test/throw): Use 'eshell-foreground-command'. * test/lisp/eshell/eshell-tests.el (eshell-test/queue-input): Use 'eshell-foreground-command'. * test/lisp/eshell/em-script-tests.el (em-script-test/source-script/background): Make the test script more complex. * test/lisp/eshell/eshell-tests.el (eshell-test/eshell-command/pipeline-wait): New test. * doc/misc/eshell.texi (Bugs and ideas): Remove implemented feature.
* Don't print subjob messages when running an Eshell script in the backgroundJim Porter2023-10-021-0/+13
| | | | | | | | | | | | | | | * lisp/eshell/esh-proc.el (eshell-subjob-messages): New variable... (eshell-record-process-object) (eshell-remove-process-entry): ... check it. * lisp/eshell/em-script.el (eshell-source-file): Set 'eshell-subjob-messages' to nil. * lisp/eshell/esh-cmd.el (eshell-do-subjob): Set 'eshell-subjob-messages' to t. * test/lisp/eshell/em-script-tests.el (em-script-test/source-script/background): New test.
* ; Adjust Eshell regression tests to avoid SIGPIPEJim Porter2023-10-011-13/+7
| | | | | | | | | | | | | In batch mode, SIGPIPEs can cause Emacs to abort (bug#66186). * lisp/eshell/esh-io.el (eshell-output-object-to-target): Update comment. * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/pipeline-connection-type/middle) (esh-proc-test/pipeline-connection-type/last): Use '(ignore)', since that causes no output when called with no arguments, thus avoiding a risky 'process-send-string'.
* Use 'unwind-protect' in more places in EshellJim Porter2023-09-261-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lets us simplify the logic for how we reset 'eshell-current-command' and 'eshell-last-async-procs', as well as improving correctness of Eshell command forms in a few esoteric scenarios. Additionally, this helps set the stage for better support of background commands in Eshell (bug#66164). * lisp/eshell/esh-cmd.el (eshell-cmd-initialize): Remove addition to 'eshell-post-command-hook'; this is handled in 'eshell-resume-command' and 'eshell-resume-eval' now. (eshell-resume-command): Handle resetting the prompt as needed. (eshell-resume-eval): Use 'unwind-protect' to ensure that we set 'eshell-last-async-procs' and 'eshell-current-comment' at the right times. (eshell-parse-command, eshell-trap-errors, eshell-manipulate): Use 'unwind-protect'. (eshell-do-eval): Allow 'eshell-defer' to pass through 'unwind-protect' forms without actually calling the unwinding forms (yet). * lisp/eshell/esh-proc.el (eshell-kill-process-function) (eshell-reset-after-proc): Make obsolete. The behavior is now handled in 'eshell-resume-command'. (eshell-gather-process-output, eshell-sentinel) (eshell-interrupt-process, eshell-kill-process, eshell-quit-process) (eshell-stop-process, eshell-continue-process): Run 'eshell-kill-hook' directly. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/throw): New test.
* ; Fix last changeJim Porter2023-09-171-2/+1
| | | | | | * test/lisp/eshell/eshell-tests.el (eshell-test/eshell-command/output-buffer/sync): Remove unused let-binding.
* Fix running background commands via 'eshell-command'Jim Porter2023-09-171-1/+25
| | | | | | | | | | | | | | This regressed (I believe) due to 2ec41c174f9. * lisp/eshell/esh-cmd.el (eshell-resume-eval): Check for non-nil 'retval' instead of for a process list (nil is also a technically a process list!). * test/lisp/eshell/eshell-tests.el (eshell-test/eshell-command/background-pipeline): Remove unnecessary 'copy-tree'. (eshell-test/eshell-command/output-buffer/sync) (eshell-test/eshell-command/output-buffer/async): New tests.
* Fix documented Eshell behavior of ignoring leading nils in commandsJim Porter2023-09-152-0/+14
| | | | | | | | | | | | * lisp/eshell/esh-var.el (eshell-handle-local-variables): Simplify, and move leading-nil handling to... * lisp/eshell/esh-cmd.el (eshell-named-command): ... here. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/skip-leading-nils): * test/lisp/eshell/esh-var-tests.el (esh-var-test/local-variables/skip-nil): New tests. * doc/misc/eshell.texi (Expansion): Document this behavior.
* ; Improve recent change to printing exit status in EshellJim Porter2023-09-121-5/+4
| | | | | | | | | | * lisp/eshell/esh-proc.el (eshell-interactive-filter): Declare. (eshell-interactive-process-filter): Simplify. (eshell-sentinel): Call 'eshell-interactive-filter'. * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/kill-process/redirect-message): Use 'eshell-with-temp-buffer'.
* Be more careful about when to print abnormal exit status in EshellJim Porter2023-09-121-0/+10
| | | | | | | | * lisp/eshell/esh-proc.el (eshell-sentinel): Only output abnormal status when stderr is interactive. * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/kill-process/redirect-message): New test.
* Wait for all processes in a pipeline before resuming an Eshell commandJim Porter2023-09-101-0/+10
| | | | | | | | | | | | | | Previously, we only waited until the tail process was finished, but now, we wait for all of them. This is more consistent with other shells, and prevents some cases of a process's output coming *after* we continued past its pipeline. * lisp/eshell/esh-cmd.el (eshell-resume-command): Simplify conditionals, and check that all the foreground processes are dead before resuming Eshell command. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/pipeline-wait/multi-proc): New test.
* ; Move some Eshell tests to more-topical filesJim Porter2023-09-103-69/+73
| | | | | | | | | | | | | | | | | | | | | | eshell-tests.el should mainly be for code in eshell.el. * test/lisp/eshell/eshell-tests.el (eshell-test/pipe-headproc) (eshell-test/pipe-tailproc, eshell-test/pipe-subcommand) (eshell-test/pipe-subcommand-with-pipe) (eshell-test/subcommand-reset-in-pipeline) (eshell-test/lisp-reset-in-pipeline): Move to... * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/pipeline-wait/head-proc) (esh-cmd-test/pipeline-wait/tail-proc) (esh-cmd-test/pipeline-wait/subcommand) (esh-cmd-test/pipeline-wait/subcommand-with-pipe) (esh-cmd-test/reset-in-pipeline/subcommand) (esh-cmd-test/reset-in-pipeline/lisp): ... here. * test/lisp/eshell/eshell-tests.el (eshell-test/pipe-headproc-stdin): Move to... * test/lisp/eshell/esh-io-tests.el (esh-io-test/pipeline/stdin-to-head): ... here.
* Merge from origin/emacs-29Eli Zaretskii2023-09-091-0/+15
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | b8a8106fa1a ; Add missing space in the manual 5b906b62157 Fix defcustom :type of ielm-indirect-setup-hook 82af484ec15 ; Two updates of etc/TODO 0ab2823f518 ; Describe in PROBLEMS 2 problems with keyboard input 4e7112ab211 ; Fix inaccuracy in ELisp reference manual 34bbb6c8d21 Document NonGNU ELPA in FAQ 2af092741e5 Fix remote path setting in Eshell 4613575d97f ; * lisp/completion.el (dynamic-completion-mode): Fix las... 2f0f33fbf9d Update docs for (co-)maintainer changes b068fcd4a31 * doc/lispref/strings.texi (Text Comparison): Fix typo (b... 2e2a5f8118c Adapt Tramp manual d32f00a35bc Improve docstring of message-sendmail-envelope-from 1a668cda8bc Unbreak builds with CHECK_STRUCTS. 77b6e9bb17b Improve documentation of EPG d3382f94714 ; * lisp/completion.el (dynamic-completion-mode): Doc fix. 1458daf3164 Avoid crashes on macOS with context menus # Conflicts: # src/pdumper.c
| * 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.
* | ; Fix last changeJim Porter2023-09-081-12/+13
| | | | | | | | | | | | * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/sigpipe-exits-process): Make sure we have no *new* processes, instead of making sure we have no processes at all.
* | ; Fix name of an Eshell testJim Porter2023-09-081-1/+1
| | | | | | | | | | | | * test/lisp/eshell/esh-proc-tests.el (esh-var-test/output/remote-redirect): Rename to... (esh-proc-test/output/remote-redirect): ... this.
* | Use new ERT `skip-when` macro in testsStefan Kangas2023-09-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/autorevert-tests.el (auto-revert-test02-auto-revert-deleted-file): * test/lisp/emacs-lisp/benchmark-tests.el (benchmark-tests): * test/lisp/emacs-lisp/find-func-tests.el (find-func-tests--library-completion): * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/kill-pipeline): * test/lisp/filenotify-tests.el (file-notify-test11-symlinks): * test/lisp/ibuffer-tests.el (ibuffer-0autoload): * test/lisp/international/ucs-normalize-tests.el (ucs-normalize-part1): * test/lisp/net/network-stream-tests.el (echo-server-nowait) (connect-to-tls-ipv4-nowait, connect-to-tls-ipv6-nowait) (open-network-stream-tls-wait, open-network-stream-tls-nowait) (open-network-stream-tls, open-network-stream-tls-nocert) (open-gnutls-stream-new-api-nowait) (open-gnutls-stream-old-api-nowait): * test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-10483) (cperl-test-hyperactive-electric-else): * test/lisp/progmodes/elisp-mode-tests.el (eval-last-sexp-print-format-sym-echo) (eval-last-sexp-print-format-small-int-echo) (eval-last-sexp-print-format-large-int-echo) (eval-defun-prints-edebug-when-instrumented): * test/lisp/progmodes/python-tests.el (python-ffap-module-path-1): * test/lisp/shadowfile-tests.el (shadow-test00-clusters) (shadow-test01-sites, shadow-test02-files) (shadow-test03-expand-cluster-in-file-name) (shadow-test04-contract-file-name, shadow-test05-file-match) (shadow-test06-literal-groups, shadow-test07-regexp-groups) (shadow-test08-shadow-todo, shadow-test09-shadow-copy-files): * test/lisp/simple-tests.el (eval-expression-print-format-sym-echo) (eval-expression-print-format-small-int-echo) (eval-expression-print-format-large-int-echo): * test/lisp/term-tests.el (term-simple-lines) (term-carriage-return, term-line-wrap, term-colors) (term-colors-bold-is-bright, term-cursor-movement) (term-scrolling-region, term-set-directory) (term-line-wrapping-then-motion, term-to-margin): * test/lisp/thread-tests.el (thread-tests-list-threads-error-when-not-configured): * test/lisp/vc/vc-tests.el (backend): * test/manual/scroll-tests.el (scroll-tests-scroll-margin-0) (scroll-tests-scroll-margin-negative) (scroll-tests-scroll-margin-max) (scroll-tests-scroll-margin-over-max) (scroll-tests-scroll-margin-whole-window): * test/misc/test-custom-libs.el (test-custom-libs): * test/src/emacs-module-tests.el (module/async-pipe): * test/src/fileio-tests.el (fileio-tests--odd-symlink-chars): * test/src/filelock-tests.el (filelock-tests-lock-spoiled) (filelock-tests-file-locked-p-spoiled) (filelock-tests-unlock-spoiled) (filelock-tests-kill-buffer-spoiled) (filelock-tests-detect-external-change): * test/src/image-tests.el (image-tests-image-size/error-on-nongraphical-display) (image-tests-image-mask-p/error-on-nongraphical-display) (image-tests-image-metadata/error-on-nongraphical-display): * test/src/process-tests.el (make-process/mix-stderr) (process-tests/fd-setsize-no-crash/make-network-process) (process-tests/fd-setsize-no-crash/make-serial-process): Use ERT `skip-when` macro in tests.
* | Display the exit code if the last command failed in EshellDavide Masserut2023-09-021-10/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-io.el (eshell-last-command-status): Make buffer-local. * lisp/eshell/em-prompt.el (eshell-prompt-function): Insert the exit code if last command failed. * test/lisp/eshell/em-prompt-tests.el (em-prompt-test/after-failure): New test. (em-prompt-test/next-previous-prompt-1) (em-prompt-test/forward-backward-matching-input-1): Add a failing command to tests. * doc/misc/eshell.texi (Invocation): Document change. * etc/NEWS: Announce change (bug#65604).
* | Be more precise about navigating forward/backward through Eshell promptsJim Porter2023-09-021-31/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/em-prompt.el (eshell-next-prompt): Make N optional. When navigating, first move to the end of the prompt. This makes the subsequent navigation more predictable. (eshell-previous-prompt): Mane N optional. * test/lisp/eshell/em-prompt-tests.el (em-prompt-test--with-multiline): Move to "Code" section. (em-prompt-test/next-previous-prompt-with): Rename to... (em-prompt-test/next-previous-prompt-1): ... this, and add additional test cases. Update callers. (em-prompt-test/forward-backward-matching-input-with): Rename to... (em-prompt-test/forward-backward-matching-input-1): ... this, and improve existing test cases.
* | Merge from origin/emacs-29Eli Zaretskii2023-09-021-0/+30
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 648a5e33e80 Update to Org 9.6.8-3-g21171d 458442fe78c Escape percent character in treesit--inspect-name (bug#65... bc0426ce8ed Don't add an extraneous slash in remote PATH list in Eshell 34f7a47c9ce Fix Tramp on MS Windows ea5fd6c96bc * Fix native disassemble on Windows platforms (bug#65455) 91d2d8439bb * Handle missing eln file when trying to disassble (bug#6... e7ac50a1539 * lisp/emacs-lisp/comp.el (comp--native-compile): Fix OUT... 45cf3a0cede Update to Transient v0.4.3 31d3808fb9d Adapt Eshell manual 0c50af054f9 Fix applying patches with Git on MS-Windows # Conflicts: # doc/misc/transient.texi # test/lisp/eshell/esh-util-tests.el
| * 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.
* | ; Fix debug logging for synchronous commands in Eshell testsJim Porter2023-09-011-2/+6
| | | | | | | | | | | | | | | | * lisp/eshell/eshell.el (eshell-command-result): Call 'eshell-debug-command-start'. * test/lisp/eshell/eshell-tests-helpers.el (with-temp-eshell): Update comment. (eshell-test-command-result): Set 'eshell-debug-command'.
* | Add debug instrumentation for Eshell process managementJim Porter2023-08-311-8/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-util.el (eshell-debug-command) * lisp/eshell/em-basic.el (eshell/eshell-debug) (pcomplete/eshell-mode/eshell-debug): Add 'process' type. * lisp/eshell/esh-proc.el (eshell-gather-process-output) (eshell-interactive-process-filter, eshell-insertion-filter) (eshell-sentinel): Call 'eshell-debug-command'. * test/lisp/eshell/eshell-tests-helpers.el (with-temp-eshell): Add 'process' to 'eshell-debug-command' (eshell-get-debug-logs): New function... (eshell-match-command-output, eshell-command-result-equal): ... use it. * doc/misc/eshell.texi (Built-ins): Mention "process" debug type.
* | Fix behavior of 'eshell-hist-ignoredups' when set to 'erase'Jim Porter2023-08-231-1/+42
| | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/em-hist.el (eshell-add-input-to-history): Refactor to use 'pcase' and correct the logic for the 'erase' case. * test/lisp/eshell/em-hist-tests.el: Require our test helpers. (eshell-write-readonly-history): Rename to... (em-hist-test/write-readonly-history): ... this. (em-hist-test/add-to-history/allow-dups) (em-hist-test/add-to-history/no-consecutive-dups) (em-hist-test/add-to-history/erase-dups): New tests (bug#63360).
* | Support 'comint-pager' in EshellJim Porter2023-08-231-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-var.el (eshell-variable-aliases-list): Add "PAGER". (eshell-var-initialize): Make 'comint-pager' buffer-local and bind it in subcommands so that we can temporarily set it as necessary. * test/lisp/eshell/esh-var-tests.el (esh-var-test/pager-var/default) (esh-var-test/pager-var/set, esh-var-test/pager-var/unset) (esh-var-test/pager-var/set-locally): New tests. * doc/misc/eshell.texi (Variables): Document this (bug#63778). Co-authored-by: Morgan Smith <Morgan.J.Smith@outlook.com>
* | Use generics to define Eshell output targetsJim Porter2023-08-211-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | This is more flexible than before, since third-party code can add new output target types without advising these functions. It also resolves an issue where redirecting to a symbol that has a value in its function slot doesn't work. * lisp/eshell/esh-io.el (eshell-virtual-target): New struct. (eshell-get-target, eshell-output-object-to-target): Reimplement via 'cl-defgeneric'. (eshell-close-target): Reimplement via 'cl-defgeneric' and simplify 'process' method.
* | Allow splicing Eshell globs in-placeJim Porter2023-08-211-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Add 'compile' builtin command for EshellJim Porter2023-08-161-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/em-unix.el (eshell-compile, eshell/compile): New functions. (eshell/make, eshell-grep): Use 'eshell-compile'. (eshell/glimpse): It's no longer necessary to let-bind 'null-device'; 'eshell-grep' no longer calls 'grep' (the Lisp function), which needed 'null-device' to be nil for this case. * test/lisp/eshell/em-unix-tests.el: New file. * doc/misc/eshell.texi (Built-ins): Document the 'compile' builtin. * etc/NEWS: Announce this change (bug#65273).
* | ; Fix Eshell testsJim Porter2023-08-142-17/+17
| | | | | | | | | | | | | | | | * test/lisp/eshell/eshell-tests.el (eshell-test/forward-arg): Add 'should' calls to check state. * test/lisp/eshell/em-extpipe-tests.el (em-extpipe-tests--deftest): Add 'should' calls and fix temp-buffer substitution.
* | Fix listing of directory contents after "cd" in EshellJim Porter2023-08-071-0/+23
| | | | | | | | | | | | | | | | | | * lisp/eshell/em-dirs.el (eshell/cd): Ensure we don't close the I/O handles prematurely. Additionally, don't clobber the "cd" command's last-command info. * test/lisp/eshell/em-dirs-tests.el (em-dirs-test/cd): (em-dirs-test/cd/list-files-after-cd): New tests (bug#65110).
* | Fix eshell "ls" command for files larger than 1TiBStefan Kangas2023-08-051-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-util.el (eshell-printable-size): Fix displaying file sizes larger than 1 TiB or 1 TB. * test/lisp/eshell/esh-util-tests.el (esh-util-test/eshell-printable-size) (esh-util-test/eshell-printable-size/zero) (esh-util-test/eshell-printable-size/terabyte) (esh-util-test/eshell-printable-size/use-colors) (esh-util-test/eshell-printable-size/block-size) (esh-util-test/eshell-printable-size/human-readable-arg): New tests.
* | Add support for explicitly-remote commands in EshellJim Porter2023-07-101-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/files.el (file-remote-p): * doc/lispref/files.texi (Magic File Names): Document 'never' for CONNECTED argument. * lisp/net/tramp.el (tramp-handle-file-remote-p): Handle CONNECTED value of 'never'. * lisp/eshell/esh-ext.el (eshell-explicit-remote-commands): New option. (eshell-ext-initialize): Apply 'eshell-handle-remote-command' when requested. (eshell-handle-remote-command): New function. (eshell-remote-command): Reimplement this function and dispatch to 'eshell-external-command', which can handle remote processes on its own. * test/lisp/eshell/esh-ext-tests.el (esh-ext-test/explicitly-remote-command) (esh-ext-test/explicitly-local-command): New tests. * doc/misc/eshell.texi (Remote Access): Document explicitly-remote commands. * etc/NEWS: Announce this change.
* | Add special '$GID' variable in EshellJim Porter2023-07-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | See bug#64529. * lisp/eshell/esh-var.el (eshell-variable-aliases-list): Add '$GID'. * test/lisp/eshell/esh-var-tests.el (esh-var-test/gid-var): New test. * doc/misc/eshell.texi (Variables): Document '$GID'. * etc/NEWS: Announce this change (and the previous change for '$UID').
* | ; Improve 'rx' form from edb0862f5e69Jim Porter2023-06-191-1/+1
| | | | | | | | | | | | | | | | Thanks to Michael Albinus for the suggestion. * test/lisp/eshell/esh-util-tests.el (esh-util-test/eshell-stringify/list): Use 'any' instead of 'or' in 'rx' form.
* | ; Fix test failure from 2f181d60323 (new 'pp' implementation)Jim Porter2023-06-181-2/+8
| | | | | | | | | | | | * test/lisp/eshell/esh-util-tests.el (esh-util-test/eshell-stringify/list): Be more flexible when checking stringification of nested lists.
* | eshell-next-prompt: More precisely navigate to the prompt (bug#63748)Tony Zorman2023-06-151-4/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/em-prompt.el (eshell-next-prompt): Navigate to the current prompt more accurately by using text properties instead of going to the beginning of the line. This is important for multiline prompts, as they don't necessarily start at the beginning of the current line. * test/lisp/eshell/em-prompt-tests.el (em-prompt-test--with-multiline): Execute a given body with a multiline prompt. (em-prompt-test/next-previous-prompt-with): (em-prompt-test/forward-backward-matching-input-with): Helper functions for code reuse. (em-prompt-test/forward-backward-matching-input): (em-prompt-test/next-previous-prompt): Rewrite in terms of the appropriate helper functions. (em-prompt-test/next-previous-prompt-multiline): (em-prompt-test/forward-backward-matching-input-multiline): Add multiline variants of existing tests.
* | Fix using background commands in 'eshell-command'Jim Porter2023-04-021-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-parse-command): When creating background commands, wrap the process(es) in a cons cell whose CAR is ':eshell-background'. This lets us use fewer heuristics... (eshell-eval-command): ... here. Additionally, keep the result and the incomplete delimiter separate. * lisp/eshell/eshell.el (eshell-command): Check ':eshell-background' and use a more-robust method for setting the output target. * 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.
* | ; Add tests for synchronous processes in EshellJim Porter2023-04-021-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Normally, Eshell only uses synchronous processes on MS-DOS, so this is hard to test. To get around this, let the tests explicitly request synchronous processes. * lisp/eshell/esh-proc.el (eshell-supports-asynchronous-processes): New variable... (eshell-gather-process-output): ... use it, and remove some incorrect code updating Eshell's internal markers (the async code path doesn't do this, so neither should the sync path). * lisp/eshell/esh-cmd.el (eshell-execute-pipeline): Use 'eshell-supports-asynchronous-processes'. * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/emacs-command): New function. (esh-proc-test/emacs-echo, esh-proc-test/emacs-upcase): New variables. (esh-proc-test/synchronous-proc/simple/interactive) (esh-proc-test/synchronous-proc/simple/command-result) (esh-proc-test/synchronous-proc/pipeline/interactive) (esh-proc-test/synchronous-proc/pipeline/command-result): New tests.
* | Avoid shadowing variables in some Eshell command formsJim Porter2023-04-011-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-cmd.el (eshell-rewrite-for-command): Make 'for-items' an uninterned symbol. (eshell-as-subcommand): Correct docstring. (eshell-do-command-to-value): Mark obsolete. (eshell-command-to-value): Move binding of 'value' outside of the macro's result, and remove call to 'eshell-do-command-to-value'. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/subcommand-shadow-value) (esh-cmd-test/for-loop-for-items-shadow): New tests. (esh-cmd-test/for-name-loop, esh-cmd-test/for-name-shadow-loop): Rename to... (esh-cmd-test/for-loop-name, esh-cmd-test/for-loop-name-shadow): ... these.
* | Avoid parsing some Eshell forms when performing completionJim Porter2023-03-281-10/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During completion, we want to evaluate most Eshell forms (e.g. variable references), but skip others (e.g. globbing, subcommands). For globbing, we want to pass the literal glob to Pcomplete so it can use the glob for selecting completion candidates. For subcommands (including Lisp forms), we especially want to avoid evaluation, since they can produce arbitary side effects! (Bug#50470) * lisp/eshell/esh-cmd.el (eshell-allow-commands): New variable... (eshell-commands-forbidden): New error... (eshell-named-command, eshell-lisp-command): ... use them. * lisp/eshell/em-cmpl.el (eshell-complete--eval-argument-form): Disallow command forms and handle errors ourselves. (eshell-complete-parse-arguments): Don't parse glob characters. * test/lisp/eshell/em-cmpl-tests.el (em-cmpl-test/parse-arguments/unevaluated-subcommand) (em-cmpl-test/parse-arguments/unevaluated-lisp-form) (em-cmpl-test/parse-arguments/unevaluated-inner-subcommand) (em-cmpl-test/file-completion/glob, em-cmpl-test/command-completion) (em-cmpl-test/subcommand-completion): New tests. (em-cmpl-test/parse-arguments/pipeline): Remove superfluous let-binding. (em-cmpl-test/file-completion/after-list): Use a list variable rather than a subexpression; the latter is no longer evaluated during completion. (em-cmpl-test/lisp-function-completion): Check "$(func)" syntax.