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:
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.
I commonly toggle back and forth between two buffers in a single window, using
(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:
Now I switch to workgroup-B and toggle between buf-3 and buf-4:
Upon returning to workgroup-A, which currently displays buf-1, I was expecting
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.