# HG changeset patch # User Gerd Moellmann # Date 965247421 0 # Node ID e4ba830b426d3212b22a28dd6abf704de0dde606 # Parent 16a291eedbd89b237a16d2306df740529585a1da (display_buffer_reuse_frames): New variable. (Fdisplay_buffer): If display_buffer_reuse_frames is set, reuse frames displaying BUFFER. (syms_of_window): Define Lisp variable display-buffer-reuse-frames. diff -r 16a291eedbd8 -r e4ba830b426d src/window.c --- a/src/window.c Wed Aug 02 20:16:40 2000 +0000 +++ b/src/window.c Wed Aug 02 20:17:01 2000 +0000 @@ -126,6 +126,10 @@ int pop_up_frames; +/* Nonzero means reuse existing frames for displaying buffers. */ + +int display_buffer_reuse_frames; + /* Non-nil means use this function instead of default */ Lisp_Object Vpop_up_frame_function; @@ -2724,6 +2728,8 @@ argument NOT-THIS-WINDOW is non-nil (interactively, with prefix arg).\n\ If `pop-up-frames' is non-nil, make a new frame if no window shows BUFFER.\n\ Returns the window displaying BUFFER.\n\ +If `display-reuse-frames' is non-nil, and another frame is currently\n\ +displaying BUFFER, then simply raise that frame.\n\ \n\ The variables `special-display-buffer-names', `special-display-regexps',\n\ `same-window-buffer-names', and `same-window-regexps' customize how certain\n\ @@ -2735,7 +2741,7 @@ If FRAME is a frame, search only that frame.\n\ If FRAME is nil, search only the selected frame\n\ (actually the last nonminibuffer frame),\n\ - unless `pop-up-frames' is non-nil,\n\ + unless `pop-up-frames' or `display-reuse-frames' is non-nil,\n\ which means search visible and iconified frames.") (buffer, not_this_window, frame) register Lisp_Object buffer, not_this_window, frame; @@ -2766,21 +2772,22 @@ } } - /* If pop_up_frames, + /* If the user wants pop-up-frames or display-reuse-frames, then look for a window showing BUFFER on any visible or iconified frame. Otherwise search only the current frame. */ if (! NILP (frame)) tem = frame; - else if (pop_up_frames || last_nonminibuf_frame == 0) + else if (pop_up_frames + || display_buffer_reuse_frames + || last_nonminibuf_frame == 0) XSETFASTINT (tem, 0); else XSETFRAME (tem, last_nonminibuf_frame); + window = Fget_buffer_window (buffer, tem); if (!NILP (window) && (NILP (not_this_window) || !EQ (window, selected_window))) - { - return display_buffer_1 (window); - } + return display_buffer_1 (window); /* Certain buffer names get special handling. */ if (!NILP (Vspecial_display_function) && NILP (swp)) @@ -5364,6 +5371,11 @@ "*Non-nil means `display-buffer' should make a separate frame."); pop_up_frames = 0; + DEFVAR_BOOL ("display-buffer-reuse-frames", &display_buffer_reuse_frames, + "*Non-nil means `display-buffer' should reuse frames. +If the buffer in question is already displayed in a frame, raise that frame."); + display_buffer_reuse_frames = 0; + DEFVAR_LISP ("pop-up-frame-function", &Vpop_up_frame_function, "Function to call to handle automatic new frame creation.\n\ It is called with no arguments and should return a newly created frame.\n\