From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Jo=E3o_T=E1vora?= Newsgroups: gmane.emacs.help Subject: Re: frames dedicated to buffers, or, always see specific buffers in a specific frame Date: Thu, 11 Apr 2013 02:22:47 +0100 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1365643397 10523 80.91.229.3 (11 Apr 2013 01:23:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 11 Apr 2013 01:23:17 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org List" To: Steven Degutis Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Apr 11 03:23:21 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 1UQ6ES-0002HU-Mk for geh-help-gnu-emacs@m.gmane.org; Thu, 11 Apr 2013 03:23:20 +0200 Original-Received: from localhost ([::1]:36895 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ6ES-0004lO-9Q for geh-help-gnu-emacs@m.gmane.org; Wed, 10 Apr 2013 21:23:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ6EH-0004l4-JT for help-gnu-emacs@gnu.org; Wed, 10 Apr 2013 21:23:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQ6EG-0000mv-I0 for help-gnu-emacs@gnu.org; Wed, 10 Apr 2013 21:23:09 -0400 Original-Received: from mail-pa0-f53.google.com ([209.85.220.53]:37595) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ6EG-0000mi-CE for help-gnu-emacs@gnu.org; Wed, 10 Apr 2013 21:23:08 -0400 Original-Received: by mail-pa0-f53.google.com with SMTP id bh4so607530pad.40 for ; Wed, 10 Apr 2013 18:23:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=yC8wwu1DTeg1ja0b9LtSuWj8jSLJaZt5HFWddoDtNKI=; b=bcQVZr9I56MDwSyigAEwoa1fu34iKLKveGMb6yxRLPU2/mQ4B7G5Gk+mBFk7TPxiae hBOBdvCRIisNuWNB8c8uGH6vaWh6MN2CjnYegRKEJRKEMTWnX5IBUm83EZ0VKyueilr/ 8+iwan7ZqM8ucHYBnxrevBtrWHgeudtjyjaOzppe7kSKaxawB7drzxRFirHsyALBYm6e I6akMbh1yVV5QRATLf6TaDy5LsRUbiY5l08iMmB6qMLr5mhegdqsNVhTdQjnGpFwnzgt 0VnzRSCLYfpKUQKX244H7xP7vaMWajmNSqKsZzL2kXas3O5fyI36v/zqPdmbNtQuocUe ZjfA== X-Received: by 10.66.164.6 with SMTP id ym6mr6672637pab.92.1365643387283; Wed, 10 Apr 2013 18:23:07 -0700 (PDT) Original-Received: by 10.69.16.36 with HTTP; Wed, 10 Apr 2013 18:22:47 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.220.53 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:90074 Archived-At: On Wed, Apr 10, 2013 at 10:30 PM, Steven Degutis wrot= e: > Depending on why you want this behavior, you might find this project usef= ul: > https://github.com/sdegutis/project-buffers.el Thanks, but this quite unrelated to what I'm asking for. I want Emacs to always display certain buffers in a different Emacs frame. The (string-match "someproject" ...) dummy example I provided is just one of many possible criteria for selecting buffers, it could be something completely different, like read-only buffers, for example. > > On Wed, Apr 10, 2013 at 3:52 PM, Jo=E3o T=E1vora w= rote: >> >> So I needed to scratch a code-browsing itch and came up with this monste= r: >> >> (defvar joaot/browse-frame) >> (setq joaot/browse-frame (new-frame)) >> (setq display-buffer-alist >> `((joaot/browse-buffer-p . (joaot/browse-buffer-in-special-frame . >> nil)))) >> >> (defun joaot/browse-buffer-p (buffer action) >> (declare (ignore action)) >> (let ((buffer (and buffer >> (get-buffer buffer)))) >> (and (frame-live-p joaot/browse-frame) >> buffer >> (buffer-file-name buffer) >> (string-match "someproject" (buffer-file-name buffer))))) >> >> (defun joaot/browse-buffer-in-special-frame (buffer alist) >> (let ((window (frame-selected-window joaot/browse-frame))) >> (window--display-buffer buffer window 'reuse alist))) >> >> (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)) >> >> Do you see what it is doing? Whenever I switch to a buffer or file >> belonging to "someproject", which I only want to read, it makes sure >> the buffer is displayed in a special "browse-frame" created beforehand >> and that lives in my secondary monitor. >> >> This is not quite "dedicated windows". It's sort of frames dedicated >> to buffers. >> >> 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?? >> >> Thanks in advance, >> J >> >> PS: yes I refuse to open a secondary emacs instance on principle :-) >> > --=20 Jo=E3o T=E1vora