From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Riley Newsgroups: gmane.emacs.help Subject: Re: session management with desktop and window configuration Date: Thu, 31 Dec 2009 17:16:44 +0100 Organization: aich tea tea pea dicky riley dot net Message-ID: References: <4B3C8BAB.7000607@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1262276275 15180 80.91.229.12 (31 Dec 2009 16:17:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Dec 2009 16:17:55 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 31 17:17:48 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NQNib-0002kK-Cf for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Dec 2009 17:17:45 +0100 Original-Received: from localhost ([127.0.0.1]:45470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQNib-0003yo-Qq for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Dec 2009 11:17:45 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NQNiG-0003yg-Cc for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 11:17:24 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NQNiB-0003y6-R3 for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 11:17:24 -0500 Original-Received: from [199.232.76.173] (port=37363 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQNiB-0003y3-LN for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 11:17:19 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:43585) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NQNiB-00015S-2Y for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 11:17:19 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.50) id 1NQNi6-0002YK-9M for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 17:17:14 +0100 Original-Received: from 85.183.18.158 ([85.183.18.158]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 31 Dec 2009 17:17:14 +0100 Original-Received: from rileyrgdev by 85.183.18.158 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 31 Dec 2009 17:17:14 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 71 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 85.183.18.158 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:70979 Archived-At: Lennart Borgman writes: > On Thu, Dec 31, 2009 at 2:21 PM, Kiwon Um wrote: >> martin rudalics 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. --