From eaf9499a7fe485a57ab54c665f0548d4eb1a2e88 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Sun, 22 Feb 2015 08:01:08 +0200 Subject: [PATCH] Add new interactive command comint-clear-buffer The command clears the entire comint buffer. It's bound to C-c M-o. --- lisp/ChangeLog | 5 +++++ lisp/comint.el | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d401852eeeb..7e7bbb7486a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2015-02-24 Bozhidar Batsov + + * comint.el (comint-clear-buffer): New command. + (comint-mode-map): Bind `comint-clear-buffer' to 'C-c M-o'. + 2015-02-23 Pete Williamson (tiny change) Use ${EXEEXT} more uniformly in makefiles diff --git a/lisp/comint.el b/lisp/comint.el index 30c4dda5c0f..30aece14332 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -472,6 +472,7 @@ executed once when the buffer is created." (define-key map "\C-c\C-\\" 'comint-quit-subjob) (define-key map "\C-c\C-m" 'comint-copy-old-input) (define-key map "\C-c\C-o" 'comint-delete-output) + (defile-key map "\C-c\M-o" 'comint-clear-buffer) (define-key map "\C-c\C-r" 'comint-show-output) (define-key map "\C-c\C-e" 'comint-show-maximum-output) (define-key map "\C-c\C-l" 'comint-dynamic-list-input-ring) @@ -2428,6 +2429,11 @@ Sets mark to the value of point when this command is run." (goto-char (field-beginning pos)) (set-window-start (selected-window) (point)))))) +(defun comint-clear-buffer () + "Clear the comint buffer." + (interactive) + (let ((comint-buffer-maximum-size 0)) + (comint-truncate-buffer))) (defun comint-interrupt-subjob () "Interrupt the current subjob. -- 2.39.2