]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/ede/shell.el
Update copyright year to 2015
[gnu-emacs] / lisp / cedet / ede / shell.el
index 194b7285a0b31c7c654c86c8f4dadf84c2f6c977..e15ca19ac54be8a9a57d712d21b8bc1dd89bd1e3 100644 (file)
@@ -1,6 +1,6 @@
 ;;; ede/shell.el --- A shell controlled by EDE.
 ;;
-;; Copyright (C) 2009-2011 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2015 Free Software Foundation, Inc.
 ;;
 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
 
@@ -42,10 +42,15 @@ COMMAND is a text string representing the thing to be run."
     ;; Show the new buffer.
     (when (not (get-buffer-window buff))
       (switch-to-buffer-other-window buff t))
-    ;; Force a shell into the buffer.
-    (shell buff)
-    (while (eq (point-min) (point))
-      (accept-process-output))
+    ;; Force a shell into the buffer, but only if the buffer
+    ;; doesn't already have a shell in it.
+    ;; Newer versions of `shell' pop the window forward.
+    (set-buffer buff)
+    (when (not (eq major-mode 'shell-mode))
+      (shell buff)
+      ;; Make sure the shell has started.
+      (while (eq (point-min) (point))
+       (accept-process-output)))
     ;; Change the default directory
     (if (not (string= (file-name-as-directory (expand-file-name default-directory))
                      (file-name-as-directory (expand-file-name dd))))