+\f
+/* Deiconify the frame containing the window WINDOW,
+ unless it is the selected frame;
+ then return WINDOW.
+
+ The reason for the exception for the selected frame
+ is that it seems better not to change the selected frames visibility
+ merely because of displaying a different buffer in it.
+ The deiconification is useful when a buffer gets shown in
+ another frame that you were not using lately. */
+
+static Lisp_Object
+display_buffer_1 (window)
+ Lisp_Object window;
+{
+ FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (window)));
+ FRAME_SAMPLE_VISIBILITY (f);
+ if (f != selected_frame)
+ {
+ if (FRAME_ICONIFIED_P (f))
+ Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
+ else if (FRAME_VISIBLE_P (f))
+ Fraise_frame (WINDOW_FRAME (XWINDOW (window)));
+ }
+ return window;
+}
+
+DEFUN ("special-display-p", Fspecial_display_p, Sspecial_display_p, 1, 1, 0,
+ "Returns non-nil if a buffer named BUFFER-NAME would be created specially.\n\
+The value is actually t if the frame should be called with default frame\n\
+parameters, and a list of frame parameters if they were specified.\n\
+See `special-display-buffer-names', and `special-display-regexps'.")
+ (buffer_name)
+ Lisp_Object buffer_name;
+{
+ Lisp_Object tem;
+
+ CHECK_STRING (buffer_name, 1);
+
+ tem = Fmember (buffer_name, Vspecial_display_buffer_names);
+ if (!NILP (tem))
+ return Qt;
+
+ tem = Fassoc (buffer_name, Vspecial_display_buffer_names);
+ if (!NILP (tem))
+ return XCDR (tem);
+
+ for (tem = Vspecial_display_regexps; CONSP (tem); tem = XCDR (tem))
+ {
+ Lisp_Object car = XCAR (tem);
+ if (STRINGP (car)
+ && fast_string_match (car, buffer_name) >= 0)
+ return Qt;
+ else if (CONSP (car)
+ && STRINGP (XCAR (car))
+ && fast_string_match (XCAR (car), buffer_name) >= 0)
+ return XCDR (car);
+ }
+ return Qnil;
+}
+
+DEFUN ("same-window-p", Fsame_window_p, Ssame_window_p, 1, 1, 0,
+ "Returns non-nil if a new buffer named BUFFER-NAME would use the same window.\n\
+See `same-window-buffer-names' and `same-window-regexps'.")
+ (buffer_name)
+ Lisp_Object buffer_name;
+{
+ Lisp_Object tem;
+
+ CHECK_STRING (buffer_name, 1);
+
+ tem = Fmember (buffer_name, Vsame_window_buffer_names);
+ if (!NILP (tem))
+ return Qt;
+
+ tem = Fassoc (buffer_name, Vsame_window_buffer_names);
+ if (!NILP (tem))
+ return Qt;
+
+ for (tem = Vsame_window_regexps; CONSP (tem); tem = XCDR (tem))
+ {
+ Lisp_Object car = XCAR (tem);
+ if (STRINGP (car)
+ && fast_string_match (car, buffer_name) >= 0)
+ return Qt;
+ else if (CONSP (car)
+ && STRINGP (XCAR (car))
+ && fast_string_match (XCAR (car), buffer_name) >= 0)
+ return Qt;
+ }
+ return Qnil;
+}