From: "João Távora" <joaotavora@gmail.com>
To: Steven Degutis <sbdegutis@gmail.com>
Cc: "help-gnu-emacs@gnu.org List" <help-gnu-emacs@gnu.org>
Subject: Re: frames dedicated to buffers, or, always see specific buffers in a specific frame
Date: Thu, 11 Apr 2013 02:22:47 +0100 [thread overview]
Message-ID: <CALDnm52U_A4Kq32F5O3Zoaq1Nid9T2nVC3iVDor66D9cjW0WPg@mail.gmail.com> (raw)
In-Reply-To: <CACeWA3iE0WH_54xdus6ufkE_6fWSgN4nN8J93i3toYBCUvF_SA@mail.gmail.com>
On Wed, Apr 10, 2013 at 10:30 PM, Steven Degutis <sbdegutis@gmail.com> wrote:
> Depending on why you want this behavior, you might find this project useful:
> 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ão Távora <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
>> `((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 :-)
>>
>
--
João Távora
next prev parent reply other threads:[~2013-04-11 1:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 20:52 frames dedicated to buffers, or, always see specific buffers in a specific frame João Távora
2013-04-10 21:30 ` Steven Degutis
2013-04-11 1:22 ` João Távora [this message]
2013-04-11 12:42 ` Stefan Monnier
2013-04-11 12:46 ` Stefan Monnier
-- strict thread matches above, loose matches on Subject: below --
2013-04-12 9:28 martin rudalics
2013-04-12 12:12 ` João Távora
2013-04-12 13:13 ` João Távora
2013-04-12 14:15 ` martin rudalics
[not found] ` <CALDnm50Q=eNA6rgUS-DQD2RLuE=kyizGpYWyENVU=2Py+-MTig@mail.gmail.com>
2013-04-14 18:42 ` João Távora
2013-04-15 7:11 ` martin rudalics
2013-04-12 16:45 ` Stefan Monnier
2013-04-13 8:01 ` martin rudalics
2013-04-14 18:18 ` João Távora
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CALDnm52U_A4Kq32F5O3Zoaq1Nid9T2nVC3iVDor66D9cjW0WPg@mail.gmail.com \
--to=joaotavora@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=sbdegutis@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.