From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#12081: 24.1; buffer-predicate often not called Date: Mon, 30 Jul 2012 11:13:14 +0200 Message-ID: <5016502A.8060300@gmx.at> References: <5015411C.30803@gmx.at> <50156DFA.8030104@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1343639647 15437 80.91.229.3 (30 Jul 2012 09:14:07 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 30 Jul 2012 09:14:07 +0000 (UTC) Cc: Dave Abrahams , 12081@debbugs.gnu.org To: Alp Aker Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 30 11:14:06 2012 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 1Svm37-0007O8-SU for geb-bug-gnu-emacs@m.gmane.org; Mon, 30 Jul 2012 11:14:02 +0200 Original-Received: from localhost ([::1]:58763 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Svm36-0005kL-U7 for geb-bug-gnu-emacs@m.gmane.org; Mon, 30 Jul 2012 05:14:00 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:52972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Svm2z-0005jK-5T for bug-gnu-emacs@gnu.org; Mon, 30 Jul 2012 05:13:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Svm2x-0006lg-5I for bug-gnu-emacs@gnu.org; Mon, 30 Jul 2012 05:13:53 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Svm2x-0006lc-1U for bug-gnu-emacs@gnu.org; Mon, 30 Jul 2012 05:13:51 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Svm9v-0000u1-CW for bug-gnu-emacs@gnu.org; Mon, 30 Jul 2012 05:21:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 30 Jul 2012 09:21:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12081 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12081-submit@debbugs.gnu.org id=B12081.13436400153381 (code B ref 12081); Mon, 30 Jul 2012 09:21:03 +0000 Original-Received: (at 12081) by debbugs.gnu.org; 30 Jul 2012 09:20:15 +0000 Original-Received: from localhost ([127.0.0.1]:49972 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Svm99-0000sT-6K for submit@debbugs.gnu.org; Mon, 30 Jul 2012 05:20:15 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:40538) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1Svm96-0000sL-42 for 12081@debbugs.gnu.org; Mon, 30 Jul 2012 05:20:13 -0400 Original-Received: (qmail invoked by alias); 30 Jul 2012 09:12:58 -0000 Original-Received: from 62-47-32-67.adsl.highway.telekom.at (EHLO [62.47.32.67]) [62.47.32.67] by mail.gmx.net (mp031) with SMTP; 30 Jul 2012 11:12:58 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX19PmkZAQeJPxgMQF9GH8D+E6+vgsaQ6pzV1YuYTVf hy+wrJnuz4m4Cf In-Reply-To: X-Y-GMX-Trusted: 0 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 (newer, 2) 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:62612 Archived-At: >> Why is showing the buffer visiting /tmp/xx bad in your scenario? Can >> you give a scenario where the present behavior really hurts you? In >> that case we can try to ignore such a buffer in `switch-to-prev-buffer'. > > Well, note that it's a regression: replace-buffer-in-windows used to > call other-window (via window-loop). This doesn't explain why showing the buffer visiting /tmp/xx is bad here. If you show a buffer A in a window, then show a buffer B in that window and subsequently kill B, the most natural thing is to show A again in that window. In particular so, if B was used to display some temporary information. > As for how it hurts not to check buffer predicates in > swtich-to-prev-buffer: Buffer predicates are supposed to provide a > way of exercising some control over what buffers are automatically > selected for display. In Dave's scenario neither of the file visiting buffers was shown automatically but under the user's control. > But if kill-buffer doesn't respect buffer > predicates, then there's not much point to setting up a buffer > predicate at all: why bother filtering buffers chosen for display, if > the filter isn't respected by one of the most common ways in which a > buffer is chosen for the user? `other-buffer' is used in many places for different reasons, so it's by no means obvious that it's about "filtering buffers chosen for display". It has been used in `replace-buffer-in-windows' because there was no better alternative. And it might have been a good idea to not call this parameter "buffer-predicate" in the first place but something more indicative. Also the manual text > `buffer-predicate' > The buffer-predicate function for this frame. The function > `other-buffer' uses this predicate (from the selected frame) to > decide which buffers it should consider, if the predicate is not > `nil'. It calls the predicate with one argument, a buffer, once > for each buffer; if the predicate returns a non-`nil' value, it > considers that buffer. is misleading: Neither `other-buffer' nor `replace-buffer-in-windows' necessarily care about which frame is selected when they get called. When killing a buffer `replace-buffer-in-windows' obviously has to act on all windows on all frames. > It seems like something like the following would restore the old functionality: What's the reason for doing > + ;; If we reach this, then either: (1) we have a > + ;; candidate buffer that was skipped because it was already visible on > + ;; the frame, in which case we switch to it now, or (2) no candidate > + ;; was found, in which case we switch to *scratch*. > + (if visible > + (setq new-buffer visible) > + (setq new-buffer (get-buffer-create "*scratch*"))) > + (set-window-buffer-start-and-point window new-buffer)) > + [...] > + ;; If we reach this, then either: (1) we have a candidate buffer that > + ;; was skipped because it was already visible on the frame, in which > + ;; case we switch to it now, or (2) no candidate was found, in which > + ;; case we switch to *scratch*. > + (if visible > + (setq new-buffer visible) > + (setq new-buffer (get-buffer-create "*scratch*"))) > + (set-window-buffer-start-and-point window new-buffer)) > + IIUC these changes are not related to the issue we're discussing here. Apart from that I see no problems applying your patch. martin