diff lisp/progmodes/compile.el @ 82251:b8c796068320

Merge from emacs--rel--22 Patches applied: * emacs--rel--22 (patch 84-87) - Update from CVS - Change capitalization of VC backend names for new backends 2007-08-02 Richard Stallman <rms@gnu.org> * lisp/mail/rmailsum.el (rmail-make-summary-line): Find end of msg number to update deleted flag. * lisp/cus-edit.el (customize-apropos, customize-apropos-options) (customize-apropos-faces, customize-apropos-groups): Improve prompt. * lisp/menu-bar.el (menu-bar-help-menu): Add "About GNU" menu item. * lisp/startup.el (fancy-splash-head, startup-echo-area-message): Change message text. * lisp/emulation/tpu-edt.el (next-line-internal): Setting deleted. All callers use line-move. * lisp/progmodes/compile.el (compilation-find-buffer): Return current buffer immediately if suitable. (compile, compilation-buffer-name, compilation-start): Doc fixes. 2007-07-31 Daiki Ueno <ueno@unixuser.org> * lisp/faces.el (face-normalize-spec): New function. (frame-set-background-mode): Normalize face-spec before calling face-spec-match-p. 2007-07-31 Stefan Monnier <monnier@iro.umontreal.ca> * lisp/server.el (server-window): Add switch-to-buffer-other-frame option. 2007-08-03 Richard Stallman <rms@gnu.org> * src/fileio.c (Fvisited_file_modtime): Use make_time. Revision: emacs@sv.gnu.org/emacs--devo--0--patch-844
author Miles Bader <miles@gnu.org>
date Fri, 03 Aug 2007 05:49:59 +0000
parents acc4dc607d14 b589cafd502b
children 3892324d724a cd5e99697764
line wrap: on
line diff
--- a/lisp/progmodes/compile.el	Fri Aug 03 05:46:27 2007 +0000
+++ b/lisp/progmodes/compile.el	Fri Aug 03 05:49:59 2007 +0000
@@ -917,11 +917,13 @@
 Additionally, with universal prefix arg, compilation buffer will be in
 comint mode, i.e. interactive.
 
-To run more than one compilation at once, start one and rename
+To run more than one compilation at once, start one then rename
 the \`*compilation*' buffer to some other name with
-\\[rename-buffer].  Then start the next one.  On most systems,
-termination of the main compilation process kills its
-subprocesses.
+\\[rename-buffer].  Then _switch buffers_ and start the new compilation.
+It will create a new \`*compilation*' buffer.
+
+On most systems, termination of the main compilation process
+kills its subprocesses.
 
 The name used for the buffer is actually whatever is returned by
 the function in `compilation-buffer-name-function', so you can set that
@@ -970,7 +972,7 @@
 If NAME-FUNCTION is non-nil, call it with one argument MODE-NAME
 to determine the buffer name.
 Likewise if `compilation-buffer-name-function' is non-nil.
-If current buffer is the mode MODE-COMMAND,
+If current buffer has the major mode MODE-COMMAND,
 return the name of the current buffer, so that it gets reused.
 Otherwise, construct a buffer name from MODE-NAME."
   (cond (name-function
@@ -1009,8 +1011,11 @@
 
 MODE is the major mode to set in the compilation buffer.  Mode
 may also be t meaning use `compilation-shell-minor-mode' under `comint-mode'.
+
 If NAME-FUNCTION is non-nil, call it with one argument (the mode name)
-to determine the buffer name.
+to determine the buffer name.  Otherwise, the default is to
+reuses the current buffer if it has the proper major mode,
+else use or create a buffer with name based on the major mode.
 
 If HIGHLIGHT-REGEXP is non-nil, `next-error' will temporarily highlight
 the matching section of the visited source line; the default is to use the
@@ -1617,12 +1622,16 @@
     (setq compilation-current-error (point))
     (next-error-internal)))
 
-;; Return a compilation buffer.
-;; If the current buffer is a compilation buffer, return it.
-;; Otherwise, look for a compilation buffer and signal an error
-;; if there are none.
 (defun compilation-find-buffer (&optional avoid-current)
-  (next-error-find-buffer avoid-current 'compilation-buffer-internal-p))
+  "Return a compilation buffer.
+If AVOID-CURRENT is nil, and
+the current buffer is a compilation buffer, return it.
+If AVOID-CURRENT is non-nil, return the current buffer
+only as a last resort."
+  (if (and (compilation-buffer-internal-p (current-buffer))
+	   (not avoid-current))
+      (current-buffer)
+    (next-error-find-buffer avoid-current 'compilation-buffer-internal-p)))
 
 ;;;###autoload
 (defun compilation-next-error-function (n &optional reset)