+ *dp = display->next_display;
+
+ if (display->keyboard_coding)
+ xfree (display->keyboard_coding);
+ if (display->terminal_coding)
+ xfree (display->terminal_coding);
+ if (display->name)
+ xfree (display->name);
+
+ bzero (display, sizeof (struct display));
+ xfree (display);
+}
+
+DEFUN ("delete-display", Fdelete_display, Sdelete_display, 0, 2, 0,
+ doc: /* Delete DISPLAY by deleting all frames on it and closing the device.
+DISPLAY may be a display id, a frame, or nil for the display
+device of the current frame.
+
+Normally, you may not delete a display if all other displays are suspended,
+but if the second argument FORCE is non-nil, you may do so. */)
+ (display, force)
+ Lisp_Object display, force;
+{
+ struct display *d, *p;
+
+ d = get_display (display);
+
+ if (!d)
+ return Qnil;
+
+ p = display_list;
+ while (p && (p == d || !DISPLAY_ACTIVE_P (p)))
+ p = p->next_display;
+
+ if (NILP (force) && !p)
+ error ("Attempt to delete the sole active display");
+
+ if (d->delete_display_hook)
+ (*d->delete_display_hook) (d);
+ else
+ delete_display (d);
+
+ return Qnil;
+}
+
+DEFUN ("display-live-p", Fdisplay_live_p, Sdisplay_live_p, 1, 1, 0,
+ doc: /* Return non-nil if OBJECT is a display which has not been deleted.
+Value is nil if OBJECT is not a live display.
+If object is a live display, the return value indicates what sort of
+output device it uses. See the documentation of `framep' for possible
+return values.
+
+Displays are represented by their integer identifiers. */)
+ (object)
+ Lisp_Object object;
+{
+ struct display *d;
+
+ if (!INTEGERP (object))
+ return Qnil;
+
+ d = get_display (object);
+
+ if (!d)
+ return Qnil;
+
+ switch (d->type)
+ {
+ case output_initial: /* The initial frame is like a termcap frame. */
+ case output_termcap:
+ return Qt;
+ case output_x_window:
+ return Qx;
+ case output_w32:
+ return Qw32;
+ case output_msdos_raw:
+ return Qpc;
+ case output_mac:
+ return Qmac;
+ default:
+ abort ();
+ }
+}
+
+DEFUN ("display-list", Fdisplay_list, Sdisplay_list, 0, 0, 0,
+ doc: /* Return a list of all displays.
+Displays are represented by their integer identifiers. */)
+ ()
+{
+ Lisp_Object displays = Qnil;
+ struct display *d;
+
+ for (d = display_list; d; d = d->next_display)
+ displays = Fcons (make_number (d->id), displays);