From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tomas Volf <~@wolfsden.cz> Newsgroups: gmane.emacs.bugs Subject: bug#69078: [PATCH] esh-mode: Allow eshell-kill-output to actually kill the output. Date: Mon, 12 Feb 2024 17:22:39 +0100 Message-ID: <20240212162451.30490-1-~@wolfsden.cz> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8904"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Tomas Volf <~@wolfsden.cz> To: 69078@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 12 17:26:08 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rZZ8B-00029P-OX for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Feb 2024 17:26:07 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZZ7r-0007Bi-OM; Mon, 12 Feb 2024 11:25:47 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZZ7p-0007Ba-QI for bug-gnu-emacs@gnu.org; Mon, 12 Feb 2024 11:25:45 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZZ7p-0003pv-HA for bug-gnu-emacs@gnu.org; Mon, 12 Feb 2024 11:25:45 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rZZ86-0007Ys-CP for bug-gnu-emacs@gnu.org; Mon, 12 Feb 2024 11:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Feb 2024 16:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69078 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.170775512728901 (code B ref -1); Mon, 12 Feb 2024 16:26:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Feb 2024 16:25:27 +0000 Original-Received: from localhost ([127.0.0.1]:40294 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZZ7W-0007W2-Hf for submit@debbugs.gnu.org; Mon, 12 Feb 2024 11:25:27 -0500 Original-Received: from lists.gnu.org ([2001:470:142::17]:56198) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1rZZ7V-0007VL-AI for submit@debbugs.gnu.org; Mon, 12 Feb 2024 11:25:25 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <~@wolfsden.cz>) id 1rZZ78-00078J-Oh for bug-gnu-emacs@gnu.org; Mon, 12 Feb 2024 11:25:02 -0500 Original-Received: from wolfsden.cz ([37.205.8.62]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <~@wolfsden.cz>) id 1rZZ76-0003aa-ID for bug-gnu-emacs@gnu.org; Mon, 12 Feb 2024 11:25:02 -0500 Original-Received: by wolfsden.cz (Postfix, from userid 104) id 35E64288DC2; Mon, 12 Feb 2024 16:24:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1707755096; bh=FBaC0ovYAwM4n959QAM6+TAcfjXaatFLB7je4YfwSN8=; h=From:To:Cc:Subject:Date; b=BNSCti9tpEd+MlMqDbxwgacseVXHE8O22rhdxOVefF1BppKtsGJm30UaSHzG1cOoF 9JVfu3kVOXr1MFLyKdjPHQC95pXLyprCQuK9d39h6u5Mi+yf8Ec4+rz6iErr58Sbra kQnoVccNltgQxVeTtTsy5HmfJgldZaYQStyQatIcHmH2IYltyPiL82MpodADGlMKOc cTSXgRYhtrK6S6oEG7QEDn0Ca+bmQKZR+F00vLXFs71rcSAZhPwbV18Y1Jy/FiU2GV QQ5qWSfV1zSqr3zHCOLaQF6tOYvuWWTNl/rsCqT2GlKsOvZO0rAjVFLSPKIMEn5yh3 aFEFIrE2/J13ki5G+TLFzfqq6xzEfX2bUZyOG8ewpR4SCjSE7+8HtaJU3VIpcgybVo RioJaltIeOEMqwQym7+MyX2qGsFhqYgrqotZ5KMVwbqANHK3nKdhoZxHv+YCmHmeQZ xFeL+1x1zcb1sqqJ0LhlOMyRkprZPA3oBlJPOEnc7NhsC8pBpkH/eboQYPD8p1Wos/ X3lOjCkhZQHzRXDy+/KTVqzjJE2KudsB7xEMi+ta16601KcohqfkRj7YtVIOf6Eguj KAgN8rGSTiZtvcthwTFWevLHzlvlFBNnVH985V+6SsAJBRmrM0fKQqFCHNdCN5qqRd TlGOP8J7OofTeYaUjQGknAYc= Original-Received: from localhost (unknown [193.32.127.159]) by wolfsden.cz (Postfix) with ESMTPSA id 56329288B59; Mon, 12 Feb 2024 16:24:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1707755095; bh=FBaC0ovYAwM4n959QAM6+TAcfjXaatFLB7je4YfwSN8=; h=From:To:Cc:Subject:Date; b=FeKk8dAdrHwsMnBzqKy904rST2bz+aY36QF8yQGGMLRKlTq4DfkdJGpufHXkaO6nb /YLC0NDLwko7vfl5AEKZoxoxCIRtwvWRKyYfa3zoyE5yHb/M0bhnEeZYmb49zQCkIJ LcKk14IaZx2CKLXcKGBiZWzEtnmq1ubX2NiWVKroKsKjn7xLjGoXlDmm2tIO8ATDIj hWeYyjg8aMOwrM2lmEL60SE6E9faiy3vaLBJfhsUluNtB65GWcltpjP65WrGCnidOP qh2Vpc4keOhbm+WOgwd2Ksetg+A6CvcJ+AcplJYSEden+UDbdkdMf7JsGDXEYQy6JF lJ3XRpaYRIqZglOpLfkYkCdmK9KtrxnRhk7VXyq0B7B/MGgDTWbH+66RFEt8YR/ZEb ZihO70yaUsh6dIJxVCVUyJVQw76+in9IQL+MFH8oDcFN4Rt1IlQpf8rEua/RiytdAe AJ4uY3h5P7AGBMXLQiG9FU5oyLNbwImxk/qevst10lY79BxzMbR2CWTcF7F3wuV4un NoVaBI5FzemVa8KNuPUU+vU+XYYAnLP2C8r++DjFigNl7NaCiMDR5l3sS22+t32lzO 4qQ/1tSuiuL1dCRrgtyOz8tkg+vdZYMbBnRFkcW6HpDPuN979Ggk9hYrSje5BNZSBu tRboNLJK0NvVRtKrUxd7AwE8= X-Mailer: git-send-email 2.41.0 Received-SPF: pass client-ip=37.205.8.62; envelope-from=~@wolfsden.cz; helo=wolfsden.cz X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:279902 Archived-At: 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