emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to restore the layout?


From: Juri Linkov
Subject: Re: How to restore the layout?
Date: Tue, 25 Jun 2013 09:03:49 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)

>> Please increment the version number of the desktop file in
>> `desktop-file-version' because the new format will be backward
>> incompatible with the old one.
>
> Why? The window configuration is saved as a global variable. An old
> desktop.el would load it, but do nothing with it...

It's very good that your approach is backward compatible and
doesn't require changing the format of the desktop file.

>>  What do you think about also
>> merging it with the patch from Jérémy Compostella at
>> http://lists.gnu.org/archive/html/emacs-devel/2012-01/msg00600.html
>> that additionally saves the frame parameters as well.
>
> Yes, saving frame parameters is one of the things missing in my sample
> code. I haven't looked at Jérémy Compostella's patch, but if it
> already saves the frames, why merge both patches? What is lacking in
> his?

The difference is in the format.  His patch changes the format of
the desktop file that logically fits better to the design of desktop.el.
Like the existing function calls `desktop-create-buffer' in the desktop
file, it adds similar function calls `desktop-restore-frame':

  (desktop-restore-frame t   '(frame1-params...) '(window-tree1...))
  (desktop-restore-frame nil '(frame2-params...) '(window-tree2...))
  (desktop-restore-frame nil '(frame3-params...) '(window-tree3...))

The disadvantage is that loading the new format in older Emacs
versions where `desktop-restore-frame' is undefined will fail.
Perhaps it could use something like

  (when (fboundp 'desktop-restore-frame)
    (desktop-restore-frame t   '(frame1-params...) '(window-tree1...))
    (desktop-restore-frame nil '(frame2-params...) '(window-tree2...))
    (desktop-restore-frame nil '(frame3-params...) '(window-tree3...)))

but isn't this too ugly?

OTOH, your patch has the advantage of backward compatibility in that
it uses `setq' to a new variable, and older Emacs versions will just
ignore this setting.

So the main question to decide is what format to use.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]