help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: frames dedicated to buffers, or, always see specific buffers in a sp


From: martin rudalics
Subject: Re: frames dedicated to buffers, or, always see specific buffers in a specific frame
Date: Fri, 12 Apr 2013 11:28:23 +0200

> (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








reply via email to

[Prev in Thread] Current Thread [Next in Thread]