diff options
| author | Richard M. Stallman | 1995-03-11 04:40:18 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-03-11 04:40:18 +0000 |
| commit | 855d862724833981510ca29302ff18f1d2b217c9 (patch) | |
| tree | a159f30967f0970c997d1f85c37d493ece8e2cd1 /src | |
| parent | 211d6309acc3b94f37c9b555ce7de5ab8c67c7ae (diff) | |
| download | emacs-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.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; | |||
| 88 | /* Function to pop up a special frame. */ | 88 | /* Function to pop up a special frame. */ |
| 89 | Lisp_Object Vspecial_display_function; | 89 | Lisp_Object Vspecial_display_function; |
| 90 | 90 | ||
| 91 | /* List of buffer *names* for buffers to appear in selected window. */ | ||
| 92 | Lisp_Object Vsame_window_buffer_names; | ||
| 93 | |||
| 94 | /* List of regexps for buffer names to appear in selected window. */ | ||
| 95 | Lisp_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. */ |
| 92 | Lisp_Object Qtemp_buffer_show_hook; | 98 | Lisp_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\ | |||
| 3373 | or matches a regexp in `special-display-regexps'."); | 3405 | or 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\ | ||
| 3410 | Displaying one of these buffers using `display-buffer' or `pop-to-buffer'\n\ | ||
| 3411 | switches to it in the selected window, rather than making it appear\n\ | ||
| 3412 | in some other window. | ||
| 3413 | \n\ | ||
| 3414 | An element of the list can be a cons cell instead of just a string.\n\ | ||
| 3415 | Then the car must be a string, which specifies the buffer name.\n\ | ||
| 3416 | This is for compatibility with `special-display-buffer-names';\n\ | ||
| 3417 | the cdr of the cons cell is ignored.\n\ | ||
| 3418 | \n\ | ||
| 3419 | See 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\ | ||
| 3424 | If a buffer name matches one of these regexps, then displaying it\n\ | ||
| 3425 | using `display-buffer' or `pop-to-buffer' switches to it\n\ | ||
| 3426 | in the selected window, rather than making it appear in some other window.\n\ | ||
| 3427 | \n\ | ||
| 3428 | An element of the list can be a cons cell instead of just a string.\n\ | ||
| 3429 | Then the car must be a string, which specifies the buffer name.\n\ | ||
| 3430 | This is for compatibility with `special-display-buffer-names';\n\ | ||
| 3431 | the cdr of the cons cell is ignored.\n\ | ||
| 3432 | \n\ | ||
| 3433 | See 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; |