pashinin / workgroups2

Workgroups2 - Emacs session manager
http://workgroups2.rtfd.org/
GNU General Public License v3.0
297 stars 43 forks source link

window-prev-buffers bleeds across workgroups #84

Open ivanbrennan opened 7 years ago

ivanbrennan commented 7 years ago

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.