aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1995-03-11 04:40:18 +0000
committerRichard M. Stallman1995-03-11 04:40:18 +0000
commit855d862724833981510ca29302ff18f1d2b217c9 (patch)
treea159f30967f0970c997d1f85c37d493ece8e2cd1 /src
parent211d6309acc3b94f37c9b555ce7de5ab8c67c7ae (diff)
downloademacs-855d862724833981510ca29302ff18f1d2b217c9.tar.gz
emacs-855d862724833981510ca29302ff18f1d2b217c9.zip
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
(syms_of_window): Set up Lisp vars. (Fdisplay_buffer): Use those vars--if requested, use current window.
Diffstat (limited to 'src')
-rw-r--r--src/window.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/window.c b/src/window.c
index 76e63f1c1ea..f1f50813054 100644
--- a/src/window.c
+++ b/src/window.c
@@ -88,6 +88,12 @@ Lisp_Object Vspecial_display_regexps;
88/* Function to pop up a special frame. */ 88/* Function to pop up a special frame. */
89Lisp_Object Vspecial_display_function; 89Lisp_Object Vspecial_display_function;
90 90
91/* List of buffer *names* for buffers to appear in selected window. */
92Lisp_Object Vsame_window_buffer_names;
93
94/* List of regexps for buffer names to appear in selected window. */
95Lisp_Object Vsame_window_regexps;
96
91/* Hook run at end of temp_output_buffer_show. */ 97/* Hook run at end of temp_output_buffer_show. */
92Lisp_Object Qtemp_buffer_show_hook; 98Lisp_Object Qtemp_buffer_show_hook;
93 99
@@ -1876,6 +1882,32 @@ Returns the window displaying BUFFER.")
1876 && XBUFFER (XWINDOW (selected_window)->buffer) == XBUFFER (buffer)) 1882 && XBUFFER (XWINDOW (selected_window)->buffer) == XBUFFER (buffer))
1877 return selected_window; 1883 return selected_window;
1878 1884
1885 /* See if the user has specified this buffer should appear
1886 in the selected window. */
1887 if (NILP (not_this_window))
1888 {
1889 tem = Fmember (XBUFFER (buffer)->name, Vsame_window_buffer_names);
1890 if (!NILP (tem))
1891 return Fswitch_to_buffer (buffer, Qnil);
1892
1893 tem = Fassoc (XBUFFER (buffer)->name, Vsame_window_buffer_names);
1894 if (!NILP (tem))
1895 return Fswitch_to_buffer (buffer, Qnil);
1896
1897 for (tem = Vsame_window_regexps; CONSP (tem); tem = XCONS (tem)->cdr)
1898 {
1899 Lisp_Object car = XCONS (tem)->car;
1900 if (STRINGP (car)
1901 && fast_string_match (car, XBUFFER (buffer)->name) >= 0)
1902 return Fswitch_to_buffer (buffer, Qnil);
1903 else if (CONSP (car)
1904 && STRINGP (XCONS (car)->car)
1905 && fast_string_match (XCONS (car)->car,
1906 XBUFFER (buffer)->name) >= 0)
1907 return Fswitch_to_buffer (buffer, Qnil);
1908 }
1909 }
1910
1879#ifdef MULTI_FRAME 1911#ifdef MULTI_FRAME
1880 /* If pop_up_frames, 1912 /* If pop_up_frames,
1881 look for a window showing BUFFER on any visible or iconified frame. */ 1913 look for a window showing BUFFER on any visible or iconified frame. */
@@ -3373,6 +3405,34 @@ A buffer is special if its is listed in `special-display-buffer-names'\n\
3373or matches a regexp in `special-display-regexps'."); 3405or matches a regexp in `special-display-regexps'.");
3374 Vspecial_display_function = Qnil; 3406 Vspecial_display_function = Qnil;
3375 3407
3408 DEFVAR_LISP ("same-window-buffer-names", &Vsame_window_buffer_names,
3409 "*List of buffer names that should appear in the selected window.\n\
3410Displaying one of these buffers using `display-buffer' or `pop-to-buffer'\n\
3411switches to it in the selected window, rather than making it appear\n\
3412in some other window.
3413\n\
3414An element of the list can be a cons cell instead of just a string.\n\
3415Then the car must be a string, which specifies the buffer name.\n\
3416This is for compatibility with `special-display-buffer-names';\n\
3417the cdr of the cons cell is ignored.\n\
3418\n\
3419See also `same-window-regexps'.");
3420 Vsame_window_buffer_names = Qnil;
3421
3422 DEFVAR_LISP ("same-window-regexps", &Vsame_window_regexps,
3423 "*List of regexps saying which buffers should appear in the selected window.\n\
3424If a buffer name matches one of these regexps, then displaying it\n\
3425using `display-buffer' or `pop-to-buffer' switches to it\n\
3426in the selected window, rather than making it appear in some other window.\n\
3427\n\
3428An element of the list can be a cons cell instead of just a string.\n\
3429Then the car must be a string, which specifies the buffer name.\n\
3430This is for compatibility with `special-display-buffer-names';\n\
3431the cdr of the cons cell is ignored.\n\
3432\n\
3433See also `same-window-buffer-names'.");
3434 Vsame_window_regexps = Qnil;
3435
3376 DEFVAR_BOOL ("pop-up-windows", &pop_up_windows, 3436 DEFVAR_BOOL ("pop-up-windows", &pop_up_windows,
3377 "*Non-nil means display-buffer should make new windows."); 3437 "*Non-nil means display-buffer should make new windows.");
3378 pop_up_windows = 1; 3438 pop_up_windows = 1;