[Top][All Lists]

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

Re: session management with desktop and window configuration

From: martin rudalics
Subject: Re: session management with desktop and window configuration
Date: Thu, 31 Dec 2009 12:31:55 +0100
User-agent: Thunderbird (Windows/20090302)

> I'm now using desktop.el for managing sessions. When I do desktop-
> read, it restore all files opened before well. Then, I'm wondering if
> there is any way to restore window configuration as well in easy way.
> Firstly, I tried to add some functions to the desktop hooks as
> follows:
>   (add-hook 'desktop-save-hook '(window-configuration-to-register ?0))
>   (add-hook 'desktop-after-read-hook '(jump-to-register ?0))
> However, it didn't work at all.
> The register-base window configuration save/restore are perfect to
> what I want. But I don't know how to integrate it with desktop. Please
> give me help.

You can't do this with desktop at the moment.  The basic problem is that
we currently cannot read window configurations from a file - a window
configuration can only be saved in memory and retrieved from there.
This obviously means that when you exit Emacs your saved window
configurations are lost forever.  In this context note also that you
can't cleanly restore a window configuration in one and the same session
if you have deleted its frame in the meantime.

Basically you should be able to write a configuration to a file as a
sequence of `split-window' functions (and some interspersed window
resizings) and execute these commands when you restart Emacs.  But you
might end up getting only an approximation of the earlier configuration
partly due to the quite unpredictable behavior of the current window
resizing code which can, for example, deliberately delete windows when
they become too small.

I'm currently contemplating functions that write window configurations
to a file and read them from there.  This way I can circumvent the
window splitting mechanism and directly construct a window-tree from the
information on the file.  This should solve the problem for you.

Meanwhile you could try out ECB which does something similar to what you


reply via email to

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