aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-04-23 21:37:15 +0000
committerRichard M. Stallman1994-04-23 21:37:15 +0000
commita90712c210f563f2128cdae74295f014a5d8b9a1 (patch)
treee50327ee3f94ef63dc0520469e9d2f8d0a835347 /src
parent4a7cfafcf713410e08089e706bddd02b06c3bb70 (diff)
downloademacs-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.c55
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. */
80Lisp_Object Vdisplay_buffer_function; 80Lisp_Object Vdisplay_buffer_function;
81 81
82/* List of buffer *names* for buffers that should have their own frames. */
83Lisp_Object Vspecial_display_buffer_names;
84
85/* List of regexps for buffer names that should have their own frames. */
86Lisp_Object Vspecial_display_regexps;
87
88/* Function to pop up a special frame. */
89Lisp_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. */
84int split_height_threshold; 93int 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\
3026It is called with no arguments and should return a newly created frame.\n\ 3043It is called with no arguments and should return a newly created frame.\n\
3027\n\ 3044\n\
3028A typical value might be `(lambda () (new-frame pop-up-frame-alist))'\n\ 3045A typical value might be `(lambda () (new-frame pop-up-frame-alist))'\n\
3029where `pop-up-frame-alist' would hold the default frame parameters."); 3046where `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\
3051Displaying a buffer whose name is in this list makes a special frame for it\n\
3052using `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\
3057If a buffer name matches one of these regexps, it gets its own frame.\n\
3058Displaying a buffer whose name is in this list makes a special frame for it\n\
3059using `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\
3064It is called with one argument, the buffer,\n\
3065and should return a window displaying that buffer.\n\
3066The default value makes a separate frame for the buffer,\n\
3067using `special-display-alist' to specify the frame parameters.\n\
3068\n\
3069A buffer is special if its is listed in `special-display-buffer-names'\n\
3070or 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;