Subject: bug#13594: closed (Re: bug#13594: Planning Emacs-24.4)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 03 Dec 2013 03:24:02 +0000

Your bug report

#13594: 24.2.92; [PATCH] compilation-start doesn't consider nil OUTWIN

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
13594: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13594
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#13594: Planning Emacs-24.4
From: Leo Liu <[email-masked]>
To: Juri Linkov <[email-masked]>
Cc: [email-masked]
Date: Tue, 03 Dec 2013 11:23:20 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Fixed in 24.4

On 2013-12-03 09:19 +0800, Juri Linkov wrote:
> I installed the patch.  Please have a look and close this bug
> if everything is fixed.

Thanks for the improvement.

Leo

Subject: 24.2.92; [PATCH] compilation-start doesn't consider nil OUTWIN
From: Leo Liu <[email-masked]>
To: [email-masked]
Date: Thu, 31 Jan 2013 18:43:31 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

In building ggtags on top of compile.el, I have found one annoyance that
is I need to popup and immediately delete the compile window if there is
one or zero match, which is visually disturbing.

While finding my way to fix this annoyance, I discovered
compilation-start does not consider the case when OUTWIN is nil (which
is legitimate per the doc-string of `display-buffer').

        (setq outwin (display-buffer outbuf))

When OUTWIN is nil, all the subsequent window operations will be acting
on the wrong window.

(proposed patch attached)

Leo

diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index f383e02b..13ef425f 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1616,7 +1616,7 @@ (defun compilation-start (command &optional mode name-function highlight-regexp)
       (set-buffer-modified-p nil))
     ;; Pop up the compilation buffer.
     ;; http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01638.html
-    (setq outwin (display-buffer outbuf))
+    (setq outwin (display-buffer outbuf)) ; Note: OUTWIN may be nil
     (with-current-buffer outbuf
       (let ((process-environment
 	     (append
@@ -1638,7 +1638,7 @@ (defun compilation-start (command &optional mode name-function highlight-regexp)
 	     (list command mode name-function highlight-regexp))
 	(set (make-local-variable 'revert-buffer-function)
 	     'compilation-revert-buffer)
-	(set-window-start outwin (point-min))
+	(and outwin (set-window-start outwin (point-min)))
 
 	;; Position point as the user will see it.
 	(let ((desired-visible-point
@@ -1647,15 +1647,16 @@ (defun compilation-start (command &optional mode name-function highlight-regexp)
 		   (point-max)
 		 ;; Normally put it at the top.
 		 (point-min))))
-	  (if (eq outwin (selected-window))
-	      (goto-char desired-visible-point)
-	    (set-window-point outwin desired-visible-point)))
+	  (when outwin
+	    (if (eq outwin (selected-window))
+		(goto-char desired-visible-point)
+	      (set-window-point outwin desired-visible-point))))
 
 	;; The setup function is called before compilation-set-window-height
 	;; so it can set the compilation-window-height buffer locally.
 	(if compilation-process-setup-function
 	    (funcall compilation-process-setup-function))
-	(compilation-set-window-height outwin)
+	(and outwin (compilation-set-window-height outwin))
 	;; Start the compilation.
 	(if (fboundp 'start-process)
 	    (let ((proc