]> git.eshelyaron.com Git - emacs.git/commitdiff
(compilation-set-window-height): New function,
authorRichard M. Stallman <rms@gnu.org>
Mon, 8 Aug 1994 09:02:40 +0000 (09:02 +0000)
committerRichard M. Stallman <rms@gnu.org>
Mon, 8 Aug 1994 09:02:40 +0000 (09:02 +0000)
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.

lisp/progmodes/compile.el

index 300186619a572e56eba3b40b9314cebba27a6a71..7ecc68aa5bebca19bd78293016e06c7390fa4c54 100644 (file)
@@ -380,15 +380,7 @@ Returns the compilation buffer created."
        (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 @@ Returns the compilation buffer created."
     ;; 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 @@ Selects a window with point at SOURCE, with another window displaying ERROR."
 
   ;; 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)))
 \f
 ;; Find a buffer for file FILENAME.
 ;; Search the directories in compilation-search-path.