Subject: bug#15382: desktop restores buffers in wrong order

From: Juri Linkov <[email-masked]>
Date: Tue, 17 Dec 2013 21:58:09 +0200

> I do not see why do you think that it is intended only for the
> multi-frame case. Restoring framesets is not intended just for
> multi-frame setups, I use it all the time in my single-frame setup.

I don't understand this condition:

  (unless (desktop-restoring-frameset-p)

Why buffers should be restored in right order only when
restoring a single-frame (without restoring a frameset)
but not when restoring a single-frame from a frameset?
I think restoring the original order is needed in both cases.

> Correctly restoring the frames requires restoring the window-buffer
> correspondence, so if you run the (mapc #'bury-buffer ...) code
> afterwards, you destroy that correspondence. A way would be required
> to reset buffer-list's without affecting how buffers are displayed...

Maybe buffers should be saved in the desktop in reverse order?
This will restore the original order of the global buffer list.

And frame-local and window-local buffer lists needs to be saved too.