diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2003-05-13 21:37:28 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2003-05-13 21:37:28 +0000 |
commit | 812fade8086abc02429a41db539eec4e41d16749 (patch) | |
tree | 0ccf41540425f850f9ae47fd287c12a5f902b575 /lisp/progmodes/compile.el | |
parent | 96a483d9542a5348c17a7057b275e9d8f4b40676 (diff) | |
download | emacs-812fade8086abc02429a41db539eec4e41d16749.tar.gz |
(compile-internal): Use with-current-buffer.
(compilation-set-window-height): Use save-selected-window.
Diffstat (limited to 'lisp/progmodes/compile.el')
-rw-r--r-- | lisp/progmodes/compile.el | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 6cbc7ce5e45..f9ce01edd85 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -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 <roland@gnu.org> @@ -1051,8 +1051,7 @@ Returns the compilation buffer created." (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 @@ exited abnormally with code %d\n" ;; 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"))) |