From c94b02d6f742063b6b19f8142e88e9da4b52939e Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 8 Aug 1994 09:02:40 +0000 Subject: [PATCH] (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. --- lisp/progmodes/compile.el | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 300186619a5..7ecc68aa5be 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -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))) ;; Find a buffer for file FILENAME. ;; Search the directories in compilation-search-path. -- 2.39.5