From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#13594: 24.2.92; [PATCH] compilation-start doesn't consider nil OUTWIN Date: Tue, 19 Mar 2013 23:12:08 -0400 Message-ID: References: <87sj5apclq.fsf@mail.jurta.org> <87r4ktoinh.fsf@mail.jurta.org> <87mwvhxehw.fsf@mail.jurta.org> <87zjzfz0nq.fsf@mail.jurta.org> <51161554.9010609@gmx.at> <8738x4o5cp.fsf@mail.jurta.org> <5117D9B5.5090203@gmx.at> <87pq07b4k4.fsf@mail.jurta.org> <51192ADD.9010607@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1363749211 15144 80.91.229.3 (20 Mar 2013 03:13:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 20 Mar 2013 03:13:31 +0000 (UTC) Cc: 13594@debbugs.gnu.org To: Leo Liu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Mar 20 04:13:56 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UI9TQ-0008Pc-EJ for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Mar 2013 04:13:56 +0100 Original-Received: from localhost ([::1]:40325 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UI9T3-0001uz-8N for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Mar 2013 23:13:33 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UI9Sq-0001ZS-KX for bug-gnu-emacs@gnu.org; Tue, 19 Mar 2013 23:13:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UI9Sp-0006Vm-FS for bug-gnu-emacs@gnu.org; Tue, 19 Mar 2013 23:13:20 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60609) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UI9Sp-0006Vi-CM for bug-gnu-emacs@gnu.org; Tue, 19 Mar 2013 23:13:19 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UI9UT-00012F-R1 for bug-gnu-emacs@gnu.org; Tue, 19 Mar 2013 23:15:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Mar 2013 03:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13594 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 13594-submit@debbugs.gnu.org id=B13594.13637492623918 (code B ref 13594); Wed, 20 Mar 2013 03:15:01 +0000 Original-Received: (at 13594) by debbugs.gnu.org; 20 Mar 2013 03:14:22 +0000 Original-Received: from localhost ([127.0.0.1]:36485 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UI9Tq-000119-DR for submit@debbugs.gnu.org; Tue, 19 Mar 2013 23:14:22 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:51800) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UI9Tn-000111-G5 for 13594@debbugs.gnu.org; Tue, 19 Mar 2013 23:14:21 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFFxKvA/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCwsOJhIUGA0kiB4GsR+QDpEKA5JakiCBXoMT X-IPAS-Result: Av8EABK/CFFFxKvA/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCwsOJhIUGA0kiB4GsR+QDpEKA5JakiCBXoMT X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="5327275" Original-Received: from 69-196-171-192.dsl.teksavvy.com (HELO pastel.home) ([69.196.171.192]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 19 Mar 2013 23:12:30 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id A11AA632AA; Tue, 19 Mar 2013 23:12:08 -0400 (EDT) In-Reply-To: (Leo Liu's message of "Tue, 19 Mar 2013 23:39:54 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:72728 Archived-At: >> Basically, as it currently stands "don't display at all" can be done in >> 2 ways: >> - make it work only for those callers that are prepared for it: for this >> case, we could simply define a t return value (returned from an >> ACTION) to mean "not displayed". Ideally, display-buffer would return >> nil in this case, but returning t is OK as well. >> - make it work everywhere: then we need display-buffer to return >> a "dummy" window (i.e. an object that behaves like a window object >> but that is not displayed). >> >> I'm beginning to think the best choice is the first option: it requires >> no changes right away, and we can progressively change callers so that >> they can handle the "not displayed" case. > Does this roughly follow your idea? i.e. document display-buffer to > allow non-window return value (I also get rid of mentioning nil). In > compile.el, handle non-window return value. The attached patch does > these two. (I'll prepare a thorough patch tomorrow.). It only does one half: change a few callers to handle a non-window return value. But the other half is important: the non-window return value should only be possible if the caller announces that it's ready to handle it. Stefan > diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el > index b82afc67..8edfe487 100644 > --- a/lisp/progmodes/compile.el > +++ b/lisp/progmodes/compile.el > @@ -1638,7 +1638,8 @@ (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)) > + (when (windowp outwin) > + (set-window-start outwin (point-min))) > ;; Position point as the user will see it. > (let ((desired-visible-point > @@ -1647,15 +1648,18 @@ (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))) > + (cond > + ((windowp outwin) > + (set-window-point outwin desired-visible-point)) > + ((eq outwin (selected-window)) > + (goto-char 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 (windowp outwin) > + (compilation-set-window-height outwin)) > ;; Start the compilation. > (if (fboundp 'start-process) > (let ((proc > diff --git a/lisp/window.el b/lisp/window.el > index 63d75f60..e96c8c60 100644 > --- a/lisp/window.el > +++ b/lisp/window.el > @@ -5368,7 +5368,8 @@ (defun display-buffer (buffer-or-name &optional action frame) > "Display BUFFER-OR-NAME in some window, without selecting it. > BUFFER-OR-NAME must be a buffer or the name of an existing > buffer. Return the window chosen for displaying BUFFER-OR-NAME, > -or nil if no such window is found. > +or a non-nil value to mean one of the actions forbids displaying > +the buffer. > Optional argument ACTION, if non-nil, should specify a display > action. Its form is described below. > @@ -5394,7 +5395,9 @@ (defun display-buffer (buffer-or-name &optional action frame) > `display-buffer-fallback-action' (in order). Then it calls each > function in the combined function list in turn, passing the > buffer as the first argument and the combined alist as the second > -argument, until one of the functions returns non-nil. > +argument, until one of the functions returns non-nil. If the > +value is not a window object, the search stops and no buffer is > +displayed. > If ACTION is nil, the function list and the alist are built using > only the other variables mentioned above.