From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.help Subject: Re: frames dedicated to buffers, or, always see specific buffers in a specific frame Date: Fri, 12 Apr 2013 11:28:23 +0200 Message-ID: <5167D3B7.2080408@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1365758929 6753 80.91.229.3 (12 Apr 2013 09:28:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Apr 2013 09:28:49 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: joaotavora@gmail.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 12 11:28:51 2013 Return-path: Envelope-to: geh-help-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 1UQaHp-0001SN-Ci for geh-help-gnu-emacs@m.gmane.org; Fri, 12 Apr 2013 11:28:49 +0200 Original-Received: from localhost ([::1]:53672 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQaHo-00062K-Tq for geh-help-gnu-emacs@m.gmane.org; Fri, 12 Apr 2013 05:28:48 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:43846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQaHc-00062E-Ax for help-gnu-emacs@gnu.org; Fri, 12 Apr 2013 05:28:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQaHb-0005UC-50 for help-gnu-emacs@gnu.org; Fri, 12 Apr 2013 05:28:36 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:51790) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQaHa-0005Ty-TE for help-gnu-emacs@gnu.org; Fri, 12 Apr 2013 05:28:35 -0400 Original-Received: from mailout-de.gmx.net ([10.1.76.10]) by mrigmx.server.lan (mrigmx002) with ESMTP (Nemesis) id 0Mgr1C-1UDIcR0dVo-00M8Bv for ; Fri, 12 Apr 2013 11:28:31 +0200 Original-Received: (qmail invoked by alias); 12 Apr 2013 09:28:30 -0000 Original-Received: from 62-47-40-70.adsl.highway.telekom.at (EHLO [62.47.40.70]) [62.47.40.70] by mail.gmx.net (mp010) with SMTP; 12 Apr 2013 11:28:30 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1+yONxqNWWy2HC5+fzgX/P54R/o/WXMd77EJBStwG 9rQw/ozmMkzUwb Original-References: CALDnm51T6_8kjaREV7cPwGwJNN-ZyajrZudmZSZBA-7vxUnyPQ@mail.gmail.com 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.17.22 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:90113 Archived-At: > (defadvice switch-to-buffer (around joaot/browse-buffer-maybe activate) > (if (joaot/browse-buffer-p buffer-or-name nil) > (display-buffer buffer-or-name) > ad-do-it)) > > Does anyone know of a less hackish way to do this? The defadvice is > particularly nasty... Do you see this breaking anything important that > I'm not seeing?? `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. 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. Interactively, you obviously should define your own function and bind it to C-x b. martin