]> code.delx.au - gnu-emacs/commitdiff
Add new interactive command comint-clear-buffer
authorBozhidar Batsov <bozhidar@batsov.com>
Sun, 22 Feb 2015 06:01:08 +0000 (08:01 +0200)
committerBozhidar Batsov <bozhidar@batsov.com>
Tue, 24 Feb 2015 06:53:04 +0000 (08:53 +0200)
The command clears the entire comint buffer. It's bound to C-c M-o.

lisp/ChangeLog
lisp/comint.el

index d401852eeeb7cde3813b67b1f0416e3a48c07991..7e7bbb7486a7fc80afeb25190933b429f407c6ab 100644 (file)
@@ -1,3 +1,8 @@
+2015-02-24  Bozhidar Batsov  <bozhidar@batsov.com>
+
+       * comint.el (comint-clear-buffer): New command.
+       (comint-mode-map): Bind `comint-clear-buffer' to 'C-c M-o'.
+
 2015-02-23  Pete Williamson  <petewil0@googlemail.com>  (tiny change)
 
        Use ${EXEEXT} more uniformly in makefiles
index 30c4dda5c0f678731d13ce1756ae2044db199576..30aece14332e0924d8a82c3244ca15e2cc9e560b 100644 (file)
@@ -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.