emacs-diffs
[Top][All Lists]
Advanced

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

master 4ffa928: Allow comint-delete-output to save the output on the kil


From: Lars Ingebrigtsen
Subject: master 4ffa928: Allow comint-delete-output to save the output on the kill ring
Date: Mon, 19 Jul 2021 11:13:19 -0400 (EDT)

branch: master
commit 4ffa928b93cbb53f16b475ccf3742144392d98d8
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Allow comint-delete-output to save the output on the kill ring
    
    * lisp/comint.el (comint-delete-output): Allow saving the output
    to the kill ring (bug#1496).
---
 lisp/comint.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/comint.el b/lisp/comint.el
index 9e40661..7801261 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -2471,10 +2471,13 @@ This function could be in the list 
`comint-output-filter-functions'."
 
 ;; Random input hackage
 
-(defun comint-delete-output ()
+(defun comint-delete-output (&optional kill)
   "Delete all output from interpreter since last input.
-Does not delete the prompt."
-  (interactive)
+If KILL (interactively, the prefix), save the killed text in the
+kill ring.
+
+This command does not delete the prompt."
+  (interactive "P")
   (let ((proc (get-buffer-process (current-buffer)))
        (replacement nil)
        (inhibit-read-only t))
@@ -2482,6 +2485,8 @@ Does not delete the prompt."
       (let ((pmark (progn (goto-char (process-mark proc))
                          (forward-line 0)
                          (point-marker))))
+        (when kill
+         (copy-region-as-kill comint-last-input-end pmark))
        (delete-region comint-last-input-end pmark)
        (goto-char (process-mark proc))
        (setq replacement (concat "*** output flushed ***\n"



reply via email to

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