# HG changeset patch # User Stefan Monnier # Date 1052861848 0 # Node ID 1004156b8057c6ce22c60720f09e5cd42911815f # Parent 7e8592bdc9a1b2af7aebff9439010f246e1a817c (compile-internal): Use with-current-buffer. (compilation-set-window-height): Use save-selected-window. diff -r 7e8592bdc9a1 -r 1004156b8057 lisp/progmodes/compile.el --- a/lisp/progmodes/compile.el Tue May 13 21:15:44 2003 +0000 +++ b/lisp/progmodes/compile.el Tue May 13 21:37:28 2003 +0000 @@ -1,6 +1,6 @@ ;;; compile.el --- run compiler as inferior of Emacs, parse error messages -;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 98, 1999, 2001 +;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 98, 1999, 2001, 2003 ;; Free Software Foundation, Inc. ;; Author: Roland McGrath @@ -1051,8 +1051,7 @@ (goto-char (point-max))) ;; Pop up the compilation buffer. (setq outwin (display-buffer outbuf nil t)) - (save-excursion - (set-buffer outbuf) + (with-current-buffer outbuf (compilation-mode name-of-mode) ;; In what way is it non-ergonomic ? -stef ;; (toggle-read-only 1) ;;; Non-ergonomic. @@ -1144,19 +1143,13 @@ ;; 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)))) - ;; This save-excursion prevents us from changing the current buffer, - ;; which might not be the same as the selected window's buffer. - (save-excursion - (let ((w (selected-window))) - (unwind-protect - (progn - (select-window window) - (enlarge-window (- compilation-window-height - (window-height)))) - ;; The enlarge-window above may have deleted W, if - ;; compilation-window-height is large enough. - (when (window-live-p w) - (select-window w))))))) + ;; This save-current-buffer prevents us from changing the current + ;; buffer, which might not be the same as the selected window's buffer. + (save-current-buffer + (save-selected-window + (select-window window) + (enlarge-window (- compilation-window-height + (window-height))))))) (defvar compilation-menu-map (let ((map (make-sparse-keymap "Errors")))