diff options
| author | Jim Porter | 2024-01-28 15:49:03 -0800 |
|---|---|---|
| committer | Jim Porter | 2024-01-28 15:54:46 -0800 |
| commit | 1f5a13d5843306af2e6a74fbdfd6d00af8804a23 (patch) | |
| tree | 7ab1a6ba1a4fbd6e27b4e64e23a861b467481ccb /test | |
| parent | e734f8e502e315441214936e89ecd1e11e981fca (diff) | |
| download | emacs-1f5a13d5843306af2e6a74fbdfd6d00af8804a23.tar.gz emacs-1f5a13d5843306af2e6a74fbdfd6d00af8804a23.zip | |
In Eshell, allow an escaped newline at the end of a command
Normally, "echo<RET>" runs the command "echo". Likewise,
"echo\<RET><RET>" should too: we escape the first newline, and then
the second one is unescaped and should send the command input to
Eshell. Previously, you had to press RET a third time, but now it
works as expected.
* lisp/eshell/esh-arg.el (eshell-looking-at-backslash-return): Make
obsolete.
(eshell-parse-backslash): A backslash sequence is only incomplete if
there's nothing at all after it.
* test/lisp/eshell/esh-arg-tests.el (esh-arg-test/escape/newline)
(esh-arg-test/escape-quoted/newline): Remove inaccurate comment;
escaped newlines are always special.
(esh-arg-test/escape/trailing-newline): New test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/eshell/esh-arg-tests.el | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/test/lisp/eshell/esh-arg-tests.el b/test/lisp/eshell/esh-arg-tests.el index b626cf10bf1..b748c5ab4c0 100644 --- a/test/lisp/eshell/esh-arg-tests.el +++ b/test/lisp/eshell/esh-arg-tests.el | |||
| @@ -60,13 +60,17 @@ chars." | |||
| 60 | "he\\\\llo\n"))) | 60 | "he\\\\llo\n"))) |
| 61 | 61 | ||
| 62 | (ert-deftest esh-arg-test/escape/newline () | 62 | (ert-deftest esh-arg-test/escape/newline () |
| 63 | "Test that an escaped newline is equivalent to the empty string. | 63 | "Test that an escaped newline is equivalent to the empty string." |
| 64 | When newlines are *nonspecial*, an escaped newline should be | ||
| 65 | treated as just a newline." | ||
| 66 | (with-temp-eshell | 64 | (with-temp-eshell |
| 67 | (eshell-match-command-output "echo hi\\\nthere" | 65 | (eshell-match-command-output "echo hi\\\nthere" |
| 68 | "hithere\n"))) | 66 | "hithere\n"))) |
| 69 | 67 | ||
| 68 | (ert-deftest esh-arg-test/escape/trailing-newline () | ||
| 69 | "Test that an escaped newline is equivalent to the empty string." | ||
| 70 | (with-temp-eshell | ||
| 71 | (eshell-match-command-output "echo hi\\\n" | ||
| 72 | "hi\n"))) | ||
| 73 | |||
| 70 | (ert-deftest esh-arg-test/escape/newline-conditional () | 74 | (ert-deftest esh-arg-test/escape/newline-conditional () |
| 71 | "Test invocation of an if/else statement using line continuations." | 75 | "Test invocation of an if/else statement using line continuations." |
| 72 | (let ((eshell-test-value t)) | 76 | (let ((eshell-test-value t)) |
| @@ -95,9 +99,7 @@ chars." | |||
| 95 | "\\\"hi\\\\\n"))) | 99 | "\\\"hi\\\\\n"))) |
| 96 | 100 | ||
| 97 | (ert-deftest esh-arg-test/escape-quoted/newline () | 101 | (ert-deftest esh-arg-test/escape-quoted/newline () |
| 98 | "Test that an escaped newline is equivalent to the empty string. | 102 | "Test that an escaped newline is equivalent to the empty string." |
| 99 | When newlines are *nonspecial*, an escaped newline should be | ||
| 100 | treated literally, as a backslash and a newline." | ||
| 101 | (with-temp-eshell | 103 | (with-temp-eshell |
| 102 | (eshell-match-command-output "echo \"hi\\\nthere\"" | 104 | (eshell-match-command-output "echo \"hi\\\nthere\"" |
| 103 | "hithere\n"))) | 105 | "hithere\n"))) |