From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Robin Dunn Newsgroups: gmane.emacs.help Subject: Re: save/restore frame positions Date: Tue, 16 May 2006 15:12:35 -0700 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <126kjinjst5ul02@corp.supernews.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1147819319 10237 80.91.229.2 (16 May 2006 22:41:59 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 16 May 2006 22:41:59 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 17 00:41:54 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Fg8E4-0002YM-Py for geh-help-gnu-emacs@m.gmane.org; Wed, 17 May 2006 00:41:13 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fg8E3-0005hV-Ql for geh-help-gnu-emacs@m.gmane.org; Tue, 16 May 2006 18:41:11 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!sn-xt-sjc-02!sn-xt-sjc-08!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Thunderbird 1.5.0.2 (X11/20060420) In-Reply-To: Original-X-Complaints-To: abuse@supernews.com Original-Lines: 73 Original-Xref: shelby.stanford.edu gnu.emacs.help:139471 Original-To: help-gnu-emacs@gnu.org 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:35094 Archived-At: Drew Adams wrote: > Library `doremi-frm.el' (which requires a few other libraries) provides an > easy way to use frame configurations interactively. You can have a ring of > frame configurations, and then use command `doremi-frame-configs' to cycle > among them. > > `doremi-frm.el' automatically pushes each change you make to a frame (using > DoReMi commands) to a ring of frame configs. For example, if you use > `doremi-frame-height' to incrementally change the height of a frame, then > the change is recorded in the frame-config ring. > > In general, `doremi-frm.el' is not about frame configs; this is a side > feature. It is about making incremental changes to frames interactively: > color, size, position, font, faces, whatever. You do this using either a > mouse wheel or the arrow keys (press & hold to increase/decrease a frame > parameter until you get what you like). > > After making a change that you like, you can copy it to your > `default-frame-alist' (or another frame alist) using DoReMi commands, and > then you can save the `default-frame-alist' change persistently using > Customize. Thanks, but I think this isn't quite what I am looking for. I don't see how to save the size/positions of multiple frames, and then, after restarting emacs, to recreate, size and position a new set of frames to match the old saved config. I had a bit of time over the weekend and so I bit the bullet and dug in to elisp enough to hack something together myself. It's butt-ugly but it works. It loops through the current frames and then writes a elisp function into the *scratch* buffer that will recreate the frames and set their size and position. Then I can just copy that function to my .emacs file and M-x it when I startup. If I want to have multiple layout-configs I can just change the name of the defun and have several of them in my .emacs file. (defun my-save-frame-info () "Save info about current emacs frames" (interactive) (let ((cbuf (current-buffer))) (switch-to-buffer "*scratch*") (goto-char (point-max)) (insert "(defun my-make-frames ()\n \"\"\n") (insert " (interactive)\n") (insert " ; delete all current frames except 1\n") (insert " (while (> (length (frame-list)) 1)\n") (insert " (delete-frame (nth 0 (frame-list))))\n") (insert " ; size and position the remaining frame\n") (let ((frm (car (frame-list)))) (insert " (let ((frm (car (frame-list))))\n") (insert (format " (set-frame-position frm %d %d)\n" (frame-parameter frm 'left) (frame-parameter frm 'top))) (insert (format " (set-frame-size frm %d %d))\n" (frame-width frm) (frame-height frm)))) (insert " ; make additional frames and position them\n") (dolist (frm (cdr (frame-list))) (insert " (let ((frm (make-frame)))\n") (insert (format " (set-frame-position frm %d %d)\n" (frame-parameter frm 'left) (frame-parameter frm 'top))) (insert (format " (set-frame-size frm %d %d))\n" (frame-width frm) (frame-height frm)))) (insert ")\n") (switch-to-buffer cbuf) (message "Look at the end of the *scratch* buffer...")) )