GNU bug report logs -
#15382
desktop restores buffers in wrong order
Previous Next
To reply to this bug, email your comments to 15382 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15382
; Package
emacs
.
(Sun, 15 Sep 2013 09:29:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> jurta.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 15 Sep 2013 09:29:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
The wrong order of restored desktop buffers is caused
by addition of these two conditions in `desktop-read':
(unless (desktop-restoring-frameset-p)
Removing this condition in two places in `desktop-read'
restores the right order.
Were these conditions intended to fix some problems?
Another bug is that point of the top restored buffer
is placed to a wrong position because `desktop-saved-frameset'
saves point of one buffer (possibly non-persistent), but
after restoring the desktop, `window-state-put' restores that point
to another buffer (persistent and restored from the desktop file),
thus applying the value of point of one buffer to another buffer.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15382
; Package
emacs
.
(Sun, 15 Sep 2013 16:11:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 15382 <at> debbugs.gnu.org (full text, mbox):
> Another bug is that point of the top restored buffer
> is placed to a wrong position because `desktop-saved-frameset'
> saves point of one buffer (possibly non-persistent), but
> after restoring the desktop, `window-state-put' restores that point
> to another buffer (persistent and restored from the desktop file),
> thus applying the value of point of one buffer to another buffer.
IIUC this can happen only if a buffer doesn't exist when restoring. I
tried to address this issue in revision#114294. Please have a look.
martin
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15382
; Package
emacs
.
(Mon, 16 Sep 2013 21:37:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 15382 <at> debbugs.gnu.org (full text, mbox):
>> Another bug is that point of the top restored buffer
>> is placed to a wrong position because `desktop-saved-frameset'
>> saves point of one buffer (possibly non-persistent), but
>> after restoring the desktop, `window-state-put' restores that point
>> to another buffer (persistent and restored from the desktop file),
>> thus applying the value of point of one buffer to another buffer.
>
> IIUC this can happen only if a buffer doesn't exist when restoring. I
> tried to address this issue in revision#114294. Please have a look.
Thanks, I verified that now it doesn't restore point in wrong buffer
from a non-existent buffer.
A question whether such non-existent buffers should be also
saved/restored is a separate question. Maybe they should,
with some empty placeholder buffers if buffer content
can't be restored?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15382
; Package
emacs
.
(Tue, 17 Sep 2013 06:47:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 15382 <at> debbugs.gnu.org (full text, mbox):
> A question whether such non-existent buffers should be also
> saved/restored is a separate question. Maybe they should,
> with some empty placeholder buffers if buffer content
> can't be restored?
That's how it behaved initially using `get-buffer-create' IIRC. But
then people complained ...
martin
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15382
; Package
emacs
.
(Sun, 15 Dec 2013 21:53:03 GMT)
Full text and
rfc822 format available.
Message #17 received at 15382 <at> debbugs.gnu.org (full text, mbox):
> The wrong order of restored desktop buffers is caused
> by addition of these two conditions in `desktop-read':
>
> (unless (desktop-restoring-frameset-p)
>
> Removing this condition in two places in `desktop-read'
> restores the right order.
>
> Were these conditions intended to fix some problems?
It seems these conditions were intended only for multi-frame case.
So they should be removed in single-frame case. Then in multi-frame
case the right thing to do would be to save and restore the frame
parameters `buffer-list' and `buried-buffer-list' for every frame.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15382
; Package
emacs
.
(Sun, 15 Dec 2013 21:59:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 15382 <at> debbugs.gnu.org (full text, mbox):
On Sun, Dec 15, 2013 at 10:44 PM, Juri Linkov <juri <at> jurta.org> wrote:
>> (unless (desktop-restoring-frameset-p)
> It seems these conditions were intended only for multi-frame case.
Why do you think so?
J
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15382
; Package
emacs
.
(Mon, 16 Dec 2013 21:07:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 15382 <at> debbugs.gnu.org (full text, mbox):
>>> (unless (desktop-restoring-frameset-p)
>
>> It seems these conditions were intended only for multi-frame case.
>
> Why do you think so?
Because I see no other explanation. This was added by your revno:113483
2013-07-21 Juanma Barranquero <lekktu <at> gmail.com>
* desktop.el (desktop-saved-frame-states):
...
(desktop-read): Use desktop-restoring-frames-p. Do not try to fix
buffer-lists when restoring frames. Suggested by Martin Rudalics.
Maybe Martin knows the purpose of not fixing buffer-lists in desktop-read?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15382
; Package
emacs
.
(Tue, 17 Dec 2013 16:09:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 15382 <at> debbugs.gnu.org (full text, mbox):
On Mon, Dec 16, 2013 at 10:05 PM, Juri Linkov <juri <at> jurta.org> wrote:
> Because I see no other explanation. This was added by your revno:113483
>
> 2013-07-21 Juanma Barranquero <lekktu <at> gmail.com>
>
> * desktop.el (desktop-saved-frame-states):
> ...
> (desktop-read): Use desktop-restoring-frames-p. Do not try to fix
> buffer-lists when restoring frames. Suggested by Martin Rudalics.
I understand why my change is related to not restoring the buffer list
order. 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.
> Maybe Martin knows the purpose of not fixing buffer-lists in desktop-read?
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...
J
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15382
; Package
emacs
.
(Tue, 17 Dec 2013 17:32:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 15382 <at> debbugs.gnu.org (full text, mbox):
> (desktop-read): Use desktop-restoring-frames-p. Do not try to fix
> buffer-lists when restoring frames. Suggested by Martin Rudalics.
>
> Maybe Martin knows the purpose of not fixing buffer-lists in desktop-read?
I forgot. Probably because we have no interface to set these lists
manually. Replaying the order in which buffers were displayed looks
quite tedious.
martin
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15382
; Package
emacs
.
(Tue, 17 Dec 2013 17:32:02 GMT)
Full text and
rfc822 format available.
Message #32 received at 15382 <at> debbugs.gnu.org (full text, mbox):
> 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...
We would have to show and bury buffers to get the appropriate order for
frames. However, with multiple frames this might clobber the order of
the global buffer list. `set-window-prev-buffers' and
`set-window-next-buffers' should suffice to fix the window buffer lists
afterwards. In any case, this doesn't sound like a trivial task.
martin
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15382
; Package
emacs
.
(Tue, 17 Dec 2013 20:00:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 15382 <at> debbugs.gnu.org (full text, mbox):
> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15382
; Package
emacs
.
(Tue, 17 Dec 2013 21:02:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 15382 <at> debbugs.gnu.org (full text, mbox):
On Tue, Dec 17, 2013 at 8:58 PM, Juri Linkov <juri <at> jurta.org> wrote:
> (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?
When desktop-restoring-frameset-p is nil you're not really "restoring
a single frame", because nothing about the frame (dimensions,
position, minibufferless state, window tree) is restored. You're
creating a new frame and restoring the buffers. In that case, the
window/buffer correspondence is not maintained so you can do whatever
you want with the buffer list order.
> Maybe buffers should be saved in the desktop in reverse order?
> This will restore the original order of the global buffer list.
You could try it with and without desktop-restore-frames and report back.
> And frame-local and window-local buffer lists needs to be saved too.
IIUC Martin's last comment, that's far from trivial.
J
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15382
; Package
emacs
.
(Wed, 05 Feb 2014 08:14:02 GMT)
Full text and
rfc822 format available.
Message #41 received at 15382 <at> debbugs.gnu.org (full text, mbox):
>> Maybe buffers should be saved in the desktop in reverse order?
>> This will restore the original order of the global buffer list.
>
> You could try it with and without desktop-restore-frames and report back.
I tried to replace
(dolist (l (mapcar 'desktop-buffer-info (buffer-list)))
with
(dolist (l (mapcar 'desktop-buffer-info (nreverse (buffer-list))))
but it breaks the desktop saving by inserting the desktop file
to the current buffer. Then I tried to replace it with
(dolist (l (nreverse (mapcar 'desktop-buffer-info (buffer-list))))
and it saves the desktop in the natural order that could be replayed back
when restoring the desktop to get the buffer list in the same order.
But more code prevents from restoring in the same order, e.g.
;; Restore buffer list order with new buffer at end. Don't change
;; the order for old desktop files (old desktop module behavior).
(unless (< desktop-file-version 206)
(mapc 'bury-buffer buffer-list)
(when result (bury-buffer result)))
I'm afraid that changing the order of buffers in the desktop file
might require incrementing the version number in desktop-file-version.
Forcibly Merged 15382 23630.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Wed, 24 Aug 2016 19:34:02 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 293 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.