emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 572d58b5e8d: When deleting output in Eshell, optionally add it to


From: Jim Porter
Subject: master 572d58b5e8d: When deleting output in Eshell, optionally add it to the kill ring.
Date: Thu, 15 Feb 2024 21:27:42 -0500 (EST)

branch: master
commit 572d58b5e8d0f1f1244b9ccab8f02c4f50ca8d12
Author: Tomas Volf <~@wolfsden.cz>
Commit: Jim Porter <jporterbugs@gmail.com>

    When deleting output in Eshell, optionally add it to the kill ring.
    
    * lisp/eshell/esh-mode.el (eshell-kill-output): Rename to...
    (eshell-delete-output): ... this, for consistency with 'comint-mode',
    and accept KILL argument.  Update callers.
    
    Copyright-paperwork-exempt: yes
---
 lisp/eshell/esh-mode.el | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index fd279f61673..b15f99a0359 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -290,7 +290,7 @@ non-interactive sessions, such as when using 
`eshell-command'.")
   "C-e" #'eshell-show-maximum-output
   "C-f" #'eshell-forward-argument
   "C-m" #'eshell-copy-old-input
-  "C-o" #'eshell-kill-output
+  "C-o" #'eshell-delete-output
   "C-r" #'eshell-show-output
   "C-t" #'eshell-truncate-buffer
   "C-u" #'eshell-kill-input
@@ -832,15 +832,23 @@ 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-delete-output (&optional kill)
+  "Delete all output from interpreter since last input.
+If KILL is non-nil (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))))
 
+(define-obsolete-function-alias 'eshell-kill-output
+  #'eshell-delete-output "30.1")
+
 (defun eshell-show-output (&optional arg)
   "Display start of this batch of interpreter output at top of window.
 Sets mark to the value of point when this command is run.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]