diff options
author | Richard M. Stallman <rms@gnu.org> | 1995-03-11 04:40:18 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1995-03-11 04:40:18 +0000 |
commit | 2711cc6ed6da101d9e23c5f029f1c99ec93896ad (patch) | |
tree | 506ccb51f8bf37c0d6cf828fc2845aae5217d3e9 /src/window.c | |
parent | 60a88d840cc2f1b5ecfd1da46b49142724902fbd (diff) | |
download | emacs-2711cc6ed6da101d9e23c5f029f1c99ec93896ad.tar.gz |
(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/window.c')
-rw-r--r-- | src/window.c | 60 |
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; /* Function to pop up a special frame. */ Lisp_Object Vspecial_display_function; +/* List of buffer *names* for buffers to appear in selected window. */ +Lisp_Object Vsame_window_buffer_names; + +/* List of regexps for buffer names to appear in selected window. */ +Lisp_Object Vsame_window_regexps; + /* Hook run at end of temp_output_buffer_show. */ Lisp_Object Qtemp_buffer_show_hook; @@ -1876,6 +1882,32 @@ Returns the window displaying BUFFER.") && XBUFFER (XWINDOW (selected_window)->buffer) == XBUFFER (buffer)) return selected_window; + /* See if the user has specified this buffer should appear + in the selected window. */ + if (NILP (not_this_window)) + { + tem = Fmember (XBUFFER (buffer)->name, Vsame_window_buffer_names); + if (!NILP (tem)) + return Fswitch_to_buffer (buffer, Qnil); + + tem = Fassoc (XBUFFER (buffer)->name, Vsame_window_buffer_names); + if (!NILP (tem)) + return Fswitch_to_buffer (buffer, Qnil); + + for (tem = Vsame_window_regexps; CONSP (tem); tem = XCONS (tem)->cdr) + { + Lisp_Object car = XCONS (tem)->car; + if (STRINGP (car) + && fast_string_match (car, XBUFFER (buffer)->name) >= 0) + return Fswitch_to_buffer (buffer, Qnil); + else if (CONSP (car) + && STRINGP (XCONS (car)->car) + && fast_string_match (XCONS (car)->car, + XBUFFER (buffer)->name) >= 0) + return Fswitch_to_buffer (buffer, Qnil); + } + } + #ifdef MULTI_FRAME /* If pop_up_frames, 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\ or matches a regexp in `special-display-regexps'."); Vspecial_display_function = Qnil; + DEFVAR_LISP ("same-window-buffer-names", &Vsame_window_buffer_names, + "*List of buffer names that should appear in the selected window.\n\ +Displaying one of these buffers using `display-buffer' or `pop-to-buffer'\n\ +switches to it in the selected window, rather than making it appear\n\ +in some other window. +\n\ +An element of the list can be a cons cell instead of just a string.\n\ +Then the car must be a string, which specifies the buffer name.\n\ +This is for compatibility with `special-display-buffer-names';\n\ +the cdr of the cons cell is ignored.\n\ +\n\ +See also `same-window-regexps'."); + Vsame_window_buffer_names = Qnil; + + DEFVAR_LISP ("same-window-regexps", &Vsame_window_regexps, + "*List of regexps saying which buffers should appear in the selected window.\n\ +If a buffer name matches one of these regexps, then displaying it\n\ +using `display-buffer' or `pop-to-buffer' switches to it\n\ +in the selected window, rather than making it appear in some other window.\n\ +\n\ +An element of the list can be a cons cell instead of just a string.\n\ +Then the car must be a string, which specifies the buffer name.\n\ +This is for compatibility with `special-display-buffer-names';\n\ +the cdr of the cons cell is ignored.\n\ +\n\ +See also `same-window-buffer-names'."); + Vsame_window_regexps = Qnil; + DEFVAR_BOOL ("pop-up-windows", &pop_up_windows, "*Non-nil means display-buffer should make new windows."); pop_up_windows = 1; |