# HG changeset patch # User Richard M. Stallman # Date 739344510 0 # Node ID 7a3e241a2917b6315e44266655f69226c672b460 # Parent 8154b7ce787efea47b8ce578548abd86af9fa43e (compile-internal): Alter current buffer only temporarily. diff -r 8154b7ce787e -r 7a3e241a2917 lisp/progmodes/compile.el --- a/lisp/progmodes/compile.el Sun Jun 06 03:53:08 1993 +0000 +++ b/lisp/progmodes/compile.el Sun Jun 06 05:28:30 1993 +0000 @@ -294,36 +294,37 @@ (goto-char (point-max))) ;; Pop up the compilation buffer. (setq outwin (display-buffer outbuf)) - (set-buffer outbuf) - (compilation-mode) - (buffer-disable-undo (current-buffer)) - (setq buffer-read-only t) - (set (make-local-variable 'compilation-parse-errors-function) parser) - (set (make-local-variable 'compilation-error-message) error-message) - (set (make-local-variable 'compilation-error-regexp-alist) regexp-alist) - (setq default-directory thisdir - compilation-directory-stack (list default-directory)) - (set-window-start outwin (point-min)) - (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)))) - ;; Start the compilation. - (let ((proc (start-process-shell-command (downcase mode-name) - outbuf - command))) - (set-process-sentinel proc 'compilation-sentinel) - (set-process-filter proc 'compilation-filter) - (set-marker (process-mark proc) (point) outbuf) - (setq compilation-in-progress (cons proc compilation-in-progress)))) + (save-excursion + (set-buffer outbuf) + (compilation-mode) + (buffer-disable-undo (current-buffer)) + (setq buffer-read-only t) + (set (make-local-variable 'compilation-parse-errors-function) parser) + (set (make-local-variable 'compilation-error-message) error-message) + (set (make-local-variable 'compilation-error-regexp-alist) regexp-alist) + (setq default-directory thisdir + compilation-directory-stack (list default-directory)) + (set-window-start outwin (point-min)) + (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)))) + ;; Start the compilation. + (let ((proc (start-process-shell-command (downcase mode-name) + outbuf + command))) + (set-process-sentinel proc 'compilation-sentinel) + (set-process-filter proc 'compilation-filter) + (set-marker (process-mark proc) (point) outbuf) + (setq compilation-in-progress (cons proc compilation-in-progress))))) ;; Make it so the next C-x ` will use this buffer. (setq compilation-last-buffer outbuf)))