* window-next-buffers
@ 2011-11-24 7:58 Chong Yidong
2011-11-24 9:24 ` window-next-buffers Chong Yidong
2011-11-24 9:59 ` window-next-buffers martin rudalics
0 siblings, 2 replies; 13+ messages in thread
From: Chong Yidong @ 2011-11-24 7:58 UTC (permalink / raw)
To: Martin Rudalics; +Cc: emacs-devel
IIUC, the functions window-next-buffers and set-window-next-buffers (and
the corresponding next_buffers slot) exist for navigating "forward" in
the window history list, via switch-to-next-buffer, after doing
switch-to-prev-buffer.
Maintaining separate prev-history and next-history lists is not very
Emacs-y. Why isn't this a ring?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: window-next-buffers
2011-11-24 7:58 window-next-buffers Chong Yidong
@ 2011-11-24 9:24 ` Chong Yidong
2011-11-24 10:07 ` window-next-buffers martin rudalics
2011-11-24 9:59 ` window-next-buffers martin rudalics
1 sibling, 1 reply; 13+ messages in thread
From: Chong Yidong @ 2011-11-24 9:24 UTC (permalink / raw)
To: Martin Rudalics; +Cc: emacs-devel
Chong Yidong <cyd@gnu.org> writes:
> IIUC, the functions window-next-buffers and set-window-next-buffers (and
> the corresponding next_buffers slot) exist for navigating "forward" in
> the window history list, via switch-to-next-buffer, after doing
> switch-to-prev-buffer.
>
> Maintaining separate prev-history and next-history lists is not very
> Emacs-y. Why isn't this a ring?
On second thought, never mind. We don't generally use rings for
history. I do find the window-next-buffers stuff a bit weird, somehow,
but it's not important.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: window-next-buffers
2011-11-24 7:58 window-next-buffers Chong Yidong
2011-11-24 9:24 ` window-next-buffers Chong Yidong
@ 2011-11-24 9:59 ` martin rudalics
2011-11-24 19:00 ` window-next-buffers Juri Linkov
1 sibling, 1 reply; 13+ messages in thread
From: martin rudalics @ 2011-11-24 9:59 UTC (permalink / raw)
To: Chong Yidong; +Cc: emacs-devel
> IIUC, the functions window-next-buffers and set-window-next-buffers (and
> the corresponding next_buffers slot) exist for navigating "forward" in
> the window history list, via switch-to-next-buffer, after doing
> switch-to-prev-buffer.
>
> Maintaining separate prev-history and next-history lists is not very
> Emacs-y. Why isn't this a ring?
Because `window-previous-buffers' returns a list of <buffer window-start
pos> triples where the latter two are markers and `window-next-buffers'
a plain list of buffers. Maintaining markers is expensive, so I wanted
to reduce the overhead for the next buffers part of the list.
martin
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: window-next-buffers
2011-11-24 9:59 ` window-next-buffers martin rudalics
@ 2011-11-24 19:00 ` Juri Linkov
2011-11-25 10:15 ` window-next-buffers martin rudalics
0 siblings, 1 reply; 13+ messages in thread
From: Juri Linkov @ 2011-11-24 19:00 UTC (permalink / raw)
To: martin rudalics; +Cc: Chong Yidong, emacs-devel
>> Maintaining separate prev-history and next-history lists is not very
>> Emacs-y. Why isn't this a ring?
>
> Because `window-previous-buffers' returns a list of <buffer window-start
> pos> triples where the latter two are markers and `window-next-buffers'
> a plain list of buffers. Maintaining markers is expensive, so I wanted
> to reduce the overhead for the next buffers part of the list.
This sounds like an overly optimization. But actually I can't find
a case where `next-buffer' would fail to get information about markers.
Is this because information about markers of next buffers is retrieved
from `window-prev-buffers'?
> > I do find the window-next-buffers stuff a bit weird, somehow,
> > but it's not important.
>
> A window's next buffers are only needed while navigating back- and
> forwards through that window's buffers. They are killed by
> `set-window-buffer' (more precisely by `record-window-buffer'). A
> window's previous buffers are persistent.
Isn't better to push a new window to the top of the list of next buffers
to not lose information about the rest of next buffers?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: window-next-buffers
2011-11-24 19:00 ` window-next-buffers Juri Linkov
@ 2011-11-25 10:15 ` martin rudalics
2011-11-25 10:33 ` window-next-buffers Juri Linkov
0 siblings, 1 reply; 13+ messages in thread
From: martin rudalics @ 2011-11-25 10:15 UTC (permalink / raw)
To: Juri Linkov; +Cc: Chong Yidong, emacs-devel
> This sounds like an overly optimization. But actually I can't find
> a case where `next-buffer' would fail to get information about markers.
> Is this because information about markers of next buffers is retrieved
> from `window-prev-buffers'?
Yes. In `switch-to-next-buffer'
(assq buffer (window-prev-buffers window))
provides this information. `window-next-buffers' is exclusively used
for buffer navigation within a window. `window-prev-buffers' is used in
other occasions like `quit-window' where I don't care about a window's
next buffers.
> Isn't better to push a new window to the top of the list of next buffers
> to not lose information about the rest of next buffers?
Can you elaborate what you mean here? A new window has neither previous
nor next buffers.
martin
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: window-next-buffers
2011-11-25 10:15 ` window-next-buffers martin rudalics
@ 2011-11-25 10:33 ` Juri Linkov
2011-11-25 13:55 ` window-next-buffers martin rudalics
2011-11-25 15:11 ` window-next-buffers Stephen J. Turnbull
0 siblings, 2 replies; 13+ messages in thread
From: Juri Linkov @ 2011-11-25 10:33 UTC (permalink / raw)
To: martin rudalics; +Cc: Chong Yidong, emacs-devel
>> This sounds like an overly optimization. But actually I can't find
>> a case where `next-buffer' would fail to get information about markers.
>> Is this because information about markers of next buffers is retrieved
>> from `window-prev-buffers'?
>
> Yes. In `switch-to-next-buffer'
>
> (assq buffer (window-prev-buffers window))
>
> provides this information. `window-next-buffers' is exclusively used
> for buffer navigation within a window. `window-prev-buffers' is used in
> other occasions like `quit-window' where I don't care about a window's
> next buffers.
IIUC this means that a set of next-buffers is a subset of prev-buffers.
>> Isn't better to push a new window to the top of the list of next buffers
>> to not lose information about the rest of next buffers?
>
> Can you elaborate what you mean here? A new window has neither previous
> nor next buffers.
Sorry, I meant "a new buffer" (displayed in the selected window
by `set-window-buffer').
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: window-next-buffers
2011-11-25 10:33 ` window-next-buffers Juri Linkov
@ 2011-11-25 13:55 ` martin rudalics
2011-11-25 15:11 ` window-next-buffers Stephen J. Turnbull
1 sibling, 0 replies; 13+ messages in thread
From: martin rudalics @ 2011-11-25 13:55 UTC (permalink / raw)
To: Juri Linkov; +Cc: Chong Yidong, emacs-devel
> IIUC this means that a set of next-buffers is a subset of prev-buffers.
Hopefully.
> Sorry, I meant "a new buffer" (displayed in the selected window
> by `set-window-buffer').
You mean that `set-window-buffer` should not throw away a window's next
buffers? Let's reconsider this when we encounter a real problem with
the present implementation.
martin
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: window-next-buffers
2011-11-25 10:33 ` window-next-buffers Juri Linkov
2011-11-25 13:55 ` window-next-buffers martin rudalics
@ 2011-11-25 15:11 ` Stephen J. Turnbull
2011-11-25 16:05 ` window-next-buffers Chong Yidong
1 sibling, 1 reply; 13+ messages in thread
From: Stephen J. Turnbull @ 2011-11-25 15:11 UTC (permalink / raw)
To: Juri Linkov; +Cc: martin rudalics, Chong Yidong, emacs-devel
Juri Linkov writes:
> IIUC this means that a set of next-buffers is a subset of
> prev-buffers.
Actually, I suspect it means that Yidong was right when he suggested a
ring. Butnevermind....
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: window-next-buffers
2011-11-25 15:11 ` window-next-buffers Stephen J. Turnbull
@ 2011-11-25 16:05 ` Chong Yidong
2011-11-25 19:02 ` window-next-buffers Juri Linkov
0 siblings, 1 reply; 13+ messages in thread
From: Chong Yidong @ 2011-11-25 16:05 UTC (permalink / raw)
To: Stephen J. Turnbull; +Cc: Juri Linkov, martin rudalics, emacs-devel
"Stephen J. Turnbull" <stephen@xemacs.org> writes:
> Juri Linkov writes:
>
> > IIUC this means that a set of next-buffers is a subset of
> > prev-buffers.
>
> Actually, I suspect it means that Yidong was right when he suggested a
> ring. Butnevermind....
No, I was wrong: a ring isn't a good fit for the design, in which
`switch-to-prev-buffer' (i) switches to the previous buffers displayed
in the buffer, and (ii) after successive `switch-to-prev-buffer's reach
the end of that list, the command moves on to other buffers in the
buffer list which the window hadn't visited before. If we used a ring,
we'd never hit the end, so we'd never move on to (ii).
But I think the next-buffers list should be considered an internal
detail (i.e. internal to the workings of next-buffer/previous-buffer),
and shouldn't be documented in the Lisp manual.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: window-next-buffers
2011-11-25 16:05 ` window-next-buffers Chong Yidong
@ 2011-11-25 19:02 ` Juri Linkov
2011-11-26 6:59 ` window-next-buffers Chong Yidong
2011-11-26 11:44 ` window-next-buffers martin rudalics
0 siblings, 2 replies; 13+ messages in thread
From: Juri Linkov @ 2011-11-25 19:02 UTC (permalink / raw)
To: Chong Yidong; +Cc: martin rudalics, Stephen J. Turnbull, emacs-devel
>> Actually, I suspect it means that Yidong was right when he suggested a
>> ring. Butnevermind....
>
> No, I was wrong: a ring isn't a good fit for the design, in which
> `switch-to-prev-buffer' (i) switches to the previous buffers displayed
> in the buffer, and (ii) after successive `switch-to-prev-buffer's reach
> the end of that list, the command moves on to other buffers in the
> buffer list which the window hadn't visited before. If we used a ring,
> we'd never hit the end, so we'd never move on to (ii).
Then we need just one list of buffers (visited in the window)
and the pointer referencing the currently displayed buffer
(or a numeric index of the position of the currently displayed
buffer in the list of visited buffers).
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: window-next-buffers
2011-11-25 19:02 ` window-next-buffers Juri Linkov
@ 2011-11-26 6:59 ` Chong Yidong
2011-11-26 11:44 ` window-next-buffers martin rudalics
1 sibling, 0 replies; 13+ messages in thread
From: Chong Yidong @ 2011-11-26 6:59 UTC (permalink / raw)
To: Juri Linkov; +Cc: martin rudalics, Stephen J. Turnbull, emacs-devel
Juri Linkov <juri@jurta.org> writes:
>> No, I was wrong: a ring isn't a good fit for the design, in which
>> `switch-to-prev-buffer' (i) switches to the previous buffers displayed
>> in the buffer, and (ii) after successive `switch-to-prev-buffer's reach
>> the end of that list, the command moves on to other buffers in the
>> buffer list which the window hadn't visited before. If we used a ring,
>> we'd never hit the end, so we'd never move on to (ii).
>
> Then we need just one list of buffers (visited in the window)
> and the pointer referencing the currently displayed buffer
> (or a numeric index of the position of the currently displayed
> buffer in the list of visited buffers).
Yes, that would be far simpler.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: window-next-buffers
2011-11-25 19:02 ` window-next-buffers Juri Linkov
2011-11-26 6:59 ` window-next-buffers Chong Yidong
@ 2011-11-26 11:44 ` martin rudalics
1 sibling, 0 replies; 13+ messages in thread
From: martin rudalics @ 2011-11-26 11:44 UTC (permalink / raw)
To: Juri Linkov; +Cc: Stephen J. Turnbull, Chong Yidong, emacs-devel
> Then we need just one list of buffers (visited in the window)
> and the pointer referencing the currently displayed buffer
> (or a numeric index of the position of the currently displayed
> buffer in the list of visited buffers).
A window's previous buffers are perused as follows:
(1) For navigating the buffers shown in a window. This calls
`switch-to-prev-buffer' with BURY-OR-KILL nil and preferably does
not show a buffer from the window's next buffers.
(2) For burying or killing the buffer shown in a window. This may call
`switch-to-prev-buffer' with BURY-OR-KILL non-nil and can show a
buffer from window's next buffers.
(3) For quitting a window. This works on the window's previous buffers
directly and can show a buffer from window's next buffers.
So any optimization for (1) must make sure that operations (2) and (3)
are not harmed. In addition you will have to do the proper action for
`set-window-buffer'.
And the most annoying problem, namely that a buffer on one of these
lists gets killed while I can't access these lists because they are
hidden by a window excursion, must be handled too (maybe directly in
`set-window-configuration').
martin
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2011-11-26 11:44 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-24 7:58 window-next-buffers Chong Yidong
2011-11-24 9:24 ` window-next-buffers Chong Yidong
2011-11-24 10:07 ` window-next-buffers martin rudalics
2011-11-24 9:59 ` window-next-buffers martin rudalics
2011-11-24 19:00 ` window-next-buffers Juri Linkov
2011-11-25 10:15 ` window-next-buffers martin rudalics
2011-11-25 10:33 ` window-next-buffers Juri Linkov
2011-11-25 13:55 ` window-next-buffers martin rudalics
2011-11-25 15:11 ` window-next-buffers Stephen J. Turnbull
2011-11-25 16:05 ` window-next-buffers Chong Yidong
2011-11-25 19:02 ` window-next-buffers Juri Linkov
2011-11-26 6:59 ` window-next-buffers Chong Yidong
2011-11-26 11:44 ` window-next-buffers martin rudalics
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.