diff options
author | Daniel Colascione <dancol@dancol.org> | 2012-10-07 14:31:58 -0800 |
---|---|---|
committer | Daniel Colascione <dancol@dancol.org> | 2012-10-07 14:31:58 -0800 |
commit | 36a305a723c63fd345be65c536c52fe9765c14be (patch) | |
tree | fb89d9e103552863214c60297a65320917109357 /src/window.c | |
parent | 2ab329f3b5d52a39f0a45c3d9c129f1c19560142 (diff) | |
parent | 795b1482a9e314cda32d62ac2988f573d359366e (diff) | |
download | emacs-36a305a723c63fd345be65c536c52fe9765c14be.tar.gz |
Merge from trunk
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 145 |
1 files changed, 81 insertions, 64 deletions
diff --git a/src/window.c b/src/window.c index 114bd28c310..61d2a8b073f 100644 --- a/src/window.c +++ b/src/window.c @@ -60,8 +60,7 @@ static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer; static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window; static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically; static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command; -static Lisp_Object Qsafe, Qabove, Qbelow; -static Lisp_Object Qclone_of; +static Lisp_Object Qsafe, Qabove, Qbelow, Qwindow_size, Qclone_of; static int displayed_window_lines (struct window *); static int count_windows (struct window *); @@ -134,102 +133,102 @@ static EMACS_INT window_scroll_preserve_hpos; static EMACS_INT window_scroll_preserve_vpos; /* These setters are used only in this file, so they can be private. */ -static inline void +static void wset_combination_limit (struct window *w, Lisp_Object val) { w->combination_limit = val; } -static inline void +static void wset_dedicated (struct window *w, Lisp_Object val) { w->dedicated = val; } -static inline void +static void wset_display_table (struct window *w, Lisp_Object val) { w->display_table = val; } -static inline void +static void wset_hchild (struct window *w, Lisp_Object val) { w->hchild = val; } -static inline void +static void wset_left_fringe_width (struct window *w, Lisp_Object val) { w->left_fringe_width = val; } -static inline void +static void wset_left_margin_cols (struct window *w, Lisp_Object val) { w->left_margin_cols = val; } -static inline void +static void wset_new_normal (struct window *w, Lisp_Object val) { w->new_normal = val; } -static inline void +static void wset_new_total (struct window *w, Lisp_Object val) { w->new_total = val; } -static inline void +static void wset_normal_cols (struct window *w, Lisp_Object val) { w->normal_cols = val; } -static inline void +static void wset_normal_lines (struct window *w, Lisp_Object val) { w->normal_lines = val; } -static inline void +static void wset_parent (struct window *w, Lisp_Object val) { w->parent = val; } -static inline void +static void wset_pointm (struct window *w, Lisp_Object val) { w->pointm = val; } -static inline void +static void wset_right_fringe_width (struct window *w, Lisp_Object val) { w->right_fringe_width = val; } -static inline void +static void wset_right_margin_cols (struct window *w, Lisp_Object val) { w->right_margin_cols = val; } -static inline void +static void wset_scroll_bar_width (struct window *w, Lisp_Object val) { w->scroll_bar_width = val; } -static inline void +static void wset_start (struct window *w, Lisp_Object val) { w->start = val; } -static inline void +static void wset_temslot (struct window *w, Lisp_Object val) { w->temslot = val; } -static inline void +static void wset_vchild (struct window *w, Lisp_Object val) { w->vchild = val; } -static inline void +static void wset_vertical_scroll_bar_type (struct window *w, Lisp_Object val) { w->vertical_scroll_bar_type = val; } -static inline void +static void wset_window_parameters (struct window *w, Lisp_Object val) { w->window_parameters = val; @@ -613,10 +612,10 @@ WINDOW are never \(re-)combined with WINDOW's siblings. */) DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT. WINDOW must be a valid window and defaults to the selected one. -If LIMIT is nil, child windows of WINDOW can be recombined with -WINDOW's siblings. LIMIT t means that child windows of WINDOW are -never \(re-)combined with WINDOW's siblings. Other values are reserved -for future use. */) +If LIMIT is nil, child windows of WINDOW can be recombined with WINDOW's +siblings. LIMIT t means that child windows of WINDOW are never +\(re-)combined with WINDOW's siblings. Other values are reserved for +future use. */) (Lisp_Object window, Lisp_Object limit) { wset_combination_limit (decode_valid_window (window), limit); @@ -2820,7 +2819,7 @@ window-start value is reasonable when this function is called. */) } } - BLOCK_INPUT; + block_input (); if (!FRAME_INITIAL_P (f)) { Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); @@ -2962,7 +2961,7 @@ window-start value is reasonable when this function is called. */) } adjust_glyphs (f); - UNBLOCK_INPUT; + unblock_input (); run_window_configuration_change_hook (f); @@ -3462,6 +3461,10 @@ make_window (void) wset_vertical_scroll_bar_type (w, Qt); wset_window_end_pos (w, make_number (0)); wset_window_end_vpos (w, make_number (0)); + /* These Lisp fields are marked specially so they're not set to nil by + allocate_window. */ + wset_prev_buffers (w, Qnil); + wset_next_buffers (w, Qnil); /* Initialize non-Lisp data. Note that allocate_window zeroes out all non-Lisp data, so do it only for slots which should not be zero. */ @@ -3693,14 +3696,14 @@ be applied on the Elisp level. */) (horflag ? r->total_cols : r->total_lines))) return Qnil; - BLOCK_INPUT; + block_input (); window_resize_apply (r, horflag); windows_or_buffers_changed++; FRAME_WINDOW_SIZES_CHANGED (f) = 1; adjust_glyphs (f); - UNBLOCK_INPUT; + unblock_input (); run_window_configuration_change_hook (f); @@ -3844,7 +3847,7 @@ set correctly. See the code of `split-window' for how this is done. */) We do that if either `window-combination-limit' is t, or OLD has no parent, or OLD is ortho-combined. */ combination_limit = - !NILP (Vwindow_combination_limit) + EQ (Vwindow_combination_limit, Qt) || NILP (o->parent) || NILP (horflag ? (XWINDOW (o->parent)->hchild) @@ -3899,9 +3902,9 @@ set correctly. See the code of `split-window' for how this is done. */) make_parent_window (old, horflag); p = XWINDOW (o->parent); - /* Store value of `window-combination-limit' in new parent's - combination_limit slot. */ - wset_combination_limit (p, Vwindow_combination_limit); + /* Store t in the new parent's combination_limit slot to avoid + that its children get merged into another window. */ + wset_combination_limit (p, Qt); /* These get applied below. */ wset_new_total (p, horflag ? o->total_cols : o->total_lines); wset_new_normal (p, new_normal); @@ -3970,13 +3973,13 @@ set correctly. See the code of `split-window' for how this is done. */) wset_new_total (n, total_size); wset_new_normal (n, normal_size); - BLOCK_INPUT; + block_input (); window_resize_apply (p, horflag); adjust_glyphs (f); /* Set buffer of NEW to buffer of reference window. Don't run any hooks. */ set_window_buffer (new, r->buffer, 0, 1); - UNBLOCK_INPUT; + unblock_input (); /* Maybe we should run the scroll functions in Elisp (which already runs the configuration change hook). */ @@ -4057,7 +4060,7 @@ Signal an error when WINDOW is the only window on its frame. */) { /* Block input. */ - BLOCK_INPUT; + block_input (); window_resize_apply (p, horflag); /* If this window is referred to by the dpyinfo's mouse @@ -4129,7 +4132,7 @@ Signal an error when WINDOW is the only window on its frame. */) else fset_selected_window (f, new_selected_window); - UNBLOCK_INPUT; + unblock_input (); /* Now look whether `get-mru-window' gets us something. */ mru_window = call1 (Qget_mru_window, frame); @@ -4144,7 +4147,7 @@ Signal an error when WINDOW is the only window on its frame. */) fset_selected_window (f, new_selected_window); } else - UNBLOCK_INPUT; + unblock_input (); /* Must be run by the caller: run_window_configuration_change_hook (f); */ @@ -4194,7 +4197,7 @@ grow_mini_window (struct window *w, int delta) root, make_number (- delta)); if (INTEGERP (value) && window_resize_check (r, 0)) { - BLOCK_INPUT; + block_input (); window_resize_apply (r, 0); /* Grow the mini-window. */ @@ -4206,7 +4209,7 @@ grow_mini_window (struct window *w, int delta) w->last_overlay_modified = 0; adjust_glyphs (f); - UNBLOCK_INPUT; + unblock_input (); } } @@ -4231,7 +4234,7 @@ shrink_mini_window (struct window *w) root, make_number (size - 1)); if (INTEGERP (value) && window_resize_check (r, 0)) { - BLOCK_INPUT; + block_input (); window_resize_apply (r, 0); /* Shrink the mini-window. */ @@ -4243,7 +4246,7 @@ shrink_mini_window (struct window *w) w->last_overlay_modified = 0; adjust_glyphs (f); - UNBLOCK_INPUT; + unblock_input (); } /* If the above failed for whatever strange reason we must make a one window frame here. The same routine will be needed when @@ -4275,7 +4278,7 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini && XINT (w->new_total) > 0 && height == XINT (r->new_total) + XINT (w->new_total)) { - BLOCK_INPUT; + block_input (); window_resize_apply (r, 0); wset_total_lines (w, w->new_total); @@ -4285,7 +4288,7 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini windows_or_buffers_changed++; FRAME_WINDOW_SIZES_CHANGED (f) = 1; adjust_glyphs (f); - UNBLOCK_INPUT; + unblock_input (); run_window_configuration_change_hook (f); return Qt; @@ -5621,7 +5624,7 @@ the return value is nil. Otherwise the value is t. */) /* The mouse highlighting code could get screwed up if it runs during this. */ - BLOCK_INPUT; + block_input (); if (data->frame_lines != previous_frame_lines || data->frame_cols != previous_frame_cols) @@ -5872,7 +5875,7 @@ the return value is nil. Otherwise the value is t. */) } adjust_glyphs (f); - UNBLOCK_INPUT; + unblock_input (); /* Scan dead buffer windows. */ for (; CONSP (dead_windows); dead_windows = XCDR (dead_windows)) @@ -6701,6 +6704,7 @@ syms_of_window (void) DEFSYM (Qreplace_buffer_in_windows, "replace-buffer-in-windows"); DEFSYM (Qrecord_window_buffer, "record-window-buffer"); DEFSYM (Qget_mru_window, "get-mru-window"); + DEFSYM (Qwindow_size, "window-size"); DEFSYM (Qtemp_buffer_show_hook, "temp-buffer-show-hook"); DEFSYM (Qabove, "above"); DEFSYM (Qbelow, "below"); @@ -6796,23 +6800,36 @@ This variable takes no effect if `window-combination-limit' is non-nil. */); Vwindow_combination_resize = Qnil; DEFVAR_LISP ("window-combination-limit", Vwindow_combination_limit, - doc: /* If t, splitting a window makes a new parent window. -If this variable is nil, splitting a window will create a new parent -window only if the window has no parent window or the window shall -become a combination orthogonal to the one it is part of. - -If this variable is t, splitting a window always creates a new parent -window. If all splits behave this way, each frame's window tree is a -binary tree and every window but the frame's root window has exactly one -sibling. - -Other values are reserved for future use. - -The value of this variable is also assigned to the combination limit of -the new parent window. The combination limit of a window can be -retrieved via the function `window-combination-limit' and altered by the -function `set-window-combination-limit'. */); - Vwindow_combination_limit = Qnil; + doc: /* If non-nil, splitting a window makes a new parent window. +The following values are recognized: + +nil means splitting a window will create a new parent window only if the + window has no parent window or the window shall become part of a + combination orthogonal to the one it is part of. + +`window-size' means that splitting a window for displaying a buffer + makes a new parent window provided `display-buffer' is supposed to + explicitly set the window's size due to the presence of a + `window-height' or `window-width' entry in the alist used by + `display-buffer'. Otherwise, this value is handled like nil. + +`temp-buffer' means that splitting a window for displaying a temporary + buffer always makes a new parent window. Otherwise, this value is + handled like nil. + +`display-buffer' means that splitting a window for displaying a buffer + always makes a new parent window. Since temporary buffers are + displayed by the function `display-buffer', this value is stronger + than `temp-buffer'. Splitting a window for other purpose makes a + new parent window only if needed. + +t means that splitting a window always creates a new parent window. If + all splits behave this way, each frame's window tree is a binary + tree and every window but the frame's root window has exactly one + sibling. + +Other values are reserved for future use. */); + Vwindow_combination_limit = Qwindow_size; DEFVAR_LISP ("window-persistent-parameters", Vwindow_persistent_parameters, doc: /* Alist of persistent window parameters. |