From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: get-buffer-window should prefer windows on selected frame Date: Mon, 05 Dec 2005 11:11:44 -0500 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1133801344 23888 80.91.229.2 (5 Dec 2005 16:49:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 5 Dec 2005 16:49:04 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 05 17:48:49 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EjJTR-0003GJ-Iz for ged-emacs-devel@m.gmane.org; Mon, 05 Dec 2005 17:45:58 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EjJTa-0003sz-8L for ged-emacs-devel@m.gmane.org; Mon, 05 Dec 2005 11:46:06 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EjIwd-0005nA-U9 for emacs-devel@gnu.org; Mon, 05 Dec 2005 11:12:04 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EjIwa-0005hG-LU for emacs-devel@gnu.org; Mon, 05 Dec 2005 11:12:03 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EjIwa-0005gp-BZ for emacs-devel@gnu.org; Mon, 05 Dec 2005 11:12:00 -0500 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EjIx6-0008Bv-9h for emacs-devel@gnu.org; Mon, 05 Dec 2005 11:12:32 -0500 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 405F02CF6E5; Mon, 5 Dec 2005 11:11:49 -0500 (EST) Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id E30154AC00A; Mon, 5 Dec 2005 11:11:44 -0500 (EST) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id CCC10E6C1F; Mon, 5 Dec 2005 11:11:44 -0500 (EST) Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-4.852, requis 5, autolearn=not spam, AWL 0.05, BAYES_00 -4.90) X-MailScanner-From: monnier@iro.umontreal.ca X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:47001 Archived-At: get-buffer-window currently favors returning the selected-window (if it shows the requested buffer, of course) over other windows. I think this should be extended so that if the selected-window doesn't show the buffer, but some other window on the selected frame does show it, that window should be picked in preference to other windows on other frames. Any objection to the patch below? Stefan Index: src/window.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/window.c,v retrieving revision 1.529 diff -u -r1.529 window.c --- src/window.c 1 Dec 2005 16:25:15 -0000 1.529 +++ src/window.c 5 Dec 2005 16:07:28 -0000 @@ -1996,8 +1996,10 @@ if (NILP (best_window)) best_window = window; else if (EQ (window, selected_window)) - /* For compatibility with 20.x, prefer to return - selected-window. */ + /* Prefer to return selected-window. */ + RETURN_UNGCPRO (window); + else if (EQ (Fwindow_frame (window), selected_frame)) + /* Prefer windows on the current frame. */ best_window = window; } break;