[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: session management with desktop and window configuration
From: |
Richard Riley |
Subject: |
Re: session management with desktop and window configuration |
Date: |
Thu, 31 Dec 2009 17:16:44 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Lennart Borgman <lennart.borgman@gmail.com> writes:
> On Thu, Dec 31, 2009 at 2:21 PM, Kiwon Um <um.kiwon@gmail.com> wrote:
>> martin rudalics <rudalics@gmx.at> writes:
>>
>>>> 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
>>> want.
>>>
>>> martin
>>
>> Thanks for your reply. So, I wrote some functions using revive.el:
>>
>> (require 'revive)
>> (defun kiwon/save-window-configuration ()
>> (write-region (concat "(restore-window-configuration '"
>> (prin1-to-string
>> (current-window-configuration-printable))
>> ")")
>> nil ".emacs.restore-window.el"))
>> (defun kiwon/restore-window-configuration ()
>> (when (file-exists-p ".emacs.restore-window.el")
>> (load-file ".emacs.restore-window.el")))
>>
>> (add-hook 'desktop-save-hook 'kiwon/save-window-configuration)
>> (add-hook 'desktop-after-read-hook 'kiwon/restore-window-configuration)
>>
>> It seems to be enough to what I wanted. :)
>
> Nice. I have seen revive but have not looked into it. There is also
> winsav.el in nXhtml that can save and restore frames and windows.
> (Martin, I am a bit surprised that you do not know about it. Didn't I
> tell about this before?)
>
windows.el does for me.
--
- session management with desktop and window configuration, Kiwon Um, 2009/12/31
- Re: session management with desktop and window configuration, martin rudalics, 2009/12/31
- Re: session management with desktop and window configuration, Kiwon Um, 2009/12/31
- Re: session management with desktop and window configuration, Lennart Borgman, 2009/12/31
- Re: session management with desktop and window configuration,
Richard Riley <=
- Re: session management with desktop and window configuration, Lennart Borgman, 2009/12/31
- Re: session management with desktop and window configuration, Richard Riley, 2009/12/31
- Re: session management with desktop and window configuration, Vicente Hernando Ara, 2009/12/31
- Re: session management with desktop and window configuration, Lennart Borgman, 2009/12/31
- Re: session management with desktop and window configuration, martin rudalics, 2009/12/31
- Re: session management with desktop and window configuration, Lennart Borgman, 2009/12/31
- Re: session management with desktop and window configuration, martin rudalics, 2009/12/31
- Re: session management with desktop and window configuration, Lennart Borgman, 2009/12/31