[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
switch/selecting buffers in frames/windows.
From: |
Eric Abrahamsen |
Subject: |
switch/selecting buffers in frames/windows. |
Date: |
Mon, 15 Sep 2014 15:22:37 +0800 |
User-agent: |
Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4.50 (gnu/linux) |
Turns out buffer switching is hard...
First of all, I'm on 24.4 -- it looks like things have changed since
24.3.
When opening a Gnus link from Org, I'm trying to keep things a little
cleaner in terms of frame/window re-usage. I almost always have the Gnus
*Group* buffer already visible in one of my frames, and don't need to
re-display it in a new window. Additionally I have noticed weirdness if
I open a link to a message that's in a group whose *Summary* buffer is
already visible.
I'm falling down a bit with the difference between displaying and
selecting buffers. Here's my code as it stands. ('messages' is a list of
org links to Gnus messages. The links look like
GnusGroupName#Message-ID):
(let* ((link (org-link-unescape (car messages)))
(group (car (org-split-string link "#")))
(id (second (org-split-string link "#")))
(sum-buffer (gnus-summary-buffer-name group)))
(if (gnus-buffer-exists-p sum-buffer)
(progn
(display-buffer sum-buffer nil t)
(gnus-summary-goto-article id nil t))
(when (gnus-buffer-exists-p gnus-group-buffer)
(display-buffer gnus-group-buffer nil t))
(org-gnus-open link))
;; Do things...
)
Hopefully the logic of what I'm after is clear from that.
This displays buffers correctly, but does not select them. That means
that, in the branches that include a call to `display-buffer', the code
immediately following is still executed in the frame that was originally
selected.
The whole thing is hard to follow. There doesn't seem to be a
one-stop-shop that both displays and selects a buffer across frames, and
I suspect best practices are also an issue here -- I'd like to do this
right. `switch-to-buffer' would be the right thing, but it doesn't
appear to work across frames.
Can someone show me how to DTRT? This is actually Gnorb code that I
would like to work on both 24.3 and 24.4, so bonus extra gratitude to
anyone who can give me equivalent solutions for both versions...
Thanks!
Eric
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- switch/selecting buffers in frames/windows.,
Eric Abrahamsen <=