Mercurial > emacs
comparison src/window.c @ 65826:d16139114c9c
(window_split_tree): New function.
(Fwindow_split_tree): New defun.
(syms_of_window): Defsubr it.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Tue, 04 Oct 2005 14:14:05 +0000 |
parents | 25b770eb7993 |
children | 454a4a463081 2a679c81f552 aa89c814f853 |
comparison
equal
deleted
inserted
replaced
65825:b89d9c4d5386 | 65826:d16139114c9c |
---|---|
6221 | 6221 |
6222 record_unwind_protect (Fset_window_configuration, | 6222 record_unwind_protect (Fset_window_configuration, |
6223 Fcurrent_window_configuration (Qnil)); | 6223 Fcurrent_window_configuration (Qnil)); |
6224 val = Fprogn (args); | 6224 val = Fprogn (args); |
6225 return unbind_to (count, val); | 6225 return unbind_to (count, val); |
6226 } | |
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))); | |
6226 } | 6305 } |
6227 | 6306 |
6228 | 6307 |
6229 /*********************************************************************** | 6308 /*********************************************************************** |
6230 Marginal Areas | 6309 Marginal Areas |
7029 defsubr (&Swindow_configuration_p); | 7108 defsubr (&Swindow_configuration_p); |
7030 defsubr (&Swindow_configuration_frame); | 7109 defsubr (&Swindow_configuration_frame); |
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); |
7037 defsubr (&Swindow_fringes); | 7117 defsubr (&Swindow_fringes); |
7038 defsubr (&Sset_window_scroll_bars); | 7118 defsubr (&Sset_window_scroll_bars); |