From: Jim Porter <jporterbugs@gmail.com>
To: Jules Tamagnan <jtamagnan@gmail.com>, 66469@debbugs.gnu.org
Subject: bug#66469: 30.0.50; Fields in eshell output regress behavior when yanking output into new input
Date: Wed, 11 Oct 2023 11:41:33 -0700 [thread overview]
Message-ID: <8bbc87db-f293-aa6e-658c-2bd228f0b7cc@gmail.com> (raw)
In-Reply-To: <87edi1ca2h.fsf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 340 bytes --]
On 10/11/2023 11:01 AM, Jules Tamagnan wrote:
> Essentially the issue is that when killing eshell output and yanking it
> into a new input line one cannot navigate as expected. Thankfully this
> behavior is extremely easy to reproduce from `emacs -Q'.
Thanks for the report. Could you try the attached patch to verify that
it fixes things?
[-- Attachment #2: 0001-Fix-behavior-of-Eshell-prompt-when-yanking-output-in.patch --]
[-- Type: text/plain, Size: 2989 bytes --]
From e1e0bce5b3a2fcdaf966e450d86a2fb4b22376a7 Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Wed, 11 Oct 2023 11:38:27 -0700
Subject: [PATCH] Fix behavior of Eshell prompt when yanking output into it
* 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).
---
lisp/eshell/esh-mode.el | 3 +++
lisp/eshell/esh-util.el | 8 ++++++++
test/lisp/eshell/eshell-tests.el | 19 +++++++++++++++++++
3 files changed, 30 insertions(+)
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index 2b560afb92c..9d2cd1e67eb 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -361,6 +361,9 @@ eshell-mode
(setq-local eshell-last-output-end (point-marker))
(setq-local eshell-last-output-block-begin (point))
+ (add-function :filter-return (local 'filter-buffer-substring-function)
+ #'eshell--unmark-string-as-output)
+
(let ((modules-list (copy-sequence eshell-modules-list)))
(setq-local eshell-modules-list modules-list))
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el
index 4c251a29269..ca2f775318a 100644
--- a/lisp/eshell/esh-util.el
+++ b/lisp/eshell/esh-util.el
@@ -234,6 +234,14 @@ eshell--mark-yanked-as-output
(eshell--mark-as-output start1 end1)))))
(add-hook 'after-change-functions hook nil t)))
+(defun eshell--unmark-string-as-output (string)
+ "Unmark STRING as Eshell output."
+ (remove-list-of-text-properties
+ 0 (length string)
+ '(rear-nonsticky front-sticky field insert-in-front-hooks)
+ string)
+ string)
+
(defun eshell-find-delimiter
(open close &optional bound reverse-p backslash-p)
"From point, find the CLOSE delimiter corresponding to OPEN.
diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el
index b02e5fca592..d2ef44ae507 100644
--- a/test/lisp/eshell/eshell-tests.el
+++ b/test/lisp/eshell/eshell-tests.el
@@ -195,6 +195,25 @@ eshell-test/get-old-input/run-output
(eshell-send-input)
(eshell-match-output "(\"hello\" \"there\")")))
+(ert-deftest eshell-test/yank-output ()
+ "Test that yanking a line of output into the next prompt works (bug#66469)."
+ (with-temp-eshell
+ (eshell-insert-command "echo hello")
+ ;; Go to the output and kill the line of text.
+ (forward-line -1)
+ (kill-line)
+ ;; Go to the last prompt and yank the previous output.
+ (goto-char (point-max))
+ (yank)
+ ;; Go to the beginning of the prompt and add some text.
+ (move-beginning-of-line 1)
+ (insert-and-inherit "echo ")
+ ;; Make sure when we go to the beginning of the line, we go to the
+ ;; right spot (before the "echo").
+ (move-end-of-line 1)
+ (move-beginning-of-line 1)
+ (should (looking-at "echo hello"))))
+
(provide 'eshell-tests)
;;; eshell-tests.el ends here
--
2.25.1
next prev parent reply other threads:[~2023-10-11 18:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-11 18:01 bug#66469: 30.0.50; Fields in eshell output regress behavior when yanking output into new input Jules Tamagnan
2023-10-11 18:41 ` Jim Porter [this message]
2023-10-11 19:45 ` Jim Porter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8bbc87db-f293-aa6e-658c-2bd228f0b7cc@gmail.com \
--to=jporterbugs@gmail.com \
--cc=66469@debbugs.gnu.org \
--cc=jtamagnan@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.