From: Lennart Borgman <lennart.borgman@gmail.com>
To: Kiwon Um <um.kiwon@gmail.com>
Cc: martin rudalics <rudalics@gmx.at>, help-gnu-emacs@gnu.org
Subject: Re: session management with desktop and window configuration
Date: Thu, 31 Dec 2009 14:33:09 +0100 [thread overview]
Message-ID: <e01d8a50912310533i9b8a797o221a94ccc9dff8a3@mail.gmail.com> (raw)
In-Reply-To: <m3zl4zth2a.fsf@gmail.com>
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?)
next prev parent reply other threads:[~2009-12-31 13:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-31 11:31 session management with desktop and window configuration martin rudalics
2009-12-31 13:21 ` Kiwon Um
2009-12-31 13:33 ` Lennart Borgman [this message]
2009-12-31 16:16 ` Richard Riley
2009-12-31 16:22 ` Lennart Borgman
2009-12-31 16:32 ` Richard Riley
2009-12-31 17:33 ` Vicente Hernando Ara
2010-01-01 1:25 ` Lennart Borgman
2009-12-31 17:32 ` martin rudalics
2010-01-01 1:27 ` Lennart Borgman
2010-01-01 14:55 ` martin rudalics
2010-01-01 15:04 ` Lennart Borgman
2010-01-01 15:18 ` martin rudalics
2009-12-31 17:31 ` martin rudalics
2010-01-01 1:29 ` Lennart Borgman
[not found] <mailman.476.1262259127.18930.help-gnu-emacs@gnu.org>
2010-01-07 0:48 ` David Combs
-- strict thread matches above, loose matches on Subject: below --
2009-12-31 10:08 Kiwon Um
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e01d8a50912310533i9b8a797o221a94ccc9dff8a3@mail.gmail.com \
--to=lennart.borgman@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=rudalics@gmx.at \
--cc=um.kiwon@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).