From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "B. T. Raven" Newsgroups: gmane.emacs.help Subject: Re: Trying to write an emacs lisp function Date: Mon, 28 Aug 2006 00:40:33 -0500 Organization: UseNetServer.com Message-ID: <4e4bd$44f28112$49f20c8$16248@DIALUPUSA.NET> References: <1156735064.663675.84930@m73g2000cwd.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1156747274 4947 80.91.229.2 (28 Aug 2006 06:41:14 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 28 Aug 2006 06:41:14 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Aug 28 08:41:05 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 1GHanf-0007KP-Js for geh-help-gnu-emacs@m.gmane.org; Mon, 28 Aug 2006 08:40:48 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GHanf-0003Ii-3D for geh-help-gnu-emacs@m.gmane.org; Mon, 28 Aug 2006 02:40:47 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news1.google.com!atl-c05.usenetserver.com!news.usenetserver.com!in01.usenetserver.com!news.usenetserver.com!atl-c08.usenetserver.com!news.usenetserver.com!pc02.usenetserver.com!DIALUPUSA.NET!not-for-mail Original-Newsgroups: gnu.emacs.help X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Original-X-Complaints-To: abuse@usenetserver.com Original-Lines: 57 Original-X-Trace: 4e4bd44f28112a13a856d16248 Original-Xref: shelby.stanford.edu gnu.emacs.help:141359 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:36979 Archived-At: wrote in message news:1156735064.663675.84930@m73g2000cwd.googlegroups.com... > I'm trying to write a function such that when you use it, all the > windows on the current frame will be deleted, and for each deleted > window, a new frame will be created, displaying the same buffer that > the just-deleted window had been displaying. When it is finished > running, the original frame/window should still be on top (/in > focus/active/however you say it). > > This is what I have so far: > > (defun windows-into-frames () > "If the current frame has more than one window, > make each window display in its own > seperate frame." ;;;;;;;;separate > (interactive) > (setq original-frame (selected-frame)) ;;; where does the value of 'selected-frame come from??? ;;; maybe try (last (frames-on-display-list)) or maybe car?? > (while (not (one-window-p t)) > (other-window 1) > (make-frame) > (delete-window) ;;; it looks like you want to close the "while" here; doesn't kill buffer > (select-frame original-frame))) > > Apparently "select-frame" doesn't work quite like I thought. Can > anybody help me out? > > Thanks. > More important than the above comments is whether your main purpose can even be achieved by creating frames and deleting windows. The buffers still exist until they are killed and all of them will be viewable through the new frames you create. It might be a good idea to try and accomplish what you want (semi-) manually before you try it programmatically. I don't know enough to state categorically that you can't do it, but I doubt it. I tried to look for functions that might help you but I kept running into dead ends. For example the promising frame-live-p in frames.el couldn't be traced further. I must be a c language primitive. By evaluating (frame-live-p) in *scratch* I found that it needs 1 or more arguments. A number, string, and symbol all returned nil instead of a backtrace. In version 22 there is a frame-selected-window function that on first invocation returned # and after killing some buffers: # >>From all of this I suspect that if what you want to do is possible at all, it probably requires advanced knowledge elisp or maybe even c.