diff options
| author | Gerd Moellmann | 2000-08-02 20:17:01 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-08-02 20:17:01 +0000 |
| commit | 9c3da604d1f15bc23bf47a68fce38188e23b022a (patch) | |
| tree | 16f12676344491320246ea2529f3960822235ebd | |
| parent | c1848a97e5691d7b848163077b030de4a04c5a5e (diff) | |
| download | emacs-9c3da604d1f15bc23bf47a68fce38188e23b022a.tar.gz emacs-9c3da604d1f15bc23bf47a68fce38188e23b022a.zip | |
(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.
| -rw-r--r-- | src/window.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/window.c b/src/window.c index b90d8b40806..6dbe93be67e 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -126,6 +126,10 @@ int pop_up_windows; | |||
| 126 | 126 | ||
| 127 | int pop_up_frames; | 127 | int pop_up_frames; |
| 128 | 128 | ||
| 129 | /* Nonzero means reuse existing frames for displaying buffers. */ | ||
| 130 | |||
| 131 | int display_buffer_reuse_frames; | ||
| 132 | |||
| 129 | /* Non-nil means use this function instead of default */ | 133 | /* Non-nil means use this function instead of default */ |
| 130 | 134 | ||
| 131 | Lisp_Object Vpop_up_frame_function; | 135 | Lisp_Object Vpop_up_frame_function; |
| @@ -2724,6 +2728,8 @@ unless the window is the selected window and the optional second\n\ | |||
| 2724 | argument NOT-THIS-WINDOW is non-nil (interactively, with prefix arg).\n\ | 2728 | argument NOT-THIS-WINDOW is non-nil (interactively, with prefix arg).\n\ |
| 2725 | If `pop-up-frames' is non-nil, make a new frame if no window shows BUFFER.\n\ | 2729 | If `pop-up-frames' is non-nil, make a new frame if no window shows BUFFER.\n\ |
| 2726 | Returns the window displaying BUFFER.\n\ | 2730 | Returns the window displaying BUFFER.\n\ |
| 2731 | If `display-reuse-frames' is non-nil, and another frame is currently\n\ | ||
| 2732 | displaying BUFFER, then simply raise that frame.\n\ | ||
| 2727 | \n\ | 2733 | \n\ |
| 2728 | The variables `special-display-buffer-names', `special-display-regexps',\n\ | 2734 | The variables `special-display-buffer-names', `special-display-regexps',\n\ |
| 2729 | `same-window-buffer-names', and `same-window-regexps' customize how certain\n\ | 2735 | `same-window-buffer-names', and `same-window-regexps' customize how certain\n\ |
| @@ -2735,7 +2741,7 @@ If FRAME is t, search all frames.\n\ | |||
| 2735 | If FRAME is a frame, search only that frame.\n\ | 2741 | If FRAME is a frame, search only that frame.\n\ |
| 2736 | If FRAME is nil, search only the selected frame\n\ | 2742 | If FRAME is nil, search only the selected frame\n\ |
| 2737 | (actually the last nonminibuffer frame),\n\ | 2743 | (actually the last nonminibuffer frame),\n\ |
| 2738 | unless `pop-up-frames' is non-nil,\n\ | 2744 | unless `pop-up-frames' or `display-reuse-frames' is non-nil,\n\ |
| 2739 | which means search visible and iconified frames.") | 2745 | which means search visible and iconified frames.") |
| 2740 | (buffer, not_this_window, frame) | 2746 | (buffer, not_this_window, frame) |
| 2741 | register Lisp_Object buffer, not_this_window, frame; | 2747 | register Lisp_Object buffer, not_this_window, frame; |
| @@ -2766,21 +2772,22 @@ If FRAME is nil, search only the selected frame\n\ | |||
| 2766 | } | 2772 | } |
| 2767 | } | 2773 | } |
| 2768 | 2774 | ||
| 2769 | /* If pop_up_frames, | 2775 | /* If the user wants pop-up-frames or display-reuse-frames, then |
| 2770 | look for a window showing BUFFER on any visible or iconified frame. | 2776 | look for a window showing BUFFER on any visible or iconified frame. |
| 2771 | Otherwise search only the current frame. */ | 2777 | Otherwise search only the current frame. */ |
| 2772 | if (! NILP (frame)) | 2778 | if (! NILP (frame)) |
| 2773 | tem = frame; | 2779 | tem = frame; |
| 2774 | else if (pop_up_frames || last_nonminibuf_frame == 0) | 2780 | else if (pop_up_frames |
| 2781 | || display_buffer_reuse_frames | ||
| 2782 | || last_nonminibuf_frame == 0) | ||
| 2775 | XSETFASTINT (tem, 0); | 2783 | XSETFASTINT (tem, 0); |
| 2776 | else | 2784 | else |
| 2777 | XSETFRAME (tem, last_nonminibuf_frame); | 2785 | XSETFRAME (tem, last_nonminibuf_frame); |
| 2786 | |||
| 2778 | window = Fget_buffer_window (buffer, tem); | 2787 | window = Fget_buffer_window (buffer, tem); |
| 2779 | if (!NILP (window) | 2788 | if (!NILP (window) |
| 2780 | && (NILP (not_this_window) || !EQ (window, selected_window))) | 2789 | && (NILP (not_this_window) || !EQ (window, selected_window))) |
| 2781 | { | 2790 | return display_buffer_1 (window); |
| 2782 | return display_buffer_1 (window); | ||
| 2783 | } | ||
| 2784 | 2791 | ||
| 2785 | /* Certain buffer names get special handling. */ | 2792 | /* Certain buffer names get special handling. */ |
| 2786 | if (!NILP (Vspecial_display_function) && NILP (swp)) | 2793 | if (!NILP (Vspecial_display_function) && NILP (swp)) |
| @@ -5364,6 +5371,11 @@ work using this function."); | |||
| 5364 | "*Non-nil means `display-buffer' should make a separate frame."); | 5371 | "*Non-nil means `display-buffer' should make a separate frame."); |
| 5365 | pop_up_frames = 0; | 5372 | pop_up_frames = 0; |
| 5366 | 5373 | ||
| 5374 | DEFVAR_BOOL ("display-buffer-reuse-frames", &display_buffer_reuse_frames, | ||
| 5375 | "*Non-nil means `display-buffer' should reuse frames. | ||
| 5376 | If the buffer in question is already displayed in a frame, raise that frame."); | ||
| 5377 | display_buffer_reuse_frames = 0; | ||
| 5378 | |||
| 5367 | DEFVAR_LISP ("pop-up-frame-function", &Vpop_up_frame_function, | 5379 | DEFVAR_LISP ("pop-up-frame-function", &Vpop_up_frame_function, |
| 5368 | "Function to call to handle automatic new frame creation.\n\ | 5380 | "Function to call to handle automatic new frame creation.\n\ |
| 5369 | It is called with no arguments and should return a newly created frame.\n\ | 5381 | It is called with no arguments and should return a newly created frame.\n\ |