From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kiwon Um Newsgroups: gmane.emacs.help Subject: Re: session management with desktop and window configuration Date: Thu, 31 Dec 2009 22:21:33 +0900 Message-ID: References: <4B3C8BAB.7000607@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1262265744 18350 80.91.229.12 (31 Dec 2009 13:22:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Dec 2009 13:22:24 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: martin rudalics Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 31 14:22:16 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 1NQKyl-0002sH-NU for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Dec 2009 14:22:16 +0100 Original-Received: from localhost ([127.0.0.1]:59850 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQKyl-0003He-VA for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Dec 2009 08:22:16 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NQKyQ-0003HU-CL for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 08:21:54 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NQKyK-0003G4-Tc for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 08:21:53 -0500 Original-Received: from [199.232.76.173] (port=46435 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQKyK-0003G1-Ns for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 08:21:48 -0500 Original-Received: from mail-pw0-f47.google.com ([209.85.160.47]:47017) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NQKyK-0006Pc-Jl for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 08:21:48 -0500 Original-Received: by pwj10 with SMTP id 10so1019984pwj.26 for ; Thu, 31 Dec 2009 05:21:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version:content-type; bh=h0m0Ya3n2aND2435QceZtTm8lyoS8eHQ0Ppoycqq75k=; b=MjH3w9AN0vDyPLDkmjOR0E6D2iyldTio9zh9uuYUcY68NWx07slbYncZlqGEk2jW1r z8jvuB8wN3ztfTSH/ELhe7+oqbdrob+YBUNZbVOoezylmnLwSTMASmXOk8eJG7nBLIop 3jxJ2iOajYsNT475T8qqznnQVegFX++sD1f2k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=YmCG7WJkdli+8ISQciRp3g11mF6qDdLepEmfn91799xI0L9PPjauq8MWm0PF+fJGk1 EFAn2cyvAd7V5tso39UGAP8eHo2qhn+9z59DOt3GjQ05AAy6GDT5ltD8m4p9lbEXCKJu Dwy7oINLlgLU7mIy3Xq8WMuJYzXQPFupyDAO0= Original-Received: by 10.141.89.11 with SMTP id r11mr14009048rvl.285.1262265706767; Thu, 31 Dec 2009 05:21:46 -0800 (PST) Original-Received: from localhost.localdomain ([163.152.71.53]) by mx.google.com with ESMTPS id 22sm14355666pzk.14.2009.12.31.05.21.44 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 31 Dec 2009 05:21:45 -0800 (PST) In-Reply-To: <4B3C8BAB.7000607@gmx.at> (martin rudalics's message of "Thu, 31 Dec 2009 12:31:55 +0100") 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, 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:70976 Archived-At: 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. :)