From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Steven Degutis Newsgroups: gmane.emacs.help Subject: Re: frames dedicated to buffers, or, always see specific buffers in a specific frame Date: Wed, 10 Apr 2013 16:30:50 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=e89a8ff1c33a53b47404da08624a X-Trace: ger.gmane.org 1365629469 10993 80.91.229.3 (10 Apr 2013 21:31:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 10 Apr 2013 21:31:09 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org List" To: =?ISO-8859-1?Q?Jo=E3o_T=E1vora?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 10 23:31:12 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 1UQ2bn-0007si-Pe for geh-help-gnu-emacs@m.gmane.org; Wed, 10 Apr 2013 23:31:12 +0200 Original-Received: from localhost ([::1]:60083 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ2bn-00041T-Dm for geh-help-gnu-emacs@m.gmane.org; Wed, 10 Apr 2013 17:31:11 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ2bX-00041O-Se for help-gnu-emacs@gnu.org; Wed, 10 Apr 2013 17:30:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQ2bU-0001qy-SR for help-gnu-emacs@gnu.org; Wed, 10 Apr 2013 17:30:55 -0400 Original-Received: from mail-pd0-f173.google.com ([209.85.192.173]:46814) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ2bU-0001qo-72 for help-gnu-emacs@gnu.org; Wed, 10 Apr 2013 17:30:52 -0400 Original-Received: by mail-pd0-f173.google.com with SMTP id v14so487959pde.4 for ; Wed, 10 Apr 2013 14:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=R8xewTemOIaTIsAlzPDyw3qlURpQflzUw/DSEZLeBz0=; b=ir7ujxAM2wTVeBA4WYuCeMub82FNdhTDuDDdpS1lyypwJljzOqc9dVPSUDjQxR+Cn0 kDEzBD5q/nG2xtBnK5FaCs4WYrB1CekMlEd84rM/X3C4ALJxqAkW9JfhawAoPtHdPeOd hxlNVd4sQtf9JLEcelW6arzHVzSNalUB76/ZdwlGB89O97XEAPkScKSnADxt/ms0SIwY PJ9LitZGIFQaRkKT7I1fKB4P+83VXIvEmx/RtyVJ8ke5fQNX2QUSUHXH0dqLZ0P+RhcL UIo+gxMsyf4mDguSZ9Uvfln63usuA1wlIq3YpT4xQCR96PuEvWxoz1/tn7kZ/wEdvDiE UZrQ== X-Received: by 10.68.211.161 with SMTP id nd1mr5281793pbc.59.1365629451087; Wed, 10 Apr 2013 14:30:51 -0700 (PDT) Original-Received: by 10.70.24.197 with HTTP; Wed, 10 Apr 2013 14:30:50 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.192.173 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:90070 Archived-At: --e89a8ff1c33a53b47404da08624a Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Depending on why you want this behavior, you might find this project useful: https://github.com/sdegutis/project-buffers.el -Steven On Wed, Apr 10, 2013 at 3:52 PM, Jo=E3o T=E1vora wro= te: > So I needed to scratch a code-browsing itch and came up with this monster= : > > (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 :-) > > --e89a8ff1c33a53b47404da08624a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Depending on why you want this behavior, you might find th= is project useful:=A0https://github.com/sdegutis/project-buffers.el

= -Steven


On Wed,= Apr 10, 2013 at 3:52 PM, Jo=E3o T=E1vora <joaotavora@gmail.com>= wrote:
So I needed to scratch a code-browsing itch = and came up with this monster:

(defvar joaot/browse-frame)
(setq joaot/browse-frame (new-frame))
(setq display-buffer-alist
=A0 =A0 =A0 `((joaot/browse-buffer-p . (joaot/browse-buffer-in-special-fram= e . nil))))

(defun joaot/browse-buffer-p (buffer action)
=A0 (declare (ignore action))
=A0 (let ((buffer (and buffer
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(get-buffer buffer))))
=A0 =A0 (and (frame-live-p joaot/browse-frame)
=A0 =A0 =A0 =A0 =A0buffer
=A0 =A0 =A0 =A0 =A0(buffer-file-name buffer)
=A0 =A0 =A0 =A0 =A0(string-match "someproject" (buffer-file-name = buffer)))))

(defun joaot/browse-buffer-in-special-frame (buffer alist)
=A0 (let ((window (frame-selected-window joaot/browse-frame)))
=A0 =A0 (window--display-buffer buffer window 'reuse alist)))

(defadvice switch-to-buffer (around joaot/browse-buffer-maybe activate)
=A0 (if (joaot/browse-buffer-p buffer-or-name nil)
=A0 =A0 =A0 (display-buffer buffer-or-name)
=A0 =A0 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 s= ure
the buffer is displayed in a special "browse-frame" created befor= ehand
and that lives in my secondary monitor.

This is not quite "dedicated windows". It's sort of frames de= dicated
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 :-)


--e89a8ff1c33a53b47404da08624a--