From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel,gmane.emacs.help Subject: Re: frames dedicated to buffers, or, always see specific buffers in a specific frame Date: Fri, 12 Apr 2013 16:15:05 +0200 Message-ID: <516816E9.1080206@gmx.at> References: <5167D3B7.2080408@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: ger.gmane.org 1365776123 31105 80.91.229.3 (12 Apr 2013 14:15:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Apr 2013 14:15:23 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org List" , emacs-devel@gnu.org To: =?ISO-8859-1?Q?Jo=E3o_T=E1vora?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 12 16:15:23 2013 Return-path: Envelope-to: ged-emacs-devel@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 1UQel9-0005FF-Ix for ged-emacs-devel@m.gmane.org; Fri, 12 Apr 2013 16:15:23 +0200 Original-Received: from localhost ([::1]:56153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQel9-0006lb-4J for ged-emacs-devel@m.gmane.org; Fri, 12 Apr 2013 10:15:23 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQel0-0006hY-8U for emacs-devel@gnu.org; Fri, 12 Apr 2013 10:15:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQekx-0002pa-O3 for emacs-devel@gnu.org; Fri, 12 Apr 2013 10:15:14 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:50209) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQekx-0002pE-FO for emacs-devel@gnu.org; Fri, 12 Apr 2013 10:15:11 -0400 Original-Received: from mailout-de.gmx.net ([10.1.76.4]) by mrigmx.server.lan (mrigmx002) with ESMTP (Nemesis) id 0Mgr1C-1UDVao1XFo-00M891 for ; Fri, 12 Apr 2013 16:15:10 +0200 Original-Received: (qmail invoked by alias); 12 Apr 2013 14:15:10 -0000 Original-Received: from 62-47-34-237.adsl.highway.telekom.at (EHLO [62.47.34.237]) [62.47.34.237] by mail.gmx.net (mp004) with SMTP; 12 Apr 2013 16:15:10 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1+p0C8mJSap2IIHYutXdZ/SltHWVJwOy2WBGLGg1K 9Z54ZjQm0a3D9/ In-Reply-To: X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.15.18 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:158858 gmane.emacs.help:90119 Archived-At: >> `switch-to-buffer' uses `pop-to-buffer' to make sure the window >> displaying the buffer is selected. You use `display-buffer' which >> doesn't necessarily make the window selected - IIUC you rely on the >> window manager to select the window. > > yes, you understand correctly. So for making this general purpose you should use `pop-to-buffer' instead of `display-buffer'. >> Other from that I don't see anything hackish with your approach if the >> idea is to make `switch-to-buffer' do what you want when it's called >> from other code (which ideally should not happen). In this case you >> might also want to advice `switch-to-buffer-other-window' accordingly. > > I do want that precisely. `display-buffer-alist' apparently allows me (a LOT of) > control how `display-buffer' but not ... only, I presume ... > when it is called. The advice is because I > want ibuffer and ido to work with this as well. These should refrain from using `switch-to-buffer(-...)' and use `pop-to-buffer' with the `display-buffer-same-window' directive instead. Wherever this bothers you, file a bug report so it gets fixed. > The hackish part is was also that I call the predicate twice, but I can simplify > that... > > (defadvice switch-to-buffer (around joaot/browse-buffer-maybe activate) > (if (joaot/browse-buffer-p buffer-or-name nil) > (let ((display-buffer-alist `(("" . > (joaot/browse-buffer-in-special-frame . nil))))) > (display-buffer buffer-or-name)) > ad-do-it)) > > However, I still have to have to set `display-buffer-alist' globally for those > functions who call `display-buffer' directly, like `describe-function' does for > "*Help*" buffers, for example. > > (setq display-buffer-alist > `((joaot/browse-buffer-p . (joaot/browse-buffer-in-special-frame . nil)))) > > I'm quite happy with this functionally, and find this feature is quite useful to > keep focus on one frame, but be able to look at a secondary frame on a second > monitor for reference and only switching to it occasionally. I just don't understand whether you deliberately name buffers specially to exploit this feature. Couldn't you use some more human predicate for this purpose? > Ideally I would want anywthing with the meaning "switch to some buffer" (be it > `pop-to-buffer', `switch-to-buffer-other-window`, `display-buffer`, etc...) to > be be hookable at some common point, much as is already done with `display- > buffer'. This was the intention of `display-buffer-alist' and IIRC at some time I had already removed all calls of `switch-to-buffer' from the Emacs code base. Somehow this got reverted later. > Or alternatively, and maybe simpler, if `display-buffer' is so powerful, why > can't it be used by `switch-to-buffer' and friends? I know `diplay-buffer''s > semantics are "display without selecting", but can't those be relaxed and the > "without selecting" part be just the default? `switch-to-buffer' is the traditional means to interactively show a buffer in the selected window. It shouldn't be used in Lisp code. > Another, distinct, small problem persists, and I suspect it has to do with not > understanding what the various alists are in the documentation of > `display-buffer' > and `display-buffer-alist'... > > Specifically, how can I prevent `display-buffer' from stopping at one of > the actions that I specify in `display-buffer-alist'? For example, > `describe-function' shows me the buffer on the secondary "browse" frame" but > still keeps the current pop-to-frame behaviour. I'm going to have a look at > `display-buffer-overriding-alist', maybe that will do it. This doesn't sound right. When `display-buffer' has found a window it should stop right there. Anything else would constitute a bug. If you can reproduce it, step through it with the debugger to find out what goes wrong. martin