diff options
| author | Kim F. Storm | 2005-10-04 14:14:05 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2005-10-04 14:14:05 +0000 |
| commit | 94e16dd57500765e9ef12f0c64e96f5d9fe5523e (patch) | |
| tree | 8b54703d28cc22579eee7ea6a011df9b7a79174d /src/window.c | |
| parent | 222a6c9b7f1eca773c8caa9e1b9a7a91a19b8c88 (diff) | |
| download | emacs-94e16dd57500765e9ef12f0c64e96f5d9fe5523e.tar.gz emacs-94e16dd57500765e9ef12f0c64e96f5d9fe5523e.zip | |
(window_split_tree): New function.
(Fwindow_split_tree): New defun.
(syms_of_window): Defsubr it.
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/window.c b/src/window.c index 9e75a592733..d282c2dd3f4 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -6225,6 +6225,85 @@ usage: (save-window-excursion BODY ...) */) | |||
| 6225 | return unbind_to (count, val); | 6225 | return unbind_to (count, val); |
| 6226 | } | 6226 | } |
| 6227 | 6227 | ||
| 6228 | |||
| 6229 | |||
| 6230 | /*********************************************************************** | ||
| 6231 | Window Split Tree | ||
| 6232 | ***********************************************************************/ | ||
| 6233 | |||
| 6234 | static Lisp_Object | ||
| 6235 | window_split_tree (w) | ||
| 6236 | struct window *w; | ||
| 6237 | { | ||
| 6238 | Lisp_Object tail = Qnil; | ||
| 6239 | Lisp_Object result = Qnil; | ||
| 6240 | |||
| 6241 | while (w) | ||
| 6242 | { | ||
| 6243 | Lisp_Object wn; | ||
| 6244 | |||
| 6245 | XSETWINDOW (wn, w); | ||
| 6246 | if (!NILP (w->hchild)) | ||
| 6247 | wn = Fcons (Qnil, Fcons (Fwindow_edges (wn), | ||
| 6248 | window_split_tree (XWINDOW (w->hchild)))); | ||
| 6249 | else if (!NILP (w->vchild)) | ||
| 6250 | wn = Fcons (Qt, Fcons (Fwindow_edges (wn), | ||
| 6251 | window_split_tree (XWINDOW (w->vchild)))); | ||
| 6252 | |||
| 6253 | if (NILP (result)) | ||
| 6254 | { | ||
| 6255 | result = tail = Fcons (wn, Qnil); | ||
| 6256 | } | ||
| 6257 | else | ||
| 6258 | { | ||
| 6259 | XSETCDR (tail, Fcons (wn, Qnil)); | ||
| 6260 | tail = XCDR (tail); | ||
| 6261 | } | ||
| 6262 | |||
| 6263 | w = NILP (w->next) ? 0 : XWINDOW (w->next); | ||
| 6264 | } | ||
| 6265 | |||
| 6266 | return result; | ||
| 6267 | } | ||
| 6268 | |||
| 6269 | |||
| 6270 | |||
| 6271 | DEFUN ("window-split-tree", Fwindow_split_tree, Swindow_split_tree, | ||
| 6272 | 0, 1, 0, | ||
| 6273 | doc: /* Return the window split tree for frame FRAME. | ||
| 6274 | |||
| 6275 | The return value is a list of the form (ROOT MINI), where ROOT | ||
| 6276 | represents the window split tree of the frame's root window, and MINI | ||
| 6277 | is the frame's minibuffer window. | ||
| 6278 | |||
| 6279 | If the root window is not split, ROOT is the root window itself. | ||
| 6280 | Otherwise, ROOT is a list (DIR EDGES W1 W2 ...) where DIR is nil for a | ||
| 6281 | horisontal split, and t for a vertical split, EDGES gives the combined | ||
| 6282 | size and position of the subwindows in the split, and the rest of the | ||
| 6283 | elements are the subwindows in the split. Each of the subwindows may | ||
| 6284 | again be a window or a list representing a window split, and so on. | ||
| 6285 | EDGES is a list \(LEFT TOP RIGHT BOTTOM) as returned by `window-edges'. | ||
| 6286 | |||
| 6287 | If FRAME is nil or omitted, return information on the currently | ||
| 6288 | selected frame. */) | ||
| 6289 | (frame) | ||
| 6290 | Lisp_Object frame; | ||
| 6291 | { | ||
| 6292 | Lisp_Object alist; | ||
| 6293 | FRAME_PTR f; | ||
| 6294 | |||
| 6295 | if (NILP (frame)) | ||
| 6296 | frame = selected_frame; | ||
| 6297 | |||
| 6298 | CHECK_FRAME (frame); | ||
| 6299 | f = XFRAME (frame); | ||
| 6300 | |||
| 6301 | if (!FRAME_LIVE_P (f)) | ||
| 6302 | return Qnil; | ||
| 6303 | |||
| 6304 | return window_split_tree (XWINDOW (FRAME_ROOT_WINDOW (f))); | ||
| 6305 | } | ||
| 6306 | |||
| 6228 | 6307 | ||
| 6229 | /*********************************************************************** | 6308 | /*********************************************************************** |
| 6230 | Marginal Areas | 6309 | Marginal Areas |
| @@ -7031,6 +7110,7 @@ The selected frame is the one whose configuration has changed. */); | |||
| 7031 | defsubr (&Sset_window_configuration); | 7110 | defsubr (&Sset_window_configuration); |
| 7032 | defsubr (&Scurrent_window_configuration); | 7111 | defsubr (&Scurrent_window_configuration); |
| 7033 | defsubr (&Ssave_window_excursion); | 7112 | defsubr (&Ssave_window_excursion); |
| 7113 | defsubr (&Swindow_split_tree); | ||
| 7034 | defsubr (&Sset_window_margins); | 7114 | defsubr (&Sset_window_margins); |
| 7035 | defsubr (&Swindow_margins); | 7115 | defsubr (&Swindow_margins); |
| 7036 | defsubr (&Sset_window_fringes); | 7116 | defsubr (&Sset_window_fringes); |