aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/eshell (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Simplify parsing subcommands slightlyJim Porter2023-03-281-1/+1
| | | | | | | | | | | | | | | | This mainly reduces some overly-deep indentation, but also fixes some minor issues with the "$<subcmd>" form: it unnecessarily added " > TEMP" (we already set this later via 'eshell-create-handles'), and it didn't properly unescape inner double quotes. * lisp/eshell/esh-cmd.el (eshell-parse-subcommand-argument): Simplify. * lisp/eshell/esh-var.el (eshell-parse-variable-ref): Simplify and fix edge cases in "$<subcmd>". * test/lisp/eshell/esh-var-tests.el (esh-var-test/quoted-interp-temp-cmd): Adjust test to check behavior of inner double quotes.
* ; Fix typo in docstringJim Porter2023-03-111-1/+1
| | | | | * test/lisp/eshell/em-cmpl-tests.el (em-cmpl-test/variable-assign-completion/non-assignment): Fix typo.
* Add support for completing special references (e.g. buffers) in EshellJim Porter2023-03-112-0/+70
| | | | | | | | | | | | | | | | | | | * lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): Handle special references. * lisp/eshell/em-arg.el (eshell-parse-special-reference): Ensure point is just after the "#<" when incomplete, and handle backslash escapes more thoroughly. (eshell-complete-special-reference): New function. * test/lisp/eshell/esh-arg-tests.el (esh-arg-test/special-reference/default) (esh-arg-test/special-reference/buffer) (esh-arg-test/special-reference/special): * test/lisp/eshell/em-cmpl-tests.el (em-cmpl-test/special-ref-completion/type) (em-cmpl-test/special-ref-completion/implicit-buffer) (em-cmpl-test/special-ref-completion/buffer): New tests.
* Be more cautious in completing Eshell variable assignmentsJim Porter2023-02-251-0/+14
| | | | | | | | | | | | | Previously, Eshell treated cases like the second argument in "tar --directory=dir" as a variable assignment, but that prevented 'pcomplete/tar' from implementing its own completion for that argument (bug#61778). * lisp/eshell/esh-var.el (eshell-complete-variable-assignment): Only handle completion when all initial arguments are variable assignments. * test/lisp/eshell/em-cmpl-tests.el (em-cmpl-test/variable-assign-completion/non-assignment): New test.
* Don't add a space after the trailing slash when completing ~USER in EshellJim Porter2023-02-231-3/+2
| | | | | | | | | | | This provides a programmed completion function that works similarly to ~USER completion in 'completion-file-name-table'. * lisp/eshell/em-dirs.el (eshell-complete-user-reference): Throw a programmed completion function. * test/lisp/eshell/em-cmpl-tests.el (em-cmpl-test/user-ref-completion): Update test.
* Add support for completing quoted variables in Eshell like $'FOO'Jim Porter2023-02-231-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | This also adds the ability for Pcomplete handlers to set their own exit functions that will get called as appropriate. * lisp/pcomplete.el (pcomplete-default-exit-function): New function. (pcomplete-exit-function): New variable... (pcomplete-completions-at-point): ... let-bind and use it. * lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): Handle quoted variables. We also build the 'posns' list from right-to-left now. * lisp/eshell/esh-var.el (eshell-envvar-names): Ensure that variable aliases are included in this list. (eshell-complete-variable-reference): Handle quoted variables and set the exit function on the completions. (eshell-variables-list): Simplify. We now add the trailing slash for directories in the exit function inside 'eshell-complete-variable-reference'. * test/lisp/eshell/em-cmpl-tests.el (em-cmpl-test/quoted-variable-ref-completion) (em-cmpl-test/variable-ref-completion/directory): New tests.
* Allow unloading EshellJim Porter2023-02-151-0/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/em-extpipe.el (eshell-extpipe): * lisp/eshell/esh-opt.el (eshell-opt): New groups. Eshell uses these to identify modules to unload. * lisp/eshell/em-hist.el (eshell-hist-unload-hook): * lisp/eshell/em-ls.el (eshell-ls-unload-hook): * lisp/eshell/em-smart.el (eshell-smart-unload-hook): * lisp/eshell/eshell.el (eshell-unload-hook): Make obsolete and move to... * lisp/eshell/em-smart.el (em-smart-unload-function): * lisp/eshell/em-hist.el (em-hist-unload-function): * lisp/eshell/em-ls.el (em-ls-unload-function): * lisp/eshell/eshell.el (eshell-unload-function): ... these. * lisp/eshell/esh-mode.el (eshell-mode-unload-hook): * lisp/eshell/esh-module.el (eshell-module-unload-hook): Make obsolete. * lisp/eshell/em-ls (eshell-ls-enable-in-dired, eshell-ls-disable-in-dired): New functions... (eshell-ls-use-in-dired): ... use them. * lisp/eshell/esh-module.el (eshell-module--feature-name, eshell-unload-modules): New functions. (eshell-unload-extension-modules): Use 'eshell-unload-modules'. * lisp/eshell/eshell.el (eshell-unload-all-modules): Remove. * test/lisp/eshell/eshell-tests-unload.el: New file. * doc/misc/eshell.texi (Bugs and ideas): Remove item about unloading Eshell not working. * etc/NEWS: Announce this change (bug#61501).
* Ensure that Eshell users can run lines of command output as inputJim Porter2023-02-092-4/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, this failed to work properly because any additional input the user entered would have no 'field' property, confusing 'eshell-get-old-input'. To fix this, we simply ensure that any user-entered text in the output field retains said output field (bug#61310). * lisp/eshell/esh-util.el (eshell-command-output-properties): New variable. (eshell--mark-as-output, eshell--mark-yanked-as-output): New functions, mostly copied from comint. * lisp/eshell/esh-proc.el (eshell-interactive-process-filter): * lisp/eshell/esh-mode.el (eshell-interactive-print): Call 'eshell--mark-as-output'. (eshell-get-old-input): Remove properties from the returned string just to be safe. * test/lisp/eshell/eshell-tests.el (eshell-test-value): New variable. (eshell-test/get-old-input/rerun-command) (eshell-test/get-old-input/run-output): New tests. * test/lisp/eshell/em-prompt-tests.el (em-prompt-test/field-properties) (em-prompt-test/field-properties/no-highlight): Use 'eshell-command-output-properties'.
* Ensure that deferred commands don't make Eshell forget let-bound valuesJim Porter2023-02-091-0/+17
| | | | | | | | | | | * lisp/eshell/esh-cmd.el (Command evaluation macros): Expand this documentation to list allowed special forms and caveats for working with 'if' and 'while'. (eshell-do-eval): Provide more detail in docstring. Handle 'eshell-defer' inside 'let' forms. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/let-rebinds-after-defer): New test (bug#59469).
* During completion, convert all Eshell arguments to stringsJim Porter2023-01-301-12/+42
| | | | | | | | | | | | | | | | | | | Eshell was already converting some types (numbers, nil) to strings, as well as fixing up multiple-dot forms like ".../", so this way is more consistent and should produce fewer problems for Pcomplete functions. * lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): Always convert parsed arguments to strings. * test/lisp/eshell/em-cmpl-tests.el (eshell-arguments-equal, eshell-arguments-equal--equal-explainer): New functions. (em-cmpl-test/parse-arguments/pipeline) (em-cmpl-test/parse-arguments/multiple-dots) (em-cmpl-test/parse-arguments/variable/numeric) (em-cmpl-test/parse-arguments/variable/nil) (em-cmpl-test/parse-arguments/variable/list) (em-cmpl-test/parse-arguments/variable/splice): Use 'eshell-arguments-equal'.
* Properly parse Eshell variable splices for interactive completionJim Porter2023-01-301-0/+8
| | | | | | | | | | | | Previously, the code simply ignored the splice operator, which usually worked, but isn't actually correct. * lisp/eshell/em-cmpl.el (eshell-complete-eval-argument-form): New function. (eshell-complete-parse-arguments): Properly parse variable splices. * test/lisp/eshell/em-cmpl-tests.el (em-cmpl-test/parse-arguments/variable/splice): New test.
* Add regression tests for Eshell completionsJim Porter2023-01-301-0/+170
| | | | | | | * lisp/eshell/esh-cmd.el (eshell-complete-lisp-symbols): Fix docstring. * test/lisp/eshell/em-cmpl-tests.el: New file.
* Make 'eshell-number-regexp' into a regular defvarJim Porter2023-01-271-0/+65
| | | | | | | | | | | | | | | | | This isn't a very useful thing to customize, since it needs to detect numbers that can successfully be parsed by 'string-to-number'. Changes to this variable would therefore likely requiring adjusting 'eshell-convert-to-number' as well. * lisp/eshell/esh-util.el (eshell-number-regexp): Make into a defvar and improve the regexp to support more numbers (including infinity and NaN). * test/lisp/eshell/esh-util-tests.el (esh-util-test/eshell-convert-to-number/floating-point) (esh-util-test/eshell-convert-to-number/floating-point-exponent) (esh-util-test/eshell-convert-to-number/non-numeric) (esh-util-test/eshell-convert-to-number/no-convert): New tests.
* Add support for negative indices and index ranges in EshellJim Porter2023-01-271-23/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-util.el (eshell-integer-regexp): New defvar. * lisp/eshell/esh-var.el (eshell-parse-indices): Expand docstring. (eshell-parse-index): New function. (eshell-apply-indices): Use 'eshell-parse-index' to determine whether to treat the first index as a regexp. Simplify the implementation a bit. (eshell-index-range): New pcase macro... (eshell-index-value): ... use it, and restructure the implementation. * test/lisp/eshell/esh-var-tests.el (esh-var-test/interp-var-indices): New function... (esh-var-test/interp-var-indices/list) (esh-var-test/interp-var-indices/vector) (esh-var-test/interp-var-indices/ring) (esh-var-test/interp-var-indices/split): ... use it. (esh-var-test/interp-var-string-split-indices) (esh-var-test/interp-var-regexp-split-indices) (esh-var-test/interp-var-assoc): Expand tests to cover things that look like numbers or ranges, but aren't. * doc/misc/eshell.texi (Variables): Describe how to get all arguments of the last command. (Dollars Expansion): Explain negative indices and index ranges. (Bugs and ideas): Remove now-implemented ideas. * etc/NEWS: Announce this change.
* Merge from origin/emacs-29Stefan Kangas2023-01-271-0/+13
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | f8c95d1a768 Fix xt-mouse on terminals that report UTF-8 encoded coord... 4bf7cb71edc Fix go-ts-mode indentation and set indent offset to 8 (Bu... ff9498624fc ; * src/insdel.c (insert_from_buffer): Fix assertions. 41f497c8bee Fix doc strings of window-splitting commands cdf74254ffa Fix indentation for c-ts-mode (bug#61026) 4bd06ce2a9f Fix call to treesit_record_change in insdel.c 00675aa724a Add support for building tree-sitter modules with MinGW af28191b04f * lisp/net/tramp.el (tramp-wrong-passwd-regexp): Fix regexp. 42e02480c2b * doc/emacs/text.texi (Outline Minor Mode): New node spli... 37c1c924666 ; * etc/NEWS: Minor reordering. cfb180329b5 ruby-ts-mode: Don't reindent when "class" or "def" is und... abb3becb9fb treesit-install-language-grammar: Provide default repo url c6613403e5c Fix Dired face for directory symlinks 37454de0c8f Pacify --without-x unused function warning 9a21cb10751 ; * etc/NEWS: Fix typos. f30a4f51fef Announce outline.el keymaps 8198803f660 ; Don't mention in the Gnus manual user options that were... 8a1498c01f7 Fix fontification of function-valued variables (bug#61053) cfe26f31893 Add new java indent rules 987e53f3e2d ; * doc/misc/erc.texi: Improve Local Modules section. 3846e79c93b ; Fix filename mismatches in prop lines of ERC tests ecf500b5e34 Handle relative file names in vc-resynch-window and vc-re... 695e9f71c3f Use named keymaps for outline buttons e31a5623965 * lisp/vc/vc-bzr.el (vc-bzr--pushpull): Return buffer's p... deee3a92623 ; Fix last change in etc/NEWS bc78285e686 ; * etc/NEWS: Fix typos. c15c0f7f018 CC Mode: Change the default value of objc-font-lock-extra... 7f438ff543b Don't try to make a pipe process for remote processes in ... cb9628373a8 * lisp/startup.el (command-line): Fix warning message. (... e6c5f32e77d * lisp/find-dired.el (find-dired): Fix bug where M-p skip... # Conflicts: # etc/NEWS
| * 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.
* | ; * test/lisp/eshell/esh-var-tests.el: Fix punctuation in doc strings.Eli Zaretskii2023-01-211-72/+70
| |
* | Fix evaluation of asynchronous expansions in Eshell indicesJim Porter2023-01-191-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, this code passed the indices to a separate function, which called 'eval' on them, but it should instead make an S-expr that 'eshell-do-eval' can evaluate (bug#60942). * lisp/eshell/esh-var.el (eshell-eval-indices): Mark obsolete. (eshell-prepare-indices): New function... (eshell-parse-variable): ... use it. Also, remove irrelevant comment. (eshell-parse-variable-ref): Fix quoting in docstring. (eshell-parse-indices): Fix typo in docstring. * test/lisp/eshell/esh-var-tests.el (esh-var-test/interp-var-indices-subcommand) (esh-var-test/quoted-interp-var-indices-subcommand): New tests.
* | ; Fix Eshell prompt tests when the current user is rootJim Porter2023-01-171-2/+4
| | | | | | | | | | | | | | * test/lisp/eshell/em-prompt-tests.el (em-prompt-test/field-properties) (em-prompt-test/field-properties/no-highlight): Handle the case when the current user is root.
* | Add 'file-user-uid' to get the connection-local effective UIDJim Porter2023-01-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In particular, this lets Eshell show a "#" root prompt sigil when the user has sudo'ed via "cd /sudo::" (bug#60722). * lisp/simple.el (file-user-uid): New function. * lisp/net/tramp.el (tramp-file-name-for-operation): Add 'file-user-uid'. (tramp-handle-file-user-uid): New function. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist): Add 'file-user-uid'. * lisp/net/tramp-archive.el (tramp-archive-handle-file-user-uid): New function... (tramp-archive-file-name-handler-alist): ... use it. * lisp/eshell/em-prompt.el (eshell-prompt-function): Use 'file-user-uid'. * lisp/eshell/esh-var.el (eshell-variable-aliases-list): Add '$UID'. * test/lisp/eshell/esh-var-tests.el (esh-var-test/uid-var): New test. * doc/lispref/os.texi (User Identification): Document 'file-user-uid'. * doc/lispref/files.texi (Magic File Names): Mention 'file-user-uid'. * doc/misc/eshell.texi (Variables): Document '$UID'. Add a missing index entry for '$INSIDE_EMACS'. * etc/NEWS: Announce 'file-user-uid'.
* | Use the 'field' property to navigate through Eshell promptsJim Porter2023-01-141-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/eshell/esh-mode.el (eshell-skip-prompt-function): Make obsolete. * lisp/eshell/em-prompt.el (eshell-prompt-regexp): Update docstring. (eshell-prompt-initialize): Don't set 'eshell-skip-prompt-function'. (eshell-next-prompt): Search for the 'field' property set to 'prompt' to find the next prompt. (eshell-previous-prompt): Move 'forward-line' call into 'eshell-next-prompt'. (eshell-forward-matching-input, eshell-backward-matching-input): Reimplement on top of 'eshell-next-prompt'. (eshell-skip-prompt): Make obsolete. * test/lisp/eshell/em-prompt-tests.el (em-prompt-test/next-previous-prompt): New test.
* | Make 'eshell-bol' obsoleteJim Porter2023-01-141-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that Eshell uses fields for its output, 'eshell-bol' is no longer needed, and we can just use 'beginning-of-line'. * lisp/eshell/esh-mode.el (eshell-bol): Mark obsolete. (eshell-mode-map): Remove 'C-a' mapping. (eshell-command-map): Use 'move-beginning-of-line'. (eshell-move-argument, eshell-kill-input): Use 'beginning-of-line'. (eshell-get-old-input): Remove unnecessary call to 'eshell-skip-prompt-function'. * lisp/eshell/em-rebind.el (eshell-rebind-keys-alist): Remove 'C-a' and '<home>' mappings; the global mapping for these ('move-beginning-of-line') does the same thing now. * lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): * lisp/eshell/em-elecslash.el (eshell-electric-forward-slash): * lisp/eshell/em-hist.el (eshell-hist-word-reference) (eshell-previous-matching-input-from-input, eshell-test-imatch): * lisp/eshell/em-prompt.el (eshell-backward-matching-input): * lisp/eshell/em-rebind.el (eshell-point-within-input-p): * test/lisp/eshell/eshell-tests.el (eshell-test/forward-arg): Use 'beginning-of-line'. * test/lisp/eshell/eshell-tests.el (eshell-test/run-old-command): Rename to... (eshell-test/get-old-input): ... this, and expand the test.
* | Set the 'field' property for Eshell outputJim Porter2023-01-141-0/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes Eshell work more like 'M-x shell', and lets the <home> key move to the beginning of the user's input at the prompt (bug#60666). * lisp/eshell/em-prompt.el (eshell-emit-prompt): Add 'field' property to prompt. (eshell-bol-ignoring-prompt): New function. * lisp/eshell/esh-io.el: Declare 'eshell-interactive-print'... (eshell-output-object-to-target): ... use it. * lisp/eshell/esh-mode.el (eshell-output-filter-functions): Update docstring. (eshell-interactive-print): Set the output to have a field value of 'command-output'. (eshell-output-filter): Rename to... (eshell-interactive-filter): ... this, and take a buffer instead of a process. * lisp/eshell/esh-proc.el (eshell-interactive-process-filter): New function, adapted from 'eshell-output-filter'... (eshell-gather-process-output): ... use it. * test/lisp/eshell/em-prompt-tests.el: New file. * etc/NEWS: Announce this change.
* | Merge from origin/emacs-29Eli Zaretskii2023-01-0120-20/+20
|\ \ | |/ | | | | | | | | | | | | | | | | | | cae528457c ; Add 2023 to copyright years. b394359261 Improve documentation of 'isearch-open-overlay-temporary' ab3210e709 Document 'use-package' in the 2 main manuals # Conflicts: # etc/refcards/ru-refcard.tex # lib/explicit_bzero.c # m4/explicit_bzero.m4
| * ; Add 2023 to copyright years.Eli Zaretskii2023-01-0120-20/+20
| |
* | ; Fix Eshell tests on macOSJim Porter2022-12-302-16/+19
| | | | | | | | | | | | | | * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/if-statement-pipe) (esh-cmd-test/if-else-statement-pipe): * test/lisp/eshell/esh-io-tests.el (esh-io-test/pipeline/subcommands): Allow trailing newlines in the output.
* | Fix reference-counting of Eshell I/O handlesJim Porter2022-12-295-81/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ensures that output targets in Eshell are only closed when Eshell is actually done with them. In particular, this means that "{ echo foo; echo bar } | rev" prints "raboof" as expected (bug#59545). * lisp/eshell/esh-io.el (eshell-create-handles): Structure the handles differently so the targets and their ref-count can be shared. (eshell-duplicate-handles): Reimplement this to share targets between the original and new handle sets. Add STEAL-P argument. (eshell-protect-handles, eshell-copy-output-handle) (eshell-interactive-output-p, eshell-output-object): Account for changes to the handle structure. (eshell-close-handle): New function... (eshell-close-handles, eshell-set-output-handle): ... use it. (eshell-get-targets): Remove. This only existed to make the previous implementation of 'eshell-duplicate-handles' work. * lisp/eshell/esh-cmd.el (eshell-with-copied-handles): New argument STEAL-P. (eshell-do-pipelines): Use STEAL-P for the last item in the pipeline. (eshell-parse-command): Don't copy handles for the last command in the list; explain why we can't use STEAL-P here. (eshell-eval-command): When queuing input, set 'eshell-command-body' and 'eshell-test-body' for the 'if' conditional (see 'eshell-do-eval'). * test/lisp/eshell/esh-io-tests.el (esh-io-test/redirect-pipe): Split into... (esh-io-test/pipeline/default, esh-io-test/pipeline/all): ... these. (esh-io-test/pipeline/subcommands): New test. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/for-loop-pipe) (esh-cmd-test/while-loop-pipe, esh-cmd-test/if-statement-pipe) esh-cmd-test/if-else-statement-pipe): New tests. (esh-cmd-test/while-loop): Use 'pop' to simplify the test a bit. * test/lisp/eshell/eshell-test-helpers.el (eshell-test--max-subprocess-time): Rename to... (eshell-test--max-wait-time): ... this. (eshell-wait-for): New function... (eshell-wait-for-subprocess): ... use it. * test/lisp/eshell/eshell-tests.el (eshell-test/queue-input): Fix this test. Previously, it didn't correctly verify that the original command completed. * test/lisp/eshell/em-tramp-tests.el (em-tramp-test/should-replace-command): New macro... (em-tramp-test/su-default, em-tramp-test/su-user) (em-tramp-test/su-login, em-tramp-test/sudo-shell) (em-tramp-test/sudo-user-shell, em-tramp-test/doas-shell) (em-tramp-test/doas-user-shell): ... use it.
* | Simplify handling of /dev/null redirection in EshellJim Porter2022-12-221-2/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also fixes an issue where "echo hi > foo > /dev/null" didn't write to the file "foo". (Note that users can still use their system's null device name when redirecting; Eshell doesn't need to do anything special to support that.) * lisp/eshell/esh-io.el (eshell-virtual-targets): Add "/dev/null". (eshell-set-output-handle): Handle 'eshell-null-device'. * test/lisp/eshell/esh-io-tests.el (esh-io-test/redirect-subcommands/dev-null) (esh-io-test/virtual/dev-null, esh-io-test/virtual/dev-null/multiple): New tests.
* | Fix handling of output handles in nested Eshell formsJim Porter2022-12-224-40/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the output handles in nested forms would be reset to the default, leading to wrong behavior for commands like {echo a; echo b} > file "b" would be written to "file" as expected, but "a" would go to standard output (bug#59545). * lisp/eshell/esh-cmd.el (eshell-parse-command): Use 'eshell-with-copied-handles' for each statement within the whole Eshell command. * test/lisp/eshell/esh-io-tests.el (esh-io-test/redirect-subcommands) (esh-io-test/redirect-subcommands/override) (esh-io-test/redirect-subcommands/interpolated): New tests. * test/lisp/eshell/em-script-tests.el (em-script-test/source-script/redirect) (em-script-test/source-script/redirect/dev-null): New tests. (em-script-test/source-script, em-script-test/source-script/arg-vars) (em-script-test/source-script/all-args-var): Tweak names/docstrings. * test/lisp/eshell/em-extpipe-tests.el (em-extpipe-tests--deftest): Skip over the newly-added 'eshell-with-copied-handles' form when checking the parse results. * test/lisp/eshell/em-tramp-tests.el (em-tramp-test/su-default) (em-tramp-test/su-user, em-tramp-test/su-login) (em-tramp-test/sudo-shell, em-tramp-test/sudo-user-shell) (em-tramp-test/doas-shell, em-tramp-test/doas-user-shell): Update expected command forms.
* | Add support for the "splice operator" in EshellJim Porter2022-12-152-0/+83
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows splicing lists in-place in argument lists, which is particularly important when defining aliases using the '$*' special variable (bug#59960). * lisp/eshell/esh-var.el (eshell-parse-variable): Add support for the splice operator. (eshell-interpolate-variable): Let 'eshell-parse-variable' handle adding 'eshell-escape-arg'. (eshell-complete-variable-reference): Handle the splice operator. * lisp/eshell/esh-arg.el (eshell-concat-groups) (eshell-prepare-splice): New functions... (eshell-resolve-current-argument): ... use them. (eshell-splice-args): New function. * lisp/eshell/esh-cmd.el (eshell-rewrite-named-command): Handle 'eshell-splice-args'. * lisp/eshell/esh-util.el (eshell-list-to-string): New function... (eshell-flatten-and-stringify): ... use it. * lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): Remove 'eshell-splice-args' sigils in Eshell command forms so that we can perform completion on splice-expansions. * lisp/eshell/em-unix.el (eshell-complete-host-reference): Don't try to complete arguments containing "$@". * test/lisp/eshell/esh-var-tets.el (esh-var-test/interp-list-var) (esh-var-test/interp-list-var-concat, esh-var-test/interp-var-splice) (esh-var-test/interp-var-splice-concat) (esh-var-test/quoted-interp-list-var) (esh-var-test/quoted-interp-list-var-concat) (esh-var-test/quoted-interp-var-splice) (esh-var-test/quoted-interp-var-splice-concat): New tests. * test/lisp/eshell/em-alias-tests.el (em-alias-test/alias-all-args-var-splice): New test. * doc/misc/eshell.texi (Dollars Expansion): Explain the splice operator. (Aliases): Expand documentation and use '$@*'. (Built-ins, Bugs and Ideas): Use '$@*' where appropriate. * etc/NEWS: Announce this change.
* 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