]> code.delx.au - gnu-emacs/blobdiff - lisp/comint.el
Merge from origin/emacs-24
[gnu-emacs] / lisp / comint.el
index 68b8edbb8ca428a2c3ada055a239c1de26898bb1..b6944da355c2b7ce4559f5639d000c53d2dc505d 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)
+    (define-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)
@@ -746,11 +747,11 @@ The buffer name is made by surrounding the file name of PROGRAM with `*'s.
 The file name is used to make a symbol name, such as `comint-sh-hook', and any
 hooks on this symbol are run in the buffer.
 See `make-comint' and `comint-exec'."
+  (declare (interactive-only make-comint))
   (interactive "sRun program: ")
   (let ((name (file-name-nondirectory program)))
     (switch-to-buffer (make-comint name program))
     (run-hooks (intern-soft (concat "comint-" name "-hook")))))
-(put 'comint-run 'interactive-only 'make-comint)
 
 (defun comint-exec (buffer name command startfile switches)
   "Start up a process named NAME in buffer BUFFER for Comint modes.
@@ -1775,6 +1776,12 @@ If the Comint is Lucid Common Lisp,
 
 Similarly for Soar, Scheme, etc."
   (interactive)
+  ;; If we're currently completing, stop.  We're definitely done
+  ;; completing, and by sending the input, we might cause side effects
+  ;; that will confuse the code running in the completion
+  ;; post-command-hook.
+  (when completion-in-region-mode
+    (completion-in-region-mode -1))
   ;; Note that the input string does not include its terminal newline.
   (let ((proc (get-buffer-process (current-buffer))))
     (if (not proc) (user-error "Current buffer has no process")
@@ -2431,6 +2438,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.