aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Rudalics2012-09-22 14:56:08 +0200
committerMartin Rudalics2012-09-22 14:56:08 +0200
commit8e17c9ba1443c2f21c5801f0c4660ac08dccc837 (patch)
tree440766cd6249af19144f114626180568c5ece697 /src
parentaa1fe812d3e77ed65a5226a42e5dc081eab22b18 (diff)
downloademacs-8e17c9ba1443c2f21c5801f0c4660ac08dccc837.tar.gz
emacs-8e17c9ba1443c2f21c5801f0c4660ac08dccc837.zip
Make Temp Buffer Resize Mode less intrusive (Bug#1806).
* window.c (Fsplit_window_internal): Handle only Qt value of Vwindow_combination_limit separately. (Qtemp_buffer_resize): New symbol. (Vwindow_combination_limit): New default value. Rewrite doc-string. * cus-start.el (window-combination-limit): Add new optional values. * window.el (temp-buffer-window-show) (window--try-to-split-window): Obey new values of window-combination-limit. (split-window): Test window-combination-limit for t instead of non-nil. (display-buffer-at-bottom): New buffer display action function. * help.el (temp-buffer-resize-regexps): New option. (temp-buffer-resize-mode): Rewrite doc-string. (resize-temp-buffer-window): Obey temp-buffer-resize-regexps. Don't resize reused window. Suggested by Glen Morris.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/window.c63
2 files changed, 46 insertions, 25 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4033f51ca1a..6ea40b3f122 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12012-09-22 Martin Rudalics <rudalics@gmx.at>
2
3 * window.c (Fsplit_window_internal): Handle only Qt value of
4 Vwindow_combination_limit separately.
5 (Qtemp_buffer_resize): New symbol.
6 (Vwindow_combination_limit): New default value. Rewrite
7 doc-string.
8
12012-09-22 Eli Zaretskii <eliz@gnu.org> 92012-09-22 Eli Zaretskii <eliz@gnu.org>
2 10
3 * xdisp.c (next_overlay_string): Initialize it->end_charpos for 11 * xdisp.c (next_overlay_string): Initialize it->end_charpos for
diff --git a/src/window.c b/src/window.c
index a6f1104587e..6798be8231c 100644
--- a/src/window.c
+++ b/src/window.c
@@ -60,8 +60,7 @@ static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer;
60static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window; 60static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window;
61static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically; 61static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically;
62static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command; 62static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command;
63static Lisp_Object Qsafe, Qabove, Qbelow; 63static Lisp_Object Qsafe, Qabove, Qbelow, Qtemp_buffer_resize, Qclone_of;
64static Lisp_Object Qclone_of;
65 64
66static int displayed_window_lines (struct window *); 65static int displayed_window_lines (struct window *);
67static int count_windows (struct window *); 66static int count_windows (struct window *);
@@ -613,10 +612,10 @@ WINDOW are never \(re-)combined with WINDOW's siblings. */)
613DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, 612DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0,
614 doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT. 613 doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT.
615WINDOW must be a valid window and defaults to the selected one. 614WINDOW must be a valid window and defaults to the selected one.
616If LIMIT is nil, child windows of WINDOW can be recombined with 615If LIMIT is nil, child windows of WINDOW can be recombined with WINDOW's
617WINDOW's siblings. LIMIT t means that child windows of WINDOW are 616siblings. LIMIT t means that child windows of WINDOW are never
618never \(re-)combined with WINDOW's siblings. Other values are reserved 617\(re-)combined with WINDOW's siblings. Other values are reserved for
619for future use. */) 618future use. */)
620 (Lisp_Object window, Lisp_Object limit) 619 (Lisp_Object window, Lisp_Object limit)
621{ 620{
622 wset_combination_limit (decode_valid_window (window), limit); 621 wset_combination_limit (decode_valid_window (window), limit);
@@ -3466,7 +3465,7 @@ make_window (void)
3466 allocate_window. */ 3465 allocate_window. */
3467 wset_prev_buffers (w, Qnil); 3466 wset_prev_buffers (w, Qnil);
3468 wset_next_buffers (w, Qnil); 3467 wset_next_buffers (w, Qnil);
3469 3468
3470 /* Initialize non-Lisp data. Note that allocate_window zeroes out all 3469 /* Initialize non-Lisp data. Note that allocate_window zeroes out all
3471 non-Lisp data, so do it only for slots which should not be zero. */ 3470 non-Lisp data, so do it only for slots which should not be zero. */
3472 w->nrows_scale_factor = w->ncols_scale_factor = 1; 3471 w->nrows_scale_factor = w->ncols_scale_factor = 1;
@@ -3848,7 +3847,7 @@ set correctly. See the code of `split-window' for how this is done. */)
3848 We do that if either `window-combination-limit' is t, or OLD has no 3847 We do that if either `window-combination-limit' is t, or OLD has no
3849 parent, or OLD is ortho-combined. */ 3848 parent, or OLD is ortho-combined. */
3850 combination_limit = 3849 combination_limit =
3851 !NILP (Vwindow_combination_limit) 3850 EQ (Vwindow_combination_limit, Qt)
3852 || NILP (o->parent) 3851 || NILP (o->parent)
3853 || NILP (horflag 3852 || NILP (horflag
3854 ? (XWINDOW (o->parent)->hchild) 3853 ? (XWINDOW (o->parent)->hchild)
@@ -3903,9 +3902,9 @@ set correctly. See the code of `split-window' for how this is done. */)
3903 3902
3904 make_parent_window (old, horflag); 3903 make_parent_window (old, horflag);
3905 p = XWINDOW (o->parent); 3904 p = XWINDOW (o->parent);
3906 /* Store value of `window-combination-limit' in new parent's 3905 /* Store t in the new parent's combination_limit slot to avoid
3907 combination_limit slot. */ 3906 that its children get merged into another window. */
3908 wset_combination_limit (p, Vwindow_combination_limit); 3907 wset_combination_limit (p, Qt);
3909 /* These get applied below. */ 3908 /* These get applied below. */
3910 wset_new_total (p, horflag ? o->total_cols : o->total_lines); 3909 wset_new_total (p, horflag ? o->total_cols : o->total_lines);
3911 wset_new_normal (p, new_normal); 3910 wset_new_normal (p, new_normal);
@@ -6705,6 +6704,7 @@ syms_of_window (void)
6705 DEFSYM (Qreplace_buffer_in_windows, "replace-buffer-in-windows"); 6704 DEFSYM (Qreplace_buffer_in_windows, "replace-buffer-in-windows");
6706 DEFSYM (Qrecord_window_buffer, "record-window-buffer"); 6705 DEFSYM (Qrecord_window_buffer, "record-window-buffer");
6707 DEFSYM (Qget_mru_window, "get-mru-window"); 6706 DEFSYM (Qget_mru_window, "get-mru-window");
6707 DEFSYM (Qtemp_buffer_resize, "temp-buffer-resize");
6708 DEFSYM (Qtemp_buffer_show_hook, "temp-buffer-show-hook"); 6708 DEFSYM (Qtemp_buffer_show_hook, "temp-buffer-show-hook");
6709 DEFSYM (Qabove, "above"); 6709 DEFSYM (Qabove, "above");
6710 DEFSYM (Qbelow, "below"); 6710 DEFSYM (Qbelow, "below");
@@ -6800,23 +6800,36 @@ This variable takes no effect if `window-combination-limit' is non-nil. */);
6800 Vwindow_combination_resize = Qnil; 6800 Vwindow_combination_resize = Qnil;
6801 6801
6802 DEFVAR_LISP ("window-combination-limit", Vwindow_combination_limit, 6802 DEFVAR_LISP ("window-combination-limit", Vwindow_combination_limit,
6803 doc: /* If t, splitting a window makes a new parent window. 6803 doc: /* If non-nil, splitting a window makes a new parent window.
6804If this variable is nil, splitting a window will create a new parent 6804The following values are recognized:
6805window only if the window has no parent window or the window shall
6806become a combination orthogonal to the one it is part of.
6807 6805
6808If this variable is t, splitting a window always creates a new parent 6806nil means splitting a window will create a new parent window only if the
6809window. If all splits behave this way, each frame's window tree is a 6807 window has no parent window or the window shall become a combination
6810binary tree and every window but the frame's root window has exactly one 6808 orthogonal to the one it is part of.
6811sibling.
6812 6809
6813Other values are reserved for future use. 6810`temp-buffer-resize' means that splitting a window for displaying a
6811 temporary buffer makes a new parent window provided
6812 `temp-buffer-resize-mode' is enabled. Otherwise, this value is
6813 handled like nil.
6814
6815`temp-buffer' means that splitting a window for displaying a temporary
6816 buffer always makes a new parent window. Otherwise, this value is
6817 handled like nil.
6818
6819
6820`display-buffer' means that splitting a window for displaying a buffer
6821 always makes a new parent window. Since temporary buffers are
6822 displayed by the function `display-buffer', this value is stronger
6823 than `temp-buffer'. Splitting a window for other purpose makes a
6824 new parent window only if needed.
6825
6826t means that splitting a window always creates a new parent window. If
6827 all splits behave this way, each frame's window tree is a binary
6828 tree and every window but the frame's root window has exactly one
6829 sibling.
6814 6830
6815The value of this variable is also assigned to the combination limit of 6831Other values are reserved for future use. */);
6816the new parent window. The combination limit of a window can be 6832 Vwindow_combination_limit = Qtemp_buffer_resize;
6817retrieved via the function `window-combination-limit' and altered by the
6818function `set-window-combination-limit'. */);
6819 Vwindow_combination_limit = Qnil;
6820 6833
6821 DEFVAR_LISP ("window-persistent-parameters", Vwindow_persistent_parameters, 6834 DEFVAR_LISP ("window-persistent-parameters", Vwindow_persistent_parameters,
6822 doc: /* Alist of persistent window parameters. 6835 doc: /* Alist of persistent window parameters.