diff options
| author | Richard M. Stallman | 1994-04-23 21:37:15 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-04-23 21:37:15 +0000 |
| commit | a90712c210f563f2128cdae74295f014a5d8b9a1 (patch) | |
| tree | e50327ee3f94ef63dc0520469e9d2f8d0a835347 /src | |
| parent | 4a7cfafcf713410e08089e706bddd02b06c3bb70 (diff) | |
| download | emacs-a90712c210f563f2128cdae74295f014a5d8b9a1.tar.gz emacs-a90712c210f563f2128cdae74295f014a5d8b9a1.zip | |
Implement special frames for specified buffers.
(Vspecial_display_buffer_names, Vspecial_display_regexps)
(Vspecial_display_function): New variables.
(syms_of_window): Set up Lisp variables.
(Fdisplay_buffer): Handle them.
Diffstat (limited to 'src')
| -rw-r--r-- | src/window.c | 55 |
1 files changed, 48 insertions, 7 deletions
diff --git a/src/window.c b/src/window.c index 19d2cc54172..a73ad3fce82 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -79,6 +79,15 @@ Lisp_Object Vpop_up_frame_function; | |||
| 79 | /* Function to call to handle Fdisplay_buffer. */ | 79 | /* Function to call to handle Fdisplay_buffer. */ |
| 80 | Lisp_Object Vdisplay_buffer_function; | 80 | Lisp_Object Vdisplay_buffer_function; |
| 81 | 81 | ||
| 82 | /* List of buffer *names* for buffers that should have their own frames. */ | ||
| 83 | Lisp_Object Vspecial_display_buffer_names; | ||
| 84 | |||
| 85 | /* List of regexps for buffer names that should have their own frames. */ | ||
| 86 | Lisp_Object Vspecial_display_regexps; | ||
| 87 | |||
| 88 | /* Function to pop up a special frame. */ | ||
| 89 | Lisp_Object Vspecial_display_function; | ||
| 90 | |||
| 82 | /* Fdisplay_buffer always splits the largest window | 91 | /* Fdisplay_buffer always splits the largest window |
| 83 | if that window is more than this high. */ | 92 | if that window is more than this high. */ |
| 84 | int split_height_threshold; | 93 | int split_height_threshold; |
| @@ -1699,7 +1708,7 @@ Returns the window displaying BUFFER.") | |||
| 1699 | (buffer, not_this_window) | 1708 | (buffer, not_this_window) |
| 1700 | register Lisp_Object buffer, not_this_window; | 1709 | register Lisp_Object buffer, not_this_window; |
| 1701 | { | 1710 | { |
| 1702 | register Lisp_Object window; | 1711 | register Lisp_Object window, tem; |
| 1703 | 1712 | ||
| 1704 | buffer = Fget_buffer (buffer); | 1713 | buffer = Fget_buffer (buffer); |
| 1705 | CHECK_BUFFER (buffer, 0); | 1714 | CHECK_BUFFER (buffer, 0); |
| @@ -1722,17 +1731,25 @@ Returns the window displaying BUFFER.") | |||
| 1722 | && (NILP (not_this_window) || !EQ (window, selected_window))) | 1731 | && (NILP (not_this_window) || !EQ (window, selected_window))) |
| 1723 | return window; | 1732 | return window; |
| 1724 | 1733 | ||
| 1734 | /* Certain buffer names get special handling. */ | ||
| 1735 | if (! NILP (Vspecial_display_function)) | ||
| 1736 | { | ||
| 1737 | tem = Fmember (XBUFFER (buffer)->name, Vspecial_display_buffer_names); | ||
| 1738 | if (!NILP (tem)) | ||
| 1739 | return call1 (Vspecial_display_function, buffer); | ||
| 1740 | |||
| 1741 | for (tem = Vspecial_display_regexps; CONSP (tem); tem = XCONS (tem)->cdr) | ||
| 1742 | if (fast_string_match (XCONS (tem)->car, XBUFFER (buffer)->name) >= 0) | ||
| 1743 | return call1 (Vspecial_display_function, buffer); | ||
| 1744 | } | ||
| 1745 | |||
| 1725 | #ifdef MULTI_FRAME | 1746 | #ifdef MULTI_FRAME |
| 1726 | /* If there are no frames open that have more than a minibuffer, | 1747 | /* If there are no frames open that have more than a minibuffer, |
| 1727 | we need to create a new frame. */ | 1748 | we need to create a new frame. */ |
| 1728 | if (pop_up_frames || last_nonminibuf_frame == 0) | 1749 | if (pop_up_frames || last_nonminibuf_frame == 0) |
| 1729 | { | 1750 | { |
| 1730 | window | 1751 | window = Fframe_selected_window (call0 (Vpop_up_frame_function)); |
| 1731 | = Fframe_selected_window (call0 (Vpop_up_frame_function)); | ||
| 1732 | Fset_window_buffer (window, buffer); | 1752 | Fset_window_buffer (window, buffer); |
| 1733 | #if 0 | ||
| 1734 | Fhandle_switch_frame (XWINDOW (window)->frame, Qnil); | ||
| 1735 | #endif | ||
| 1736 | return window; | 1753 | return window; |
| 1737 | } | 1754 | } |
| 1738 | #endif /* MULTI_FRAME */ | 1755 | #endif /* MULTI_FRAME */ |
| @@ -3022,13 +3039,37 @@ work using this function."); | |||
| 3022 | pop_up_frames = 0; | 3039 | pop_up_frames = 0; |
| 3023 | 3040 | ||
| 3024 | DEFVAR_LISP ("pop-up-frame-function", &Vpop_up_frame_function, | 3041 | DEFVAR_LISP ("pop-up-frame-function", &Vpop_up_frame_function, |
| 3025 | "*If non-nil, function to call to handle automatic new frame creation.\n\ | 3042 | "Function to call to handle automatic new frame creation.\n\ |
| 3026 | It is called with no arguments and should return a newly created frame.\n\ | 3043 | It is called with no arguments and should return a newly created frame.\n\ |
| 3027 | \n\ | 3044 | \n\ |
| 3028 | A typical value might be `(lambda () (new-frame pop-up-frame-alist))'\n\ | 3045 | A typical value might be `(lambda () (new-frame pop-up-frame-alist))'\n\ |
| 3029 | where `pop-up-frame-alist' would hold the default frame parameters."); | 3046 | where `pop-up-frame-alist' would hold the default frame parameters."); |
| 3030 | Vpop_up_frame_function = Qnil; | 3047 | Vpop_up_frame_function = Qnil; |
| 3031 | 3048 | ||
| 3049 | DEFVAR_LISP ("special-display-buffer-names", &Vspecial_display_buffer_names, | ||
| 3050 | "*List of buffer names that should have their own special frames.\n\ | ||
| 3051 | Displaying a buffer whose name is in this list makes a special frame for it\n\ | ||
| 3052 | using `special-display-function'. See also `special-display-regexps'."); | ||
| 3053 | Vspecial_display_buffer_names = Qnil; | ||
| 3054 | |||
| 3055 | DEFVAR_LISP ("special-display-regexps", &Vspecial_display_regexps, | ||
| 3056 | "*List of regexps saying which buffers should have their own special frames.\n\ | ||
| 3057 | If a buffer name matches one of these regexps, it gets its own frame.\n\ | ||
| 3058 | Displaying a buffer whose name is in this list makes a special frame for it\n\ | ||
| 3059 | using `special-display-function'. See also `special-display-buffer-names'."); | ||
| 3060 | Vspecial_display_regexps = Qnil; | ||
| 3061 | |||
| 3062 | DEFVAR_LISP ("special-display-function", &Vspecial_display_function, | ||
| 3063 | "Function to call to make a new frame for a special buffer.\n\ | ||
| 3064 | It is called with one argument, the buffer,\n\ | ||
| 3065 | and should return a window displaying that buffer.\n\ | ||
| 3066 | The default value makes a separate frame for the buffer,\n\ | ||
| 3067 | using `special-display-alist' to specify the frame parameters.\n\ | ||
| 3068 | \n\ | ||
| 3069 | A buffer is special if its is listed in `special-display-buffer-names'\n\ | ||
| 3070 | or matches a regexp in `special-display-regexps'."); | ||
| 3071 | Vspecial_display_function = Qnil; | ||
| 3072 | |||
| 3032 | DEFVAR_BOOL ("pop-up-windows", &pop_up_windows, | 3073 | DEFVAR_BOOL ("pop-up-windows", &pop_up_windows, |
| 3033 | "*Non-nil means display-buffer should make new windows."); | 3074 | "*Non-nil means display-buffer should make new windows."); |
| 3034 | pop_up_windows = 1; | 3075 | pop_up_windows = 1; |