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: Planning Emacs-24.4 Date: Mon, 18 Nov 2013 16:41:46 +0800 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1384764197 22999 80.91.229.3 (18 Nov 2013 08:43:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 18 Nov 2013 08:43:17 +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 Mon Nov 18 09:43:19 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 1ViKQQ-0005Nc-8B for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Nov 2013 09:43:18 +0100 Original-Received: from localhost ([::1]:41917 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ViKQP-0006P3-TI for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Nov 2013 03:43:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55224) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ViKQG-0006Op-TF for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2013 03:43:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ViKQB-0005MW-1B for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2013 03:43:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45449) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ViKQA-0005MS-SI for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2013 03:43:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ViKQA-0008Nl-EJ for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2013 03:43:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Leo Liu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Nov 2013 08:43: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.138476412232125 (code B ref 13594); Mon, 18 Nov 2013 08:43:02 +0000 Original-Received: (at 13594) by debbugs.gnu.org; 18 Nov 2013 08:42:02 +0000 Original-Received: from localhost ([127.0.0.1]:59468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ViKPB-0008M0-EU for submit@debbugs.gnu.org; Mon, 18 Nov 2013 03:42:02 -0500 Original-Received: from mail-pa0-f42.google.com ([209.85.220.42]:64228) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ViKP9-0008Ln-6s for 13594@debbugs.gnu.org; Mon, 18 Nov 2013 03:41:59 -0500 Original-Received: by mail-pa0-f42.google.com with SMTP id lj1so619089pab.15 for <13594@debbugs.gnu.org>; Mon, 18 Nov 2013 00:41:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=ltnc3yxvy41jiv81WXiS9s7eUrB3T61NhUYZZYAmREM=; b=IBvZs2ori2dPr7T8oQkTDaOo8vEAw7jPa5lKkQ2EtVFiY+khRklnQyBXWLiFjerLxJ cHD551fI5TjVsVEG86oX8Aywx8HrLA/tBjgJg1neLpX7MiQJcvLyedwYKyDIjDSM/vYV eYmppbLQ1ArgiFRJxqRBqsmIXGZcwRJ+7zb7y2K04qVk2SWhah4LIKXeNq+P45NdAz50 JmwJ0fwsrt//RYyV13NQ6xiv7RsH06ntYw+d+GLjNeS2zL1uzk6UkqwiW8TMawvKSk34 Kr1jhxqDbTRAt/Cuy4hGwsqrTwgK0SoIFPVyjN/uBpELgvtJw/l/zsOi7m3DUFm+3j8F wp1g== X-Received: by 10.66.152.11 with SMTP id uu11mr2157789pab.124.1384764113009; Mon, 18 Nov 2013 00:41:53 -0800 (PST) Original-Received: from localhost ([221.220.232.204]) by mx.google.com with ESMTPSA id qw8sm21786563pbb.27.2013.11.18.00.41.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Nov 2013 00:41:52 -0800 (PST) Face: iVBORw0KGgoAAAANSUhEUgAAACkAAAApAQAAAACAGz1bAAABKElEQVQYlWNg3NIt5FDPUPt7 4+X79Qyucz5/ugik+L2PBgKpyphaIK921q23QDnG0NBQoMr/vaWl9f8ZLL78uPv5PwN7RETfzXoG jhmFz27XM0RXmpuY/WfY+fv0Mc56BvFybfXA/wwL5t/wF61n2PU59axXPcOVzbmSW/8zrNt1benC /ww70hqUU/4zKCtrT9jwn8FhwynbufUMendE2aLqGRpdX9al1zM8eh17lKeeQcTMrdD5P8P3j/YT Q/8zXHSb7p1Qz/C4OM2JuZ7hgtI7K6AjqsMnf8j4z8C6xG1tw3+GqpqvsVn/GTzmpD9j/8/wP/oZ S/l/Bka+QO/g/wy15ueeFQL9N1O8mPU/g+umV3t1gdT0/1bTgHLqYVeXAlWKpMWt+w8Az82C9nHf X0cAAAAASUVORK5CYII= In-Reply-To: (Stefan Monnier's message of "Sun, 17 Nov 2013 15:53:27 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.9) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.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:80715 Archived-At: --=-=-= Content-Type: text/plain Implemented as requested. I have also briefly tested with ggtags and it worked. Comments welcome. Thanks. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=13594.diff === modified file 'lisp/progmodes/compile.el' --- lisp/progmodes/compile.el 2013-10-23 16:25:56 +0000 +++ lisp/progmodes/compile.el 2013-11-18 08:37:19 +0000 @@ -1632,7 +1632,7 @@ (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 '(ignore (may-fail . t)))) (with-current-buffer outbuf (let ((process-environment (append @@ -1654,7 +1654,8 @@ (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 @@ -1663,15 +1664,16 @@ (point-max) ;; Normally put it at the top. (point-min)))) - (if (eq outwin (selected-window)) - (goto-char desired-visible-point) + (goto-char desired-visible-point) + (when (eq outwin (selected-window)) (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) + (when (windowp outwin) + (compilation-set-window-height outwin)) ;; Start the compilation. (if (fboundp 'start-process) (let ((proc @@ -2513,14 +2515,17 @@ ;; the error location if the two buffers are in two ;; different frames. So don't do it if it's not necessary. pre-existing - (display-buffer (marker-buffer msg)))) + (display-buffer (marker-buffer msg) '(ignore (may-fail . t))))) (highlight-regexp (with-current-buffer (marker-buffer msg) ;; also do this while we change buffer - (compilation-set-window w msg) + (goto-char (marker-position msg)) + (when (windowp w) + (compilation-set-window w msg)) compilation-highlight-regexp))) ;; Ideally, the window-size should be passed to `display-buffer' ;; so it's only used when creating a new window. - (unless pre-existing (compilation-set-window-height w)) + (when (and (not pre-existing) (windowp w)) + (compilation-set-window-height w)) (if from-compilation-buffer ;; If the compilation buffer window was selected, @@ -2631,9 +2636,12 @@ (while (null buffer) ;Repeat until the user selects an existing file. ;; The file doesn't exist. Ask the user where to find it. (save-excursion ;This save-excursion is probably not right. - (let ((pop-up-windows t)) - (compilation-set-window (display-buffer (marker-buffer marker)) - marker) + (let ((w (let ((pop-up-windows t)) + (display-buffer (marker-buffer marker) + '(ignore (may-fail . t)))))) + (with-current-buffer (marker-buffer marker) + (goto-char marker) + (and (windowp w) (compilation-set-window w marker))) (let* ((name (read-file-name (format "Find this %s in (default %s): " compilation-error filename) === modified file 'lisp/window.el' --- lisp/window.el 2013-11-12 07:25:14 +0000 +++ lisp/window.el 2013-11-18 08:37:19 +0000 @@ -5355,7 +5355,10 @@ ACTION is a cons cell (FUNCTION . ALIST), where FUNCTION is a function or a list of functions. Each such function should accept two arguments: a buffer to display and an alist of the - same form as ALIST. See `display-buffer' for details. + same form as ALIST. If (may-fail . t) is in ALIST, the caller + is prepared to handle non-window return value and FUNCTION can + safely return t to suppress displaying the window. See + `display-buffer' for details. `display-buffer' scans this alist until it either finds a matching regular expression or the function specified by a @@ -5439,9 +5442,12 @@ ALIST is an arbitrary association list (alist). Each such FUNCTION should accept two arguments: the buffer to -display and an alist. Based on those arguments, it should either -display the buffer and return the window, or return nil if unable -to display the buffer. +display and an alist. Based on those arguments, it should +display the buffer and return the window. It may return nil if +unable to display the buffer (which is rare and most callers +don't check this value). If the caller is prepared to handle +non-window return value it should pass (may-fail . t) as an +element of the ALIST. The `display-buffer' function builds a function list and an alist by combining the functions and alists specified in --=-=-=--