1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-20 12:40:56 -08:00

(compile-internal): Use with-current-buffer.

(compilation-set-window-height): Use save-selected-window.
This commit is contained in:
Stefan Monnier 2003-05-13 21:37:28 +00:00
parent 96a483d954
commit 812fade808

View file

@ -1,6 +1,6 @@
;;; compile.el --- run compiler as inferior of Emacs, parse error messages ;;; 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. ;; Free Software Foundation, Inc.
;; Author: Roland McGrath <roland@gnu.org> ;; Author: Roland McGrath <roland@gnu.org>
@ -1051,8 +1051,7 @@ Returns the compilation buffer created."
(goto-char (point-max))) (goto-char (point-max)))
;; Pop up the compilation buffer. ;; Pop up the compilation buffer.
(setq outwin (display-buffer outbuf nil t)) (setq outwin (display-buffer outbuf nil t))
(save-excursion (with-current-buffer outbuf
(set-buffer outbuf)
(compilation-mode name-of-mode) (compilation-mode name-of-mode)
;; In what way is it non-ergonomic ? -stef ;; In what way is it non-ergonomic ? -stef
;; (toggle-read-only 1) ;;; Non-ergonomic. ;; (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, ;; If window is alone in its frame, aside from a minibuffer,
;; don't change its height. ;; don't change its height.
(not (eq window (frame-root-window (window-frame window)))) (not (eq window (frame-root-window (window-frame window))))
;; This save-excursion prevents us from changing the current buffer, ;; This save-current-buffer prevents us from changing the current
;; which might not be the same as the selected window's buffer. ;; buffer, which might not be the same as the selected window's buffer.
(save-excursion (save-current-buffer
(let ((w (selected-window))) (save-selected-window
(unwind-protect (select-window window)
(progn (enlarge-window (- compilation-window-height
(select-window window) (window-height)))))))
(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)))))))
(defvar compilation-menu-map (defvar compilation-menu-map
(let ((map (make-sparse-keymap "Errors"))) (let ((map (make-sparse-keymap "Errors")))