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: frames dedicated to buffers, or, always see specific buffers in a specific frame Date: Wed, 10 Apr 2013 21:52:49 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1365627204 20626 80.91.229.3 (10 Apr 2013 20:53:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 10 Apr 2013 20:53:24 +0000 (UTC) To: "help-gnu-emacs@gnu.org List" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 10 22:53:28 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 1UQ21G-0002VH-Re for geh-help-gnu-emacs@m.gmane.org; Wed, 10 Apr 2013 22:53:26 +0200 Original-Received: from localhost ([::1]:54087 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ21G-0000bW-Ga for geh-help-gnu-emacs@m.gmane.org; Wed, 10 Apr 2013 16:53:26 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ213-0000bR-Gx for help-gnu-emacs@gnu.org; Wed, 10 Apr 2013 16:53:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQ211-0007fa-A0 for help-gnu-emacs@gnu.org; Wed, 10 Apr 2013 16:53:13 -0400 Original-Received: from mail-pa0-f54.google.com ([209.85.220.54]:41227) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ211-0007fP-41 for help-gnu-emacs@gnu.org; Wed, 10 Apr 2013 16:53:11 -0400 Original-Received: by mail-pa0-f54.google.com with SMTP id fa11so517739pad.13 for ; Wed, 10 Apr 2013 13:53:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:from:date:message-id:subject:to :content-type; bh=FAaBZqnqfhLG/prvW7d58OTaJ0LrVwnoIDfD/sBg0UY=; b=zANglNbxEhih2jxgwij4KiuCuAwkcFKPKbhMkQ3Khwvslf8v3WqF7ejKEZ8QarldGf vreRnGHyVVD5C7LGjBsDNZkclcKixQ2cwkAE9i7+X7dJ04Kb8EtPjQYxj3dQ9tblBaoh o4EiH0JhRs+YIEjidicibfLFF+Nxpo956C2Z2LgWh+r3vCOjwBSStKdzh6fgGtukxnEG IOHYJVsqRKYbFQt2QfcgqBNTXrhpvwwicazAlNlqXUqOV7nxevxP/o07jAxyf4PXzLE/ 8efiQULmsBBtz/YLvnEXd1f91u2SX7ko/9NtxicxYmW1gdu+cKq/ak13TVmqtoS2POgQ jWzA== X-Received: by 10.68.212.168 with SMTP id nl8mr5123100pbc.43.1365627189952; Wed, 10 Apr 2013 13:53:09 -0700 (PDT) Original-Received: by 10.69.16.36 with HTTP; Wed, 10 Apr 2013 13:52:49 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.220.54 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:90069 Archived-At: 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 :-)