workgroups2 icon indicating copy to clipboard operation
workgroups2 copied to clipboard

window-prev-buffers bleeds across workgroups

Open ivanbrennan opened this issue 7 years ago • 0 comments

I commonly toggle back and forth between two buffers in a single window, using

(switch-to-buffer (caar (window-prev-buffers)))

(I use evil-switch-to-windows-last-buffer, which mostly boils down to the above expression.)

I had hoped that switching buffers wouldn't affect which buffer was considered the "previous buffer" for any window outside of the current workgroup, but that's not the case.

For example, in workgroup-A I have a single window in which I toggle between buf-1 and buf-2:

(wg-switch-to-workgroup "workgroup-A")
(find-file "~/buf-1")
(find-file "~/buf-2")
(switch-to-buffer (caar (window-prev-buffers)))

Now I switch to workgroup-B and toggle between buf-3 and buf-4:

(wg-switch-to-workgroup "workgroup-B")
(find-file "~/buf-3")
(find-file "~/buf-4")
(switch-to-buffer (caar (window-prev-buffers)))

Upon returning to workgroup-A, which currently displays buf-1, I was expecting

(switch-to-buffer (caar (window-prev-buffers)))

to toggle to buf-2, but it instead toggles to buf-3. Since both workgroups are using the same window object, the list of previous buffers for that window is shared between them.

ivanbrennan avatar May 20 '17 22:05 ivanbrennan