* session management with desktop and window configuration
@ 2009-12-31 10:08 Kiwon Um
0 siblings, 0 replies; 17+ messages in thread
From: Kiwon Um @ 2009-12-31 10:08 UTC (permalink / raw)
To: help-gnu-emacs
Dear Emacs users:
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.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: session management with desktop and window configuration
@ 2009-12-31 11:31 martin rudalics
2009-12-31 13:21 ` Kiwon Um
0 siblings, 1 reply; 17+ messages in thread
From: martin rudalics @ 2009-12-31 11:31 UTC (permalink / raw)
To: um.kiwon; +Cc: help-gnu-emacs
> 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
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: session management with desktop and window configuration
2009-12-31 11:31 martin rudalics
@ 2009-12-31 13:21 ` Kiwon Um
2009-12-31 13:33 ` Lennart Borgman
2009-12-31 17:31 ` martin rudalics
0 siblings, 2 replies; 17+ messages in thread
From: Kiwon Um @ 2009-12-31 13:21 UTC (permalink / raw)
To: martin rudalics; +Cc: help-gnu-emacs
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. :)
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: session management with desktop and window configuration
2009-12-31 13:21 ` Kiwon Um
@ 2009-12-31 13:33 ` Lennart Borgman
2009-12-31 16:16 ` Richard Riley
2009-12-31 17:32 ` martin rudalics
2009-12-31 17:31 ` martin rudalics
1 sibling, 2 replies; 17+ messages in thread
From: Lennart Borgman @ 2009-12-31 13:33 UTC (permalink / raw)
To: Kiwon Um; +Cc: martin rudalics, help-gnu-emacs
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?)
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: session management with desktop and window configuration
2009-12-31 13:33 ` Lennart Borgman
@ 2009-12-31 16:16 ` Richard Riley
2009-12-31 16:22 ` Lennart Borgman
2009-12-31 17:32 ` martin rudalics
1 sibling, 1 reply; 17+ messages in thread
From: Richard Riley @ 2009-12-31 16:16 UTC (permalink / raw)
To: help-gnu-emacs
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.
--
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: session management with desktop and window configuration
2009-12-31 16:16 ` Richard Riley
@ 2009-12-31 16:22 ` Lennart Borgman
2009-12-31 16:32 ` Richard Riley
0 siblings, 1 reply; 17+ messages in thread
From: Lennart Borgman @ 2009-12-31 16:22 UTC (permalink / raw)
To: Richard Riley; +Cc: help-gnu-emacs
On Thu, Dec 31, 2009 at 5:16 PM, Richard Riley <rileyrgdev@gmail.com> wrote:
> Lennart Borgman <lennart.borgman@gmail.com> writes:
>
>>>
>>> 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.
What is windows.el, where can we find it?
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: session management with desktop and window configuration
2009-12-31 16:22 ` Lennart Borgman
@ 2009-12-31 16:32 ` Richard Riley
2009-12-31 17:33 ` Vicente Hernando Ara
0 siblings, 1 reply; 17+ messages in thread
From: Richard Riley @ 2009-12-31 16:32 UTC (permalink / raw)
To: Lennart Borgman; +Cc: Richard Riley, help-gnu-emacs
Lennart Borgman <lennart.borgman@gmail.com> writes:
> On Thu, Dec 31, 2009 at 5:16 PM, Richard Riley <rileyrgdev@gmail.com> wrote:
>> Lennart Borgman <lennart.borgman@gmail.com> writes:
>>
>>>>
>>>> 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.
>
> What is windows.el, where can we find it?
>
I googled it up when looking for a way to save window layout.
http://linux.about.com/cs/linux101/g/windows-el.htm
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: session management with desktop and window configuration
2009-12-31 13:21 ` Kiwon Um
2009-12-31 13:33 ` Lennart Borgman
@ 2009-12-31 17:31 ` martin rudalics
2010-01-01 1:29 ` Lennart Borgman
1 sibling, 1 reply; 17+ messages in thread
From: martin rudalics @ 2009-12-31 17:31 UTC (permalink / raw)
To: Kiwon Um; +Cc: help-gnu-emacs
> Thanks for your reply. So, I wrote some functions using revive.el:
[...]
> It seems to be enough to what I wanted. :)
When you encounter problems you can try Lennart's winsav.el which IIRC
is based on window-trees and doesn't have to make guesses from window
edges as revive.el. ECB records the entire story of window-splits in
order to reconstruct the window-tree which is not reasonable either.
martin
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: session management with desktop and window configuration
2009-12-31 13:33 ` Lennart Borgman
2009-12-31 16:16 ` Richard Riley
@ 2009-12-31 17:32 ` martin rudalics
2010-01-01 1:27 ` Lennart Borgman
1 sibling, 1 reply; 17+ messages in thread
From: martin rudalics @ 2009-12-31 17:32 UTC (permalink / raw)
To: Lennart Borgman; +Cc: help-gnu-emacs, Kiwon Um
> 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?)
I think winsave.el should do better than revive.el because it works on
the window-tree. But winsave.el is still based on splitting and
resizing which IMHO are liable to fail (otherwise there wouldn't be any
need for the `condition-case' in `bw-adjust-window'). And I dislike the
idea of calling `adjust-window-trailing-edge' repeatedly (every call of
this function means to allocate an entire window configuration).
martin
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: session management with desktop and window configuration
2009-12-31 16:32 ` Richard Riley
@ 2009-12-31 17:33 ` Vicente Hernando Ara
2010-01-01 1:25 ` Lennart Borgman
0 siblings, 1 reply; 17+ messages in thread
From: Vicente Hernando Ara @ 2009-12-31 17:33 UTC (permalink / raw)
To: Richard Riley; +Cc: Richard Riley, help-gnu-emacs
Hi,
may be I should start another thread but,
is it possible to save and restore not only windows but also processes
they were attached to? e.g: w3m or shell
On 31/12/2009, Richard Riley <rileyrgdev@googlemail.com> wrote:
> Lennart Borgman <lennart.borgman@gmail.com> writes:
>
>> On Thu, Dec 31, 2009 at 5:16 PM, Richard Riley <rileyrgdev@gmail.com>
>> wrote:
>>> Lennart Borgman <lennart.borgman@gmail.com> writes:
>>>
>>>>>
>>>>> 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.
>>
>> What is windows.el, where can we find it?
>>
>
> I googled it up when looking for a way to save window layout.
>
> http://linux.about.com/cs/linux101/g/windows-el.htm
>
>
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: session management with desktop and window configuration
2009-12-31 17:33 ` Vicente Hernando Ara
@ 2010-01-01 1:25 ` Lennart Borgman
0 siblings, 0 replies; 17+ messages in thread
From: Lennart Borgman @ 2010-01-01 1:25 UTC (permalink / raw)
To: Vicente Hernando Ara; +Cc: Richard Riley, help-gnu-emacs, Richard Riley
On Thu, Dec 31, 2009 at 6:33 PM, Vicente Hernando Ara
<bizenton@gmail.com> wrote:
> Hi,
>
> may be I should start another thread but,
>
> is it possible to save and restore not only windows but also processes
> they were attached to? e.g: w3m or shell
That is a job for desktop.el. At the moment I do not remember how
flexible it is, but if it is not it should be.
(winsav.el (and I guess the other variants too) remember which buffer
was shown in which window + buffer pos in window. But it is a job for
desktop to restore the buffers. winsav just binds them to the
windows.)
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: session management with desktop and window configuration
2009-12-31 17:32 ` martin rudalics
@ 2010-01-01 1:27 ` Lennart Borgman
2010-01-01 14:55 ` martin rudalics
0 siblings, 1 reply; 17+ messages in thread
From: Lennart Borgman @ 2010-01-01 1:27 UTC (permalink / raw)
To: martin rudalics; +Cc: help-gnu-emacs, Kiwon Um
On Thu, Dec 31, 2009 at 6:32 PM, martin rudalics <rudalics@gmx.at> wrote:
>> 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?)
>
> I think winsave.el should do better than revive.el because it works on
> the window-tree. But winsave.el is still based on splitting and
> resizing which IMHO are liable to fail (otherwise there wouldn't be any
> need for the `condition-case' in `bw-adjust-window'). And I dislike the
> idea of calling `adjust-window-trailing-edge' repeatedly (every call of
> this function means to allocate an entire window configuration).
Strange things happens during resizing. But as you know I wanted to
rewrite it. Sorry for not coming back to you about this. nXhtml did
take much longer time than I expected. (And there is still fundamental
problems. Some low level changes in Emacs are definitively needed IMO.
But it is a hard decision.)
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: session management with desktop and window configuration
2009-12-31 17:31 ` martin rudalics
@ 2010-01-01 1:29 ` Lennart Borgman
0 siblings, 0 replies; 17+ messages in thread
From: Lennart Borgman @ 2010-01-01 1:29 UTC (permalink / raw)
To: martin rudalics; +Cc: help-gnu-emacs, Kiwon Um
On Thu, Dec 31, 2009 at 6:31 PM, martin rudalics <rudalics@gmx.at> wrote:
>> Thanks for your reply. So, I wrote some functions using revive.el:
> [...]
>> It seems to be enough to what I wanted. :)
>
> When you encounter problems you can try Lennart's winsav.el which IIRC
> is based on window-trees and doesn't have to make guesses from window
> edges as revive.el. ECB records the entire story of window-splits in
> order to reconstruct the window-tree which is not reasonable either.
I have taken some care to support ECB in winsav.el.
That said I think the different versions should be merged. But it is a
quite difficult job. If someone is interested in doing it please try
to find the discussions between Martin and me about this. There are
some good points to start from.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: session management with desktop and window configuration
2010-01-01 1:27 ` Lennart Borgman
@ 2010-01-01 14:55 ` martin rudalics
2010-01-01 15:04 ` Lennart Borgman
0 siblings, 1 reply; 17+ messages in thread
From: martin rudalics @ 2010-01-01 14:55 UTC (permalink / raw)
To: Lennart Borgman; +Cc: help-gnu-emacs, Kiwon Um
> Strange things happens during resizing.
The inherent problem of resizing is that you can't specify _which_ other
windows may be affected when resizing a particular window. So you end
up doing what your and Stefan's balancing routines do: Adjusting the
size of one window may break the size of another one and ou have to go
on until the configuration converges to (a possibly suboptimal) one
which can't be improved by the algorithm.
> But as you know I wanted to
> rewrite it. Sorry for not coming back to you about this. nXhtml did
> take much longer time than I expected. (And there is still fundamental
> problems. Some low level changes in Emacs are definitively needed IMO.
> But it is a hard decision.)
My current code allows to specify the sizes of windows directly. It
only checks whether the sizes fit - if they do it applies them (in one
direction only though - so for resizing horizontally and vertically you
have to run the code twice). What I don't know yet is whether we should
keep the splitting concept of winsave.el. IIRC it's a bit tedious since
you have to make sure that the window you want to split is large enough.
OTOH writing some extra code to construct a window tree from a saved
description is not very funny either (especially because I would have to
write it in C.)
martin
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: session management with desktop and window configuration
2010-01-01 14:55 ` martin rudalics
@ 2010-01-01 15:04 ` Lennart Borgman
2010-01-01 15:18 ` martin rudalics
0 siblings, 1 reply; 17+ messages in thread
From: Lennart Borgman @ 2010-01-01 15:04 UTC (permalink / raw)
To: martin rudalics; +Cc: help-gnu-emacs, Kiwon Um
On Fri, Jan 1, 2010 at 3:55 PM, martin rudalics <rudalics@gmx.at> wrote:
>> Strange things happens during resizing.
>
> The inherent problem of resizing is that you can't specify _which_ other
> windows may be affected when resizing a particular window. So you end
> up doing what your and Stefan's balancing routines do: Adjusting the
> size of one window may break the size of another one and ou have to go
> on until the configuration converges to (a possibly suboptimal) one
> which can't be improved by the algorithm.
>
> My current code allows to specify the sizes of windows directly. It
> only checks whether the sizes fit - if they do it applies them
Is there an elisp function to access it?
> (in one
> direction only though - so for resizing horizontally and vertically you
> have to run the code twice).
Don't you have to run it once for every node in the window tree?
> What I don't know yet is whether we should
> keep the splitting concept of winsave.el. IIRC it's a bit tedious since
> you have to make sure that the window you want to split is large enough.
> OTOH writing some extra code to construct a window tree from a saved
> description is not very funny either (especially because I would have to
> write it in C.)
>
> martin
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: session management with desktop and window configuration
2010-01-01 15:04 ` Lennart Borgman
@ 2010-01-01 15:18 ` martin rudalics
0 siblings, 0 replies; 17+ messages in thread
From: martin rudalics @ 2010-01-01 15:18 UTC (permalink / raw)
To: Lennart Borgman; +Cc: help-gnu-emacs
>> My current code allows to specify the sizes of windows directly. It
>> only checks whether the sizes fit - if they do it applies them
>
> Is there an elisp function to access it?
Sure. I currently do practically all resizing in Elisp.
>> (in one
>> direction only though - so for resizing horizontally and vertically you
>> have to run the code twice).
>
> Don't you have to run it once for every node in the window tree?
I have a simple C routine which traverses the window tree and checks
whether the proposed new sizes fit together and don't violate the
absolute minimum sizes. If the test succeeds, I set the real sizes to
the proposed ones and assign the new top lines (or left columns).
Otherwise the resize operation fails.
martin
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: session management with desktop and window configuration
[not found] <mailman.476.1262259127.18930.help-gnu-emacs@gnu.org>
@ 2010-01-07 0:48 ` David Combs
0 siblings, 0 replies; 17+ messages in thread
From: David Combs @ 2010-01-07 0:48 UTC (permalink / raw)
To: help-gnu-emacs
In article <mailman.476.1262259127.18930.help-gnu-emacs@gnu.org>,
martin rudalics <rudalics@gmx.at> wrote:
> > 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
For the short term, and if you can create your window-config without
too much fingerwork-hair, maybe C-x { and start building it, and
when done assign it into a register (as above), then via list-kbd-macro
and edit-kbd-macro save them in a file?
And if you screw up building the physical screen config, I suppose you
can just undo your mistake and fix it, still while in the C-x ( --
or, maybe if bold, use edit-kbd-macro and EDIT it?
Pretty easy to wrap a defun around it, the list-kbd-macro?
This have any chance of being a quick super-kludgy work-around?
Thanks!
David
PS: Note -- I have NOT read the rest of the thread yet, to see
likely far cooler ways.
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2010-01-07 0:48 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-31 10:08 session management with desktop and window configuration Kiwon Um
-- strict thread matches above, loose matches on Subject: below --
2009-12-31 11:31 martin rudalics
2009-12-31 13:21 ` Kiwon Um
2009-12-31 13:33 ` Lennart Borgman
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
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).