comparison src/window.c @ 7056:0a18af7eb587

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.
author Richard M. Stallman <rms@gnu.org>
date Sat, 23 Apr 1994 21:37:15 +0000
parents 5137d3777e4a
children 4751ee5f263e
comparison
equal deleted inserted replaced
7055:5e4906d964b8 7056:0a18af7eb587
76 /* Non-nil means use this function instead of default */ 76 /* Non-nil means use this function instead of default */
77 Lisp_Object Vpop_up_frame_function; 77 Lisp_Object Vpop_up_frame_function;
78 78
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
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;
81 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;
85 94
1697 If `pop-up-frames' is non-nil, make a new frame if no window shows BUFFER.\n\ 1706 If `pop-up-frames' is non-nil, make a new frame if no window shows BUFFER.\n\
1698 Returns the window displaying BUFFER.") 1707 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);
1706 1715
1707 if (!NILP (Vdisplay_buffer_function)) 1716 if (!NILP (Vdisplay_buffer_function))
1720 #endif 1729 #endif
1721 if (!NILP (window) 1730 if (!NILP (window)
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 */
1739 1756
1740 if (pop_up_windows 1757 if (pop_up_windows
3020 DEFVAR_BOOL ("pop-up-frames", &pop_up_frames, 3037 DEFVAR_BOOL ("pop-up-frames", &pop_up_frames,
3021 "*Non-nil means `display-buffer' should make a separate frame."); 3038 "*Non-nil means `display-buffer' should make a separate frame.");
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;
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;
3031 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;
3035 3076