changeset 8483:19dbc8373bec

(compilation-set-window-height): New function, broken out from compile-internal. Don't change window height if it is the frame root window. (compile-internal): Call it. (compilation-goto-locus): Call it. Use any visible frame already showing the compilation buffer.
author Richard M. Stallman <rms@gnu.org>
date Mon, 08 Aug 1994 09:02:40 +0000
parents ffbf38ae06d1
children 3aa323481f5a
files lisp/progmodes/compile.el
diffstat 1 files changed, 20 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/compile.el	Mon Aug 08 07:08:17 1994 +0000
+++ b/lisp/progmodes/compile.el	Mon Aug 08 09:02:40 1994 +0000
@@ -380,15 +380,7 @@
 	(setq mode-name name-of-mode)
 	(or (eq outwin (selected-window))
 	    (set-window-point outwin (point-min)))
-	(and compilation-window-height
-	     (= (window-width outwin) (frame-width))
-	     (let ((w (selected-window)))
-	       (unwind-protect
-		   (progn
-		     (select-window outwin)
-		     (enlarge-window (- compilation-window-height
-					(window-height))))
-		 (select-window w))))
+	(compilation-set-window-height outwin)
 	;; Start the compilation.
 	(if (fboundp 'start-process)
 	    (let ((proc (start-process-shell-command (downcase mode-name)
@@ -407,6 +399,21 @@
     ;; Make it so the next C-x ` will use this buffer.
     (setq compilation-last-buffer outbuf)))
 
+;; Set the height of WINDOW according to compilation-window-height.
+(defun compilation-set-window-height (window)
+  (and compilation-window-height
+       (= (window-width window) (frame-width (window-frame window)))
+       ;; If window is alone in its frame, aside from a minibuffer,
+       ;; don't change its height.
+       (not (eq window (frame-root-window (window-frame window))))
+       (let ((w (selected-window)))
+	 (unwind-protect
+	     (progn
+	       (select-window window)
+	       (enlarge-window (- compilation-window-height
+				  (window-height))))
+	   (select-window w)))))
+
 (defvar compilation-minor-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map [mouse-2] 'compile-mouse-goto-error)
@@ -1044,9 +1051,11 @@
 
   ;; Show compilation buffer in other window, scrolled to this error.
   (let* ((pop-up-windows t)
-	 (w (display-buffer (marker-buffer (car next-error)))))
+	 (w (or (get-buffer-window (marker-buffer (car next-error)) 'visible)
+		(display-buffer (marker-buffer (car next-error))))))
     (set-window-point w (car next-error))
-    (set-window-start w (car next-error))))
+    (set-window-start w (car next-error))
+    (compilation-set-window-height w)))
 
 ;; Find a buffer for file FILENAME.
 ;; Search the directories in compilation-search-path.