summaryrefslogtreecommitdiff
path: root/test/lisp/eshell
Commit message (Collapse)AuthorAgeFilesLines
* Port Eshell tests to AndroidPo Lu2025-02-2621-58/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/infra/android/test-controller.el (ats-run-test): Run tests in a temp buffer. * test/lisp/eshell/em-alias-tests.el (ert, em-alias) (eshell-tests-helpers): * test/lisp/eshell/em-basic-tests.el (em-basic) (eshell-tests-helpers): * test/lisp/eshell/em-cmpl-tests.el (em-unix) (eshell-tests-helpers): * test/lisp/eshell/em-dirs-tests.el (em-dirs) (eshell-tests-helpers): * test/lisp/eshell/em-extpipe-tests.el (ert-x) (eshell-tests-helpers): * test/lisp/eshell/em-glob-tests.el (ert, eshell-tests-helpers): * test/lisp/eshell/em-hist-tests.el (eshell) (eshell-tests-helpers): * test/lisp/eshell/em-pred-tests.el (em-pred) (eshell-tests-helpers): * test/lisp/eshell/em-prompt-tests.el (em-prompt) (eshell-tests-helpers): * test/lisp/eshell/em-script-tests.el (em-script) (eshell-tests-helpers): * test/lisp/eshell/em-unix-tests.el (ert-x) (eshell-tests-helpers): * test/lisp/eshell/esh-arg-tests.el (eshell) (eshell-tests-helpers): * test/lisp/eshell/esh-cmd-tests.el (eshell) (eshell-tests-helpers): * test/lisp/eshell/esh-ext-tests.el (eshell) (eshell-tests-helpers): * test/lisp/eshell/esh-io-tests.el (eshell) (eshell-tests-helpers): * test/lisp/eshell/esh-mode-tests.el (em-prompt) (eshell-tests-helpers): * test/lisp/eshell/esh-proc-tests.el (em-prompt) (eshell-tests-helpers): * test/lisp/eshell/esh-util-tests.el (esh-util) (eshell-tests-helpers): * test/lisp/eshell/esh-var-tests.el (eshell) (eshell-tests-helpers): * test/lisp/eshell/eshell-tests.el (esh-mode) (eshell-tests-helpers): Load `eshell-tests-helpers' from the resource directory. * test/lisp/eshell/resources/eshell-tests-helpers.el: Move from `test/lisp/eshell'.
* Prefer oddp/evenp to free-coding them in testsStefan Kangas2025-02-171-1/+1
| | | | | | | | | | | | | | * test/lisp/emacs-lisp/bindat-tests.el (bindat-test--sint): * test/lisp/emacs-lisp/seq-tests.el (test-seq-drop-while) (test-seq-take-while, test-seq-filter, test-seq-remove) (test-seq-count, test-seq-some, test-seq-find, test-seq-every-p) (test-seq-group-by): * test/lisp/eshell/em-pred-tests.el (eshell-with-file-attributes-from-name): * test/lisp/filenotify-tests.el (file-notify-test07-many-events) (file-notify-test09-watched-file-in-watched-dir): * test/src/floatfns-tests.el (bignum-expt, bignum-round): * test/src/undo-tests.el (undo-test4): Prefer oddp/evenp to free-coding them.
* Update copyright year to 2025Paul Eggert2025-01-0125-25/+25
| | | | Run "TZ=UTC0 admin/update-copyright".
* Remove 'eshell-escape-arg'Jim Porter2024-11-233-24/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Eshell no longer needs this function, since all command parsing is performed first, with special syntax annotated with text properties as needed, as opposed to marking literal text with a property (bug#54486). * lisp/eshell/em-pred.el (eshell-modifier-alist): Make "q" modifier obsolete. (eshell-modifier-help-string): Remove mention of "q". * lisp/eshell/esh-arg.el (eshell-escape-arg): Make obsolete. (eshell-parse-backslash, eshell-parse-literal-quote) (eshell-parse-double-quote): Don't call 'eshell-escape-arg'. * lisp/eshell/esh-var.el (eshell-parse-variable): Don't call 'eshell-escape-arg'. * test/lisp/eshell/em-extpipe-tests.el (em-extpipe-test-2) (em-extpipe-test-9, em-extpipe-test-11): Remove 'eshell-escape-arg'. * test/lisp/eshell/em-pred-tests.el (em-pred-test/modifier-quote): Remove test. * test/lisp/eshell/esh-var-tests.el (esh-var-test/quoted-interp-var-indices) (esh-var-test/quote-interp-var-indices-subcommand): Remove workaround in tests. * doc/misc/eshell.texi (Argument Modifiers): Remove documentation of obsolete "q" modifier.
* Don't clobber stickiness text properties when printing Eshell promptJim Porter2024-11-141-4/+31
| | | | | | | | | | | * lisp/eshell/em-prompt.el (eshell--append-text-property): New function... (eshell-emit-prompt): ... use it. * test/lisp/eshell/em-prompt-tests.el (em-prompt-test/field-properties/merge-stickiness): New test. (em-prompt-test/field-properties, em-prompt-test/after-failure): Reorder stickiness values (bug#74230).
* ; * test/lisp/eshell/esh-cmd-tests.el: Fix last change.Jim Porter2024-11-031-1/+1
|
* Add support for range objects in Eshell "for" loopsJim Porter2024-11-031-0/+15
| | | | | | | | | | | | * lisp/eshell/esh-cmd.el (eshell-for-iterate): Add support for 'eshell-range' objects. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/for-loop-range): New test. * doc/misc/eshell.texi (Control Flow): Update documentation. * etc/NEWS: Announce this change.
* Move more of Eshell range handling to the parser phaseJim Porter2024-11-031-1/+7
| | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-util.el (eshell-range): New struct. (eshell--range-string-p, eshell--string-to-range): New functions. * lisp/eshell/esh-arg.el (eshell-parse-integer) (eshell-parse-range-token): New functions... (eshell-parse-argument-hook): ... add them. (eshell--after-range-token-regexp): New defsubst. (eshell-concat-1): Don't remove the 'number' property; we use that when handling range arguments. (eshell--range-token): New constant. (eshell-unmark-range-token): New function. * lisp/eshell/esh-var.el (eshell-parse-index): Update implementation to use parsed range argument. * test/lisp/eshell/esh-var-tests.el (esh-var-test/interp-var-indices): Test range index using variables.
* Improve handling of Eshell "for" loopsJim Porter2024-11-032-20/+29
| | | | | | | | | | | | | | | | | This fixes some errors with more-complex string forms, and also allows iterating over sequences other than just lists. * lisp/eshell/esh-cmd.el (eshell-for-iterate): New function... (eshell-rewrite-for-command): ... use it. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/for-loop): Test multiple values. (esh-cmd-test/for-loop-string, esh-cmd-test/for-loop-vector): New tests. (esh-cmd-test/for-loop-mixed-args): Rename. * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/sentinel/change-buffer): Make sure all the processes get cleaned up.
* Improve evaluation of conditional Eshell formsJim Porter2024-11-011-0/+30
| | | | | | | | | | | | | | | | | | | This simplifies the logic for building these forms and also fixes an issue where a subcommand in a "&&" or "||" conditional had its output suppressed. * lisp/eshell/esh-cmd.el (eshell-structure-basic-command): Make obsolete. (eshell-silence-test-command): New function... (eshell-rewrite-while-command, eshell-rewrite-if-command): ... use it, and make the command form ourselves. (eshell-parse-pipeline): Use 'and' and 'or' to make the conditional command sequence. (eshell-command-success): New macro. (eshell-do-eval): Add support for 'and' and 'or' forms. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/and-operator/output) (esh-cmd-test/or-operator/output): New tests.
* Improve correctness of Eshell globs when using escape charactersJim Porter2024-10-311-16/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new implementation opts *in* to treating characters as glob characters, rather than opting out. This reduces the need to coordinate with other parts of Eshell and should be harder to break (bug#74033). * lisp/eshell/em-glob.el (eshell-parse-glob-chars): Return the propertized globbing character directly. (eshell--propertize-glob, eshell--glob-char-p) (eshell--contains-glob-char-p, eshell--all-glob-chars-p): New functions. (eshell-glob-p): Make obsolete. (eshell-glob-regexp, eshell-glob-convert-1, eshell-glob-convert): Check for 'eshell-glob-char' property. (eshell-extended-glob): Remove text properties when returning no match. (eshell--glob-anything): New constant. (eshell-glob-entries): Propertize "*" to treat it as a glob. * lisp/eshell/em-ls.el (eshell-ls--expand-wildcards): New function... (eshell-ls--insert-directory): ... use it. * test/lisp/eshell/em-glob-tests.el: Use 'eshell--propertize-glob' in tests. (em-glob-test/convert/literal-characters) (em-glob-test/convert/mixed-literal-characters): New tests. * lisp/eshell/em-glob.el (eshell-expand-glob): Rename from 'eshell-extended-glob'. Update callers. (eshell-extended-glob): New function to expand a GLOB that hasn't been propertized yet, for use outside of Eshell command forms. (eshell-parse-glob-chars): Return the propertized globbing character directly. (eshell-parse-glob-string, eshell--glob-char-p) (eshell--contains-glob-char-p, eshell--all-glob-chars-p): New functions. (eshell-glob-regexp, eshell-glob-convert-1, eshell-glob-convert): Check for 'eshell-glob-char' property. (eshell-glob-p): Make obsolete. (eshell--glob-anything): New constant... (eshell-glob-entries): ... use it. * lisp/eshell/em-ls.el (eshell-ls--expand-wildcards): New function... (eshell-ls--insert-directory): ... use it. * test/lisp/eshell/em-glob-tests.el: Use 'eshell-parse-glob-string in tests. (em-glob-test/convert/literal-characters) (em-glob-test/convert/mixed-literal-characters): New tests.
* Fix and improve behavior of 'eshell/clear'Jim Porter2024-10-311-0/+42
| | | | | | | | | | | | | | | * lisp/eshell/esh-mode.el (eshell-clear): New function. (eshell/clear): Fix incorrect behavior, and do the right thing when 'eshell-scroll-show-maximum-output' is nil. (eshell/clear-scrollback): Call 'eshell/clear'. * test/lisp/eshell/esh-mode-tests.el (esh-mode-test/clear/eshell-command) (esh-mode-test/clear/eshell-command/erase) (esh-mode-test/clear/emacs-command) (esh-mode-test/clear/emacs-command/erase): New tests. * etc/NEWS: Mention the new 'eshell-command' (bug#73722).
* Merge from origin/emacs-30Eli Zaretskii2024-10-271-1/+1
|\ | | | | | | | | | | | | c78b4d2b31d Fix doc string of 'wdired-use-dired-vertical-movement' b0aaee93fde Update the documentation of void functions 299a1f24075 ; * lisp/vc/log-edit.el (log-edit-diff-function): Grammar... 67a27ff53bf ; Fix typos
| * ; Fix typosStefan Kangas2024-10-271-1/+1
| |
* | Fix Eshell incompatibility with "[" command when eshell-pred is disabledJim Porter2024-10-261-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/em-pred.el (eshell-pred-initialize): Ensure that 'eshell-parse-arg-modifier' is called before 'eshell-parse-glob-chars'. * lisp/eshell/em-glob.el (eshell-glob-initialize): Use a number for hook depth to be clearer. (eshell-parse-glob-chars): Simplify; since eshell-pred's hook now runs first, the extra code is no longer necessary. * test/lisp/eshell/em-glob-tests.el (em-glob-test/test-command-without-pred): New test.
* | ; Ensure 'eshell-split-filename' doesn't expand the filename firstJim Porter2024-10-261-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-util.el (eshell-split-filename): Never expand the filename. * lisp/eshell/em-glob.el (eshell-glob-p): A leading "~" isn't a globbing character. * test/lisp/eshell/esh-util-tests.el (esh-util-test/split-filename/absolute) (esh-util-test/split-filename/relative) (esh-util-test/split-filename/user) (esh-util-test/split-filename/remote-absolute) (esh-util-test/split-filename/remote-relative) (esh-util-test/split-filename/remote-user): New tests.
* | Merge from origin/emacs-30Sean Whitton2024-10-241-3/+13
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | f5451b6a066 ; Improve comment from last change 09e05f7ee4d Document and-let* vs. when-let* usage convention b7a375f5c49 Fix error when splicing Eshell globs and a glob expands t... 2289e162268 * etc/package-keyring.gpg: Update expiration and add new key 48024096fea Avoid crashes when scrolling images under winner-mode c35d6ba9f07 ; * doc/lispref/display.texi (Fontsets): Clarify wording. 88a1a32fc57 ; * doc/lispref/display.texi (Fontsets): Fix typo. 6be47058cd7 ; Add indexing for 'use-default-font-for-symbols' 681f70ea04a * src/lread.c (READ_AND_BUFFER): Reject negative chars (b... ac4151e0023 * test/Makefile.in: Do not show emacs-module-tests.log by... 4e0cb960dbd Fix 'php-ts-mode': better indentation and font locking
| * Fix error when splicing Eshell globs and a glob expands to itselfJim Porter2024-10-221-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | This could happen when 'eshell-extended-glob' determines that a "glob" is not really a glob. This mainly happens for remote file names with a "~" in them, like "/ssh:remote:~/file.txt". * lisp/eshell/em-glob.el (eshell-extended-glob): Return a list when 'eshell-glob-splice-results' is non-nil. * test/lisp/eshell/em-glob-tests.el (em-glob-test/expand/splice-results) em-glob-test/expand/no-splice-results): Extend tests.
* | Be more careful about applying spliced argumentsJim Porter2024-10-201-2/+4
| | | | | | | | | | | | | | | | | | | | Previously, this could 'nonc' to a list that shouldn't be modified. * lisp/eshell/esh-cmd.el (eshell-rewrite-named-command): Use 'append' instead of 'nconc'. * test/lisp/eshell/esh-var-tests.el (esh-var-test/interp-var-splice): (esh-var-test/quoted-interp-var-splice): New tests.
* | Lazily convert numeric strings to Lisp numbers in EshellJim Porter2024-10-192-60/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This should reduce the number of issues with Eshell converting strings to numbers too aggressively and losing information (e.g. "001" -> 1) while still allowing almost all of the beneficial uses, like summing a list of numeric strings with '+'. * lisp/eshell/esh-util.el (eshell--do-mark-numeric-string): New function. (eshell-convert-to-number): Make obsolete in favor of... (eshell-mark-numeric-string): ... this. Update callers. * lisp/eshell/esh-arg.el (eshell--numberlike-p): New function... (eshell-concat-1): ... use it. * test/lisp/eshell/esh-util-tests.el: Reimplement type conversion tests to use 'eshell-convertible-to-number-p' instead. * test/lisp/eshell/esh-var-tests.el (esh-var-test/interp-var-splice-concat, esh-var-test/interp-concat-cmd) (esh-var-test/interp-convert-var-split-indices) (esh-var-test/interp-convert-quoted-var-split-indices) (esh-var-test/interp-convert-cmd-multiline) (esh-var-test/interp-convert-cmd-split-indices): Adjust tests to check the new behavior. * doc/misc/eshell.texi (Type Conversion): New section. (Expansion): Clarify concatenation behavior.
* | Add support for chaining conditionals in EshellJim Porter2024-10-161-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-cmd.el (eshell-structure-basic-command): Check for the presence of the conditional. Allow any number of BODY forms. (eshell-rewrite-if-command): Add support for 'else' keyword and chained conditionals. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/if-else-statement): Test 'else' keyword. (esh-cmd-test/if-else-statement-chain): New test. * doc/misc/eshell.texi (Control Flow): Document this change. * etc/NEWS: Announce this change.
* | Improve correctness of Eshell sub-formsJim Porter2024-10-163-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes sure that we treat Eshell sub-forms (whether Lisp or command forms) as values when appropriate, or as regular invocations. This requires a bit more explicit work, but helps to resolve some of the surprising differences between Lisp and command forms in complex Eshell statements. * lisp/eshell/esh-cmd.el (eshell-subcommand-arg-values): Make obsolete. (eshell-parse-lisp-argument): Don't add 'eshell-command-to-value' here. (eshell-rewrite-sexp-command): Don't check for 'eshell-command-to-value here'; instead check for 'eshell-lisp-command'. (eshell-structure-basic-command): Check for 'eshell-lisp-command'. (eshell-term-as-value): New function... (eshell-rewrite-named-command, eshell-rewrite-for-command): ... call it. * lisp/eshell/esh-arg.el (eshell-parse-special-reference): * lisp/eshell/esh-io.el (eshell-strip-redirections): * lisp/eshell/esh-var.el (eshell-prepare-indices): Call 'eshell-term-as-value'. * test/lisp/eshell/esh-arg-tests.el (esh-arg-test/special-reference/command-form): * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/for-loop-lisp-body) (esh-cmd-test/while-loop-lisp-body) (esh-cmd-test/if-else-statement-lisp-body): New tests. * test/lisp/eshell/esh-var-tests.el (esh-var-test/interp-var-indices-subcommand): Add another command to test. * doc/misc/eshell.texi (Control Flow): Update documentation.
* | Merge from origin/emacs-30Eli Zaretskii2024-10-051-0/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | b68b9f291cc ; * lisp/progmodes/csharp-mode.el (treesit-query-compile)... 688201ef18d ; * lisp/window.el (switch-to-prev-buffer-skip-regexp): D... ba44fc9a447 Restore comment/string check for 'electric-layout-mode' 5a462948e13 Update Arni Magnusson's email address 6b1271b169a Fix python-ts-mode-map docstring aaaafddc945 Normalize "Commentary" section in eudc.el d656be9794d Expand email abbrevs in X-Debbugs-Cc header. e9dcf0c57dd Fix 'list-tags' when invoked from a non-file buffer 51ef05f684c count-windows: Fix reference to walk-windows 5eaf0c784bf * lisp/info-look.el (mapc): Add use-package manual's index. 705a5a1a9e6 ; * ChangeLog.4: Fix attribution of one change. bf26ff0dc8d Update csharp-ts-mode font-lock (bug#73369) 4c866abab96 ; * doc/lispref/variables.texi (Creating Buffer-Local): F... d42d7d474fe ; * lisp/doc-view.el (doc-view-svg-face): Copy-edit docst... f46f476bb8f ; * admin/MAINTAINERS: Take VC subsystem, add note about ... d68e6d2689d ; rcirc-update-activity-string: Justify some existing beh... e6a37869c8d Fix inconsistency in value of rcirc-activity-string 108b3179bd4 Revert "; Minor clarification in variables.texi" 44156c21407 ; Minor clarification in variables.texi 63058e1153a Tag interactive commands in 'lua-ts-mode' 84bea20eba2 ; * lisp/info-look.el: Add two more links. 96b87ad5363 Mention LSP acronym in eglot defgroup docstring 9c904e8ceae Change :group of 'eglot' defgroup to 'tools' fd1a1b07805 Remove out-of-date documentation from python.el 11e3e0cadd4 Fix executing commands in Eshell using "env" with no loca... c0ef8a9a1b3 Fix a typo in the calendar manual 36ff7138feb ; Fix a thinko in sieve-manage.el 7abecbcd633 ; * nt/INSTALL: Update MinGW notes URL. (Bug#73528) # Conflicts: # admin/MAINTAINERS
| * Fix executing commands in Eshell using "env" with no local variablesJim Porter2024-09-291-0/+5
| | | | | | | | | | | | | | | | * lisp/eshell/esh-var.el (eshell/env): Throw 'eshell-replace-command' as needed. * test/lisp/eshell/esh-var-tests.el (esh-var-test/local-variables/env/no-locals): New test (bug#73479).
| * Fix redirecting Eshell output to symbols in some placesJim Porter2024-08-293-6/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not merge to master. * lisp/eshell/esh-io.el (eshell-output-object-to-target): Don't require TARGET to be bound. * lisp/eshell/em-script.el (eshell-execute-file): Quote the output/error targets. * test/lisp/eshell/em-script-tests.el (eshell-execute-file-output): New variable. (em-script-test/execute-file/output-file) (em-script-test/execute-file/output-symbol): New tests. * test/lisp/eshell/esh-io-tests.el (eshell-test-file-string): Move to... * test/lisp/eshell/eshell-tests-helpers.el (eshell-test-file-string): ... here.
* | Support "/dev/null" as a target when creating Eshell handlesJim Porter2024-08-281-0/+8
| | | | | | | | | | | | | | | | | | | | | | Previously, you could only use this when setting the handle afterwards. * lisp/eshell/esh-io.el (eshell-set-output-handle): Don't catch 'eshell-null-device' here... (eshell-get-target): ... catch it here. * test/lisp/eshell/eshell-tests.el (eshell-test/eshell-command/output-dev-null): New test (bug#72857).
* | Fix redirecting Eshell output to symbols in some placesJim Porter2024-08-282-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-io.el (eshell-output-object-to-target): Don't require TARGET to be bound. * lisp/eshell/em-script.el (eshell-execute-file): * lisp/eshell/eshell.el (eshell-command): Quote the output/error targets. * test/lisp/eshell/em-script-tests.el (eshell-execute-file-output): New variable. (em-script-test/execute-file/output-symbol): New test. * test/lisp/eshell/eshell-tests.el (eshell-command-output): New variable. (eshell-test/eshell-command/output-symbol): New test (bug#72857).
* | Use 'eshell-with-handles' in a few more placesJim Porter2024-08-284-6/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/em-alias.el (eshell-write-aliases-list): * lisp/eshell/em-script.el (eshell-batch-file): * lisp/eshell/esh-cmd.el (eshell-command-to-value): * lisp/eshell/eshell.el (eshell-command): Use 'eshell-with-handles'. * test/lisp/eshell/esh-io-tests.el (eshell-test-file-string): Move to... * test/lisp/eshell/eshell-tests-helpers.el (eshell-test-file-string): ... here. * test/lisp/eshell/eshell-tests.el (eshell-test/eshell-command/output-file): * test/lisp/eshell/em-script-tests.el (em-script-test/execute-file/output-file): New tests.
* | Use 'unwind-protect' to ensure that Eshell always closes I/O handlesJim Porter2024-07-272-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See bug#72220. * lisp/eshell/esh-cmd.el (eshell-with-handles): New macro... (eshell-commands): ... use it. (eshell-with-copied-handles): Remove STEAL-P and allow multiple body forms (this is an incompatible change, but the macro is currently internal despite the name). (eshell-parse-command, eshell-do-pipelines) (eshell-do-pipelines-synchronously, eshell--invoke-command-directly-p): Remove handle stealing. (eshell-structure-basic-command, eshell-do-command) (eshell-lisp-command): Remove 'eshell-close-handles'. (eshell-protect): Make obsolete. (eshell-rewrite-for-command, eshell-rewrite-while-command) (eshell-rewrite-if-command, (eshell-parse-pipeline): Remove 'eshell-protect'. * lisp/eshell/esh-io.el (eshell-duplicate-handles): Make STEAL-P obsolete. * lisp/eshell/esh-proc.el (eshell-gather-process-output): Call 'eshell-protect-handles' one more time. Remove 'eshell-close-handles'. * lisp/eshell/esh-var.el (eshell-parse-variable-ref): Reimplement $<COMMAND> form using 'eshell-with-handles'. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/command-not-found/pipeline): New test. * test/lisp/eshell/em-tramp-tests.el (em-tramp-test/should-replace-command): Adjust check for 'eshell-with-copied-handles'.
* | Don't set exit info in Eshell if the command is being piped elsewhereJim Porter2024-07-191-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the exit info in Eshell was that of the last command that finished, rather than the last command in a pipeline. * lisp/eshell/esh-cmd.el (eshell-exec-lisp) (eshell-lisp-command): Check whether the command is being piped. * lisp/eshell/esh-proc.el (eshell-gather-process-output): Record whether the command is being piped... (eshell-sentinel): ... and do the right thing with that info. * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/sigpipe-exits-process): Check the exit status to ensure we don't report the first process's SIGPIPE exit.
* | Improve implementation of built-in Eshell "kill" commandJim Porter2024-07-181-0/+24
| | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-proc.el (eshell/kill): Fix handling of commands like "kill 123". Use REMOTE when signalling PIDs in remote directories. Signal using process objects when possible. Report errors when failing to signal. * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/kill/process-id) (esh-proc-test/kill/process-object): New tests (bug#72013).
* | Improve handling of deferrable Eshell commandsJim Porter2024-07-183-3/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now, we use the 'eshell-deferrable' wrapper to wrap a form that returns a process (or list thereof). This improves upon the old method, which failed to handle 'eshell-replace-command' correctly. In that case, Eshell would fail to unmark commands as deferrable when necessary (e.g. for commands in pipelines). * lisp/eshell/esh-cmd.el (eshell-deferrable-commands): Make into a defvar. (eshell-deferrable): New function... (eshell-structure-basic-command): ... use it. (eshell-trap-errors): Rename to... (eshell-do-command): ... this, and use 'eshell-deferrable'. Update callers. (eshell--unmark-deferrable): Remove. Update callers. (eshell-execute-pipeline): Remove 'eshell-process-identity'. (eshell-process-identity, eshell-named-command*, eshell-lisp-command*): Make obsolete. * test/lisp/eshell/esh-cmd-tests.el (eshell-test-replace-command): New function. (esh-cmd-test/pipeline/replace-command): New test.
* | Merge from savannah/emacs-30Po Lu2024-07-121-1/+13
|\| | | | | | | | | | | a5ef9e25680 Document means of executing Emacs from unrelated Android ... 0de0056fd6b Don't emit a prompt in Eshell when a background command i... ec1e300a215 Fix reference from buffer-stale-function docstring
| * Don't emit a prompt in Eshell when a background command is killedJim Porter2024-07-111-1/+13
| | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-cmd.el (eshell-resume-command): Check for background-ness before resetting the prompt. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/background/simple-command): Make the regexp a bit stricter. (esh-cmd-test/background/kill): New test.
| * Always perform Eshell process cleanup runs in the Eshell bufferJim Porter2024-06-251-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, some code executed in a timer, which could execute in the wrong buffer, leading to a hang. * lisp/eshell/esh-proc.el (eshell-sentinel): Use 'with-current-buffer' in the timer function. * test/lisp/eshell/esh-proc-tests.el (eshell-test-value): New variable. (esh-proc-test/sentinel/change-buffer): New test. (cherry picked from commit da4bc5c9274a6705501e24fb8f2984f5bf5fe099)
* | Allow using multiple buffers in 'eshell-command'Thierry Volpiatto2024-07-051-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide the same functionality as 'async-shell-command-buffer' but for 'eshell-command'. Co-Authored-By: Jim Porter <jporterbugs@gmail.com> * lisp/eshell/eshell.el (eshell-command-async-buffer): New option... (eshell-command): ... use it. * lisp/eshell/esh-proc.el (eshell-sentinel): Check for buffer liveness in 'finish-io'. * test/lisp/eshell/eshell-tests.el (eshell-test/eshell-command/output-buffer/async-kill): New test. * etc/NEWS: Announce this change (bug#71554).
* | Always perform Eshell process cleanup runs in the Eshell bufferJim Porter2024-06-251-0/+16
|/ | | | | | | | | | | Previously, some code executed in a timer, which could execute in the wrong buffer, leading to a hang. * lisp/eshell/esh-proc.el (eshell-sentinel): Use 'with-current-buffer' in the timer function. * test/lisp/eshell/esh-proc-tests.el (eshell-test-value): New variable. (esh-proc-test/sentinel/change-buffer): New test.
* Ensure navigating by paragraphs in Eshell stops at prompts and paragraphsJim Porter2024-06-201-1/+48
| | | | | | | | | | | | | | | The previous implementation in 6ae2b74ed20 only stopped at prompts, which isn't the right behavior (bug#61545). * lisp/eshell/em-prompt.el (eshell-forward-paragraph) (eshell-backward-paragraph): Reimplement to handle prompts and paragraphs (the latter by calling the original 'forward-paragraph'). * test/lisp/eshell/em-prompt-tests.el (em-prompt-test/next-previous-prompt/multiline): Rename. (em-prompt-test/forward-backward-paragraph-1): New function. (em-prompt-test/forward-backward-paragraph) (em-prompt-test/forward-backward-paragraph/multiline): New tests.
* Fix Eshell "which" test on MS-WindowsJim Porter2024-06-152-8/+11
| | | | | | | | | * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/which/plain/external-program): Compare the file name case-insensitively on case-insensitive file systems. * test/lisp/eshell/eshell-tests-helpers.el (eshell-command-result--equal): Revert to the previous implementation.
* Fix em-extpipe-tests on MS-WindowsEli Zaretskii2024-06-151-1/+5
| | | | | * test/lisp/eshell/em-extpipe-tests.el (em-extpipe-test-14): Fix test on MS-Windows (bug#71446).
* ; Improve last changeJim Porter2024-06-151-3/+10
| | | | | * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/kill-pipeline): Fix check of exit message and ensure we have only one prompt.
* ; Add command logging to some more Eshell testsJim Porter2024-06-151-20/+22
| | | | | * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/kill-pipeline) (esh-proc-test/kill-pipeline-head): Write debug logs on failure.
* ; Minor editorial fixes to some Eshell testsJim Porter2024-06-131-10/+10
| | | | | | | * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/kill-process/redirect-message): Move next to its sibling tests. (esh-proc-test/remote/remote-path): Rename from 'esh-var-test/...'.
* Fix recently added eshell testStefan Kangas2024-06-101-7/+8
| | | | | * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/empty-background-command): Fix failing test.
* Improve correctness of 'eshell-quote-argument'Jim Porter2024-06-093-25/+21
| | | | | | | | | | | | | | | | | | * lisp/eshell/esh-arg.el (eshell-quote-argument): Mention that this function is for use within Eshell buffers. (eshell-quote-backslash): Properly quote newlines. * lisp/eshell/em-unix.el (eshell/cat, eshell/du): Throw 'eshell-external' instead; that's what it's here for. * test/lisp/eshell/esh-proc-tests.el (esh-proc-test-quote-argument): Remove. (esh-proc-test/emacs-command): * test/lisp/eshell/esh-var-tests.el (esh-var-test/path-var/set) (esh-var-test/path-var/set-locally): Use 'eshell-quote-argument'. * test/lisp/eshell/em-unix-tests.el (em-unix-test/compile/interactive): Use 'shell-quote-argument' (Note: *not* 'eshell-...').
* Remove empty Eshell commands when parsingJim Porter2024-06-091-0/+10
| | | | | | | | | | | | | | | | | This improves the logic for copying/stealing handles when constructing the command form: now, we should always steal the handles for the last real command, even if there were some trailing semicolons. * lisp/eshell/esh-arg.el (eshell-parse-delimiter): Be stricter about parsing so that things like "& &" aren't parsed as a single "&&" token. * lisp/eshell/esh-cmd.el (eshell-parse-command): Get the commands in reverse, and remove any nil commands. (eshell-split-commands): Always return the trailing terms (except when there were no terms to begin with). * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/empty-background-command): New test.
* ; Allow batch-file Eshell test on MS-WindowsEli Zaretskii2024-06-091-1/+0
| | | | | * test/lisp/eshell/em-script-tests.el (em-script-test/batch-file): Don't skip on MS-Windows, as the test was fixed.
* ; Add another test for 'eshell-batch-script'Jim Porter2024-06-091-0/+12
| | | | | | | | * lisp/eshell/em-script.el (eshell-close-target): New function. * test/lisp/eshell/em-script-tests.el (em-script-test/batch-file): New test; rename old one to... (em-script-test/batch-file/shebang): ... this.
* A better fix for esh-proc-tests on MS-WindowsEli Zaretskii2024-06-091-14/+10
| | | | | | | | * test/lisp/eshell/esh-proc-tests.el (esh-proc-test-quote-argument): New function. (esh-proc-test/emacs-command): Use it instead of 'shell-quote-argument', which allows to go back to system-independent code.
* Fix Eshell tests on MS-WindowsEli Zaretskii2024-06-096-14/+35
| | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-util.el (eshell-get-path): Don't add "." if it is already there. * test/lisp/eshell/esh-var-tests.el (esh-var-test/path-var/preserve-across-hosts): Skip on MS-Windows. (esh-var-test/path-var/set, esh-var-test/path-var/set-locally): Quote the PATH value, for MS-Windows. * test/lisp/eshell/esh-util-tests.el (esh-util-test/path/get): No need to add ".": it is already done by 'eshell-get-path'. * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/kill-pipeline): Accept empty string as valid output. (esh-proc-test/sigpipe-exits-process): Skip on MS-Windows: no SIGPIPE. (esh-proc-test/emacs-command): Quote correctly for MS-Windows. * test/lisp/eshell/em-unix-tests.el (em-unix-test/compile/interactive): Fix test on MS-Windows. * test/lisp/eshell/em-script-tests.el (em-script-test/batch-file): Skip on MS-Windows. * test/lisp/eshell/eshell-tests-helpers.el (eshell-command-result--equal): Compare strings (file names) case-insensitively on MS-Windows.