From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.help Subject: Re: session management with desktop and window configuration Date: Thu, 31 Dec 2009 14:33:09 +0100 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: quoted-printable X-Trace: ger.gmane.org 1262266455 20187 80.91.229.12 (31 Dec 2009 13:34:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Dec 2009 13:34:15 +0000 (UTC) Cc: martin rudalics , help-gnu-emacs@gnu.org To: Kiwon Um Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 31 14:34:07 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 1NQLA5-0006wb-Rz for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Dec 2009 14:33:58 +0100 Original-Received: from localhost ([127.0.0.1]:33860 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQLA6-0001Ot-33 for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Dec 2009 08:33:58 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NQL9j-0001OC-TC for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 08:33:35 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NQL9e-0001Lu-IF for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 08:33:34 -0500 Original-Received: from [199.232.76.173] (port=46025 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQL9e-0001Lq-BL for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 08:33:30 -0500 Original-Received: from mail-yw0-f177.google.com ([209.85.211.177]:34598) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NQL9e-00009d-9D for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 08:33:30 -0500 Original-Received: by ywh7 with SMTP id 7so3331237ywh.24 for ; Thu, 31 Dec 2009 05:33:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=g52Hy2Q9T/DfYMD1qrARavfXKHRdt3h+6fiY03n/Uqc=; b=gvlGSZAzZ1Fxjj4vVa//V7gnb8vvyxDRqPdX+C84WL47xuu1LEdvOuxwUQrAXkNSm9 Kqc3/1XBvsx2ObYP9uA3756h5FufS5bxDmShcqSLks0azJ8iZtEUzMvjL/QpkegZeVSv iEYtktPn2lEM8pRwo7DsInrS/Nw1tt+vof+TA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=xI9JCB9FXaPsc5yYyaLDlbPnN1MlBI+4rmmpZpItakz1EnGPx2BvhgIRuTBlyJoZ01 7FFGz5Qq/ua3kdzfiWl5IlucYHKywwaZ8XM4M3qPLgr+xQX1V4C6j4zk3h6qhD8S25+q b+RyshvCUTPnDl5SZ4D7qPuAkdb2UWwJQRw84= Original-Received: by 10.101.132.37 with SMTP id j37mr8604283ann.101.1262266409199; Thu, 31 Dec 2009 05:33:29 -0800 (PST) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:70977 Archived-At: 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: >>> =C2=A0 (add-hook 'desktop-save-hook '(window-configuration-to-register = ?0)) >>> =C2=A0 (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. =C2=A0The 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. =C2=A0In this context note also that yo= u >> 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. =C2=A0But = 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. =C2=A0This way I can circumvent the >> window splitting mechanism and directly construct a window-tree from the >> information on the file. =C2=A0This 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 () > =C2=A0(write-region (concat "(restore-window-configuration '" > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(prin1-to-string (current-window-configuration-printable)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0")") > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0nil ".emacs.restor= e-window.el")) > (defun kiwon/restore-window-configuration () > =C2=A0(when (file-exists-p ".emacs.restore-window.el") > =C2=A0 =C2=A0(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?)