From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Liu Newsgroups: gmane.emacs.bugs Subject: bug#13594: 24.2.92; [PATCH] compilation-start doesn't consider nil OUTWIN Date: Tue, 19 Mar 2013 23:39:54 +0800 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 1363707638 729 80.91.229.3 (19 Mar 2013 15:40:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 Mar 2013 15:40:38 +0000 (UTC) Cc: 13594@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 19 16:41:03 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 1UHyeq-0006Fd-79 for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Mar 2013 16:41:00 +0100 Original-Received: from localhost ([::1]:39512 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHyeT-0000pY-4C for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Mar 2013 11:40:37 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:52500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHyeI-0000ou-SC for bug-gnu-emacs@gnu.org; Tue, 19 Mar 2013 11:40:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UHyeF-0007oI-RY for bug-gnu-emacs@gnu.org; Tue, 19 Mar 2013 11:40:26 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60001) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHyeF-0007o7-MK for bug-gnu-emacs@gnu.org; Tue, 19 Mar 2013 11:40:23 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UHyfq-0000vS-VC for bug-gnu-emacs@gnu.org; Tue, 19 Mar 2013 11:42:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Leo Liu Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Mar 2013 15:42:02 +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.13637077213551 (code B ref 13594); Tue, 19 Mar 2013 15:42:02 +0000 Original-Received: (at 13594) by debbugs.gnu.org; 19 Mar 2013 15:42:01 +0000 Original-Received: from localhost ([127.0.0.1]:35877 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UHyfn-0000vC-L7 for submit@debbugs.gnu.org; Tue, 19 Mar 2013 11:42:00 -0400 Original-Received: from mail-da0-f48.google.com ([209.85.210.48]:46639) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UHyfk-0000v2-0c for 13594@debbugs.gnu.org; Tue, 19 Mar 2013 11:41:57 -0400 Original-Received: by mail-da0-f48.google.com with SMTP id p8so380994dan.35 for <13594@debbugs.gnu.org>; Tue, 19 Mar 2013 08:40:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:face:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=SOETVskDNJp/vCggbRIBMcR3uNpx3A1vk4e6creFJ74=; b=mcZcNZ3OAbFTZr1ZzGYZJ/gSEf4cTGtrEjaRnJm2P5Ns1fUadR2YDoKrzph8JnnrRS mv0wrLh/Mt//vjN8dt9YBYSAGtDhmySUVKKxJ59u3poDaFZ1lRAL46yEptDaH7ZbR8zL szLKccklBswkp8aaujQSeS9Ol/YEVB2oxQrl7VUEoGzZDdo8a6BeWJ3sGgzmDJYBj+6/ W4LYNOX5WzkMINkwNYTs8n1lNzMd4vW4qOzaD1exACvMw1fm9cLhqmS64X3fFIIG1LH5 +0VDvM/KkeSXYGklu0l1GIR+/VDHZIdKb6nGL4BCY/EKc7HZSVnrAreZnj5BjmbhQnKK HuOw== X-Received: by 10.68.220.68 with SMTP id pu4mr3837839pbc.26.1363707615373; Tue, 19 Mar 2013 08:40:15 -0700 (PDT) Original-Received: from localhost ([182.48.109.29]) by mx.google.com with ESMTPS id wm3sm24731856pbc.4.2013.03.19.08.40.02 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 19 Mar 2013 08:40:14 -0700 (PDT) Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAElBMVEUAAAAAAP+LRRP0pGC+ vr7///+7mT1iAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9cBBwMO DhglKe4AAAEsSURBVCjPbZNBboQwDEV/Cd4X9QJRThApmn0XYW+Jyf2v0m+HhqDBgiAe9rcTG7QH w/1Vn2Ar8gBb/ocywSN3qK9T3z4eFDB4eApocBpeBs1RSykoJd8gQcm8pGmHXFso3ajnmsqV0TnY DQkOfXUfN5NwaI7AWTVOyEhcu1aHmdWItHddUVUcUgUBCkitu8V6ditHVOVdqzl2EQ1ZVGTbdK0V 7cqn8vWzoU5Q/bF9Y/Y0cRU1xwkys5dJ+Dt6pBDWifcNQml8Gh2JVmPSoQzo7en0grswkxrUGYJ7 0hSxxAGr7ZMwYcHIzprpi7TENEE1xtiYxixRlCfPBsUUrwHD7uGIwATrbnODJcVrPpVn3hxiGloe m/S+z3CtuzUSMo83N4DPH+F0evwR3P4A2k+75838OKQAAAAASUVORK5CYII= In-Reply-To: (Stefan Monnier's message of "Thu, 14 Feb 2013 09:15:49 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3) 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:72711 Archived-At: On 2013-02-14 22:15 +0800, Stefan Monnier wrote: > 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.). 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.