alphapapa / activities.el

Activities for Emacs (suspend and resume activities, i.e. frames/tabs and their windows, buffers)
GNU General Public License v3.0
188 stars 12 forks source link

Don't change tabs' last-used order when saving activities #92

Open manphiz opened 3 months ago

manphiz commented 3 months ago

Emacs version: 29.3 Activities version: 0.7

When emacs tabs are managed by activities, the last visited tab may change to some other activities managed tab, which I supposed may be due to activities autosaving during which tabs are visited and hence changed the visit history.

For example, I have 3 tabs managed by activities, and I visit tab 1 and then tab 3, and then I try to switch back to tab 1 using C-x t RET (tab-switch). If I do it quickly enough, the default tab-name would be tab 1 when I do C-x t RET interactively. But when I spend a little longer in tab 3 and then try to switch, the default tab-name may become tab 2.

I suppose this is because activities will save the states of each managed tab periodically, during which each tab would be visited and hence the tab history would be changed accordingly. Please do correct me if I'm wrong.

I guess this issue lies somewhere between a bug and a feature request. I understand that tab visit history management may not be trivial in Emacs. Still It would be great if at least last visited tab can stay unchanged so that I can type C-x t RET to switch between the last 2 visited tabs quickly.

alphapapa commented 3 months ago

Thanks for filing this. I've noticed something like this behavior myself, where C-x t RET RET doesn't switch to the tab I expected, but I hadn't been able to figure out why. This is likely the problem.

I'm not sure of the best way to fix it. Maybe there's a way to prevent switching tabs from affecting the list of recently used tabs (or their order in...whatever internal variable is relevant). It might require a patch to Emacs itself to permit that; some investigation is needed.

I don't expect to have time to work on this soon, so if anyone else would like to work on this, feel free. Thanks.