unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tomas Volf <~@wolfsden.cz>
To: 69078@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: bug#69078: [PATCH] esh-mode: Allow eshell-kill-output to actually kill the output.
Date: Mon, 12 Feb 2024 17:22:39 +0100	[thread overview]
Message-ID: <20240212162451.30490-1-~@wolfsden.cz> (raw)

Before this commit, the function eshell-kill-output, despite the name,
did not allow to kill the output, it always just deleted it.  This
commit fixes that, allowing to do the kill with C-u.

This mimics how comint mode operates, so from this commit C-c C-o and
C-u C-c C-o will work the same way in eshell-mode and shell-mode.

* lisp/eshell/esh-mode.el (eshell-kill-output): New optional argument,
kill.
---
The function name is misleading (and in comint is is called
coming-delete-output), but changing it could break code, so I do not think it is
worth it.  Adding the argument should be enough.

I do not have a copyright assignment, however the change is trivial, and mostly
copied from comint-delete-output, so I do not think it is necessary.

 lisp/eshell/esh-mode.el | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index fd279f61673..882fc67b9a1 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -832,13 +832,18 @@ This function should be in the list `eshell-output-filter-functions'."
       eshell-last-output-start
     eshell-last-output-end))

-(defun eshell-kill-output ()
-  "Kill all output from interpreter since last input.
-Does not delete the prompt."
-  (interactive)
+(defun eshell-kill-output (&optional kill)
+  "Delete all output from interpreter since last input.
+If KILL (interactively, the prefix), save the killed text in the
+kill ring.
+
+This command does not delete the prompt."
+  (interactive "P")
   (save-excursion
     (goto-char (eshell-beginning-of-output))
     (insert "*** output flushed ***\n")
+    (when kill
+      (copy-region-as-kill (point) (eshell-end-of-output)))
     (delete-region (point) (eshell-end-of-output))))

 (defun eshell-show-output (&optional arg)
--
2.41.0





             reply	other threads:[~2024-02-12 16:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12 16:22 Tomas Volf [this message]
2024-02-16  2:27 ` bug#69078: [PATCH] esh-mode: Allow eshell-kill-output to actually kill the output 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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='20240212162451.30490-1-~@wolfsden.cz' \
    --to=~@wolfsden.cz \
    --cc=69078@debbugs.gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).