From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dave Abrahams Newsgroups: gmane.emacs.bugs Subject: bug#12081: 24.1; buffer-predicate often not called Date: Mon, 13 Aug 2012 18:13:49 -0400 Message-ID: References: <5015411C.30803@gmx.at> <50156DFA.8030104@gmx.at> <5016502A.8060300@gmx.at> <5016C779.2010902@gmx.at> <501799D4.1000707@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1344896075 21243 80.91.229.3 (13 Aug 2012 22:14:35 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 13 Aug 2012 22:14:35 +0000 (UTC) Cc: Alp Aker , 12081@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 14 00:14:35 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 1T12u9-0003XV-W5 for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 Aug 2012 00:14:34 +0200 Original-Received: from localhost ([::1]:38960 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T12u8-00036T-IR for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 Aug 2012 18:14:32 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T12u5-00036H-EB for bug-gnu-emacs@gnu.org; Mon, 13 Aug 2012 18:14:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T12u3-0004Lj-P8 for bug-gnu-emacs@gnu.org; Mon, 13 Aug 2012 18:14:29 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T12u3-0004Lf-LW for bug-gnu-emacs@gnu.org; Mon, 13 Aug 2012 18:14:27 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1T132L-00027x-Oh for bug-gnu-emacs@gnu.org; Mon, 13 Aug 2012 18:23:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dave Abrahams Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 13 Aug 2012 22:23:01 +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.13448965508139 (code B ref 12081); Mon, 13 Aug 2012 22:23:01 +0000 Original-Received: (at 12081) by debbugs.gnu.org; 13 Aug 2012 22:22:30 +0000 Original-Received: from localhost ([127.0.0.1]:54379 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T131q-00027D-Bo for submit@debbugs.gnu.org; Mon, 13 Aug 2012 18:22:30 -0400 Original-Received: from mail-qc0-f172.google.com ([209.85.216.172]:35016) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T131o-000276-9F for 12081@debbugs.gnu.org; Mon, 13 Aug 2012 18:22:29 -0400 Original-Received: by qcac10 with SMTP id c10so3292617qca.3 for <12081@debbugs.gnu.org>; Mon, 13 Aug 2012 15:13:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:x-gm-message-state; bh=4f+3PN+S8KKIxLKc8GJvqRVWXLf8wm0cVDwX5olQ/do=; b=h/UIXYc0adTQEIM7ELRCQqbwf/mG9NhXmhA1Pi0qdzhC0uZsmmG8D8GZjeJY29Fll5 4z5phurHHf1XouBuYntvBm1AOQzMHwa/iT+aMR5X/duYB5TNljZjVw2tzwOFBPYb9FSD KDSL8UThygWhxoycINgPIXjxgH5BkgUE0g//4443yBn/cg+rLDynZ3ccFVKibstteyni 0EdEhaOTauwqQy4Q3W62IN3FvXqvgSkxJsJ7+uAuzSyrc0CMfJL5B/kMX9fBRSoODZTZ iqcmXUnD9SER/+4vOrWy/hNPMkFpnaREjFEUPW4AYVSSWKqnU0F1TDG/WuZjEG8mtcwN Mq3w== Original-Received: by 10.224.52.205 with SMTP id j13mr28317127qag.62.1344896032269; Mon, 13 Aug 2012 15:13:52 -0700 (PDT) Original-Received: from pluto.luannocracy.com (207-172-223-249.c3-0.smr-ubr3.sbo-smr.ma.static.cable.rcn.com. [207.172.223.249]) by mx.google.com with ESMTPS id eb10sm1104335qab.4.2012.08.13.15.13.50 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 13 Aug 2012 15:13:51 -0700 (PDT) Original-Received: by pluto.luannocracy.com (Postfix, from userid 501) id 9D4825DF7281; Mon, 13 Aug 2012 18:13:49 -0400 (EDT) In-Reply-To: <501799D4.1000707@gmx.at> (martin rudalics's message of "Tue, 31 Jul 2012 10:39:48 +0200") User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1 (darwin) X-Gm-Message-State: ALoCoQmqtTO0T0miSRQfyfUocnwd3djoZ6d8OfZ6voblddtfsncjx7mIA2+lgiRyOhq9kEWauOek 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:63123 Archived-At: on Tue Jul 31 2012, martin rudalics wrote: >> When I kill a buffer in a particular workgroup, I want the replacement >> buffer to be one that appeared recently in that workgroup, rather than >> just something that's been seen recently in this frame. > > So a workgroup specifies a subset of all live buffers and the > buffer-predicate you run on any of the buffers `switch-to-prev-buffer' > proposes, sanctions the argument buffer iff it's part of that workgroup. > Is that correct? Almost. When a buffer is displayed, it is associated with the current workgroup via a buffer-local variable. The buffer-predicate returns true for any buffer associated with the current workgroup and returns false for any others. > This gives you little space in choosing the most suitable buffer from > that workgroup. True. I figure Emacs already has a heuristic for "most suitable," and I just want it to apply that to the set of buffers whose last appearance was in the current workgroup. > Wouldn't it make more sense to provide a > `switch-to-prev-buffer-function' with the window as argument and, if > that function returns a live buffer which is not the same as the > window's current buffer, use that buffer to replace the current one? > > Or maybe better: Give each window a `prev-buffer' window parameter such > that > > (1) if it is a function, have `switch-to-prev-buffer' call that function > and use its return value (in your case, the function would choose > the buffer from the workgroup), > > (2) if it is a regexp or a list of buffers or names, try to use that > list for determining the buffer to switch to (in your case, that > list would be the buffers of the workgroup sorted acording to some > criteria). If a buffer name in that list has no associated buffer, > `switch-to-prev-buffer' could create one if needed. Well, yeah, all these things make sense if you're going to go so far as to redesign or extend Emacs itself. I was looking for a less-intrusive solution, and to me, it seemed that the buffer predicate was simply not working as it was supposed to. >> Yes, I realized that only after I had implemented this. But as >> mentioned elsewhere: >> >> 1. there are no obvious uses for buffer-predicate if it doesn't also >> work for kill-buffer > > If the buffer predicate affects _only_ what `kill-buffer', `bury-buffer' > or `replace-buffer-in-windows' do, then this should be reflected in the > name of the parameter OK > and `other-buffer' probably should not even care about this parameter. Why not? >> 2. IIUC it used to work for kill-buffer, probably because kill-buffer >> used to call other-buffer. > > I think so. And it would have been easier to avoid the problem we > discuss here if the parameter had a better name and/or description. Probably. -- Dave Abrahams BoostPro Computing Software Development Training http://www.boostpro.com Clang/LLVM/EDG Compilers C++ Boost