bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Leo Liu
Subject: bug#13594: 24.2.92; [PATCH] compilation-start doesn't consider nil OUTWIN
Date: Thu, 31 Jan 2013 18:43:31 +0800

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]