help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trying to write an emacs lisp function


From: B. T. Raven
Subject: Re: Trying to write an emacs lisp function
Date: Mon, 28 Aug 2006 00:40:33 -0500

<jkarres@gmail.com> wrote in message
1156735064.663675.84930@m73g2000cwd.googlegroups.com">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

#<window 8 on *scratch*>

and after killing some buffers:

#<window 3 on *scratch*>

>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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]