=== modified file 'src/w32fns.c' --- src/w32fns.c 2014-05-06 16:00:30 +0000 +++ src/w32fns.c 2014-05-17 22:15:56 +0000 @@ -5184,13 +5184,20 @@ struct w32_display_info * x_display_info_for_name (Lisp_Object name) { + Lisp_Object names; struct w32_display_info *dpyinfo; CHECK_STRING (name); - for (dpyinfo = &one_w32_display_info; dpyinfo; dpyinfo = dpyinfo->next) - if (!NILP (Fstring_equal (XCAR (dpyinfo->name_list_element), name))) - return dpyinfo; + for (dpyinfo = &one_w32_display_info, names = w32_display_name_list; + dpyinfo && !NILP (w32_display_name_list); + dpyinfo = dpyinfo->next, names = XCDR (names)) + { + Lisp_Object tem; + tem = Fstring_equal (XCAR (XCAR (names)), name); + if (!NILP (tem)) + return dpyinfo; + } /* Use this general default value to start with. */ Vx_resource_name = Vinvocation_name; @@ -5325,11 +5332,11 @@ doc: /* Return the list of display names that Emacs has connections to. */) (void) { - Lisp_Object result = Qnil; - struct w32_display_info *wdi; + Lisp_Object tail, result; - for (wdi = x_display_list; wdi; wdi = wdi->next) - result = Fcons (XCAR (wdi->name_list_element), result); + result = Qnil; + for (tail = w32_display_name_list; CONSP (tail); tail = XCDR (tail)) + result = Fcons (XCAR (XCAR (tail)), result); return result; } === modified file 'src/w32term.c' --- src/w32term.c 2014-04-16 14:00:39 +0000 +++ src/w32term.c 2014-05-17 22:15:56 +0000 @@ -100,6 +100,13 @@ struct w32_display_info one_w32_display_info; struct w32_display_info *x_display_list; +/* This is a list of cons cells, each of the form (NAME . FONT-LIST-CACHE), + one for each element of w32_display_list and in the same order. + NAME is the name of the frame. + FONT-LIST-CACHE records previous values returned by x-list-fonts. */ +Lisp_Object w32_display_name_list; + + #if _WIN32_WINNT < 0x0500 && !defined(_W64) /* Pre Windows 2000, this was not available, but define it here so that Emacs compiled on such a platform will run on newer versions. @@ -6161,7 +6168,11 @@ memset (dpyinfo, 0, sizeof (*dpyinfo)); - dpyinfo->name_list_element = Fcons (display_name, Qnil); + /* Put it on w32_display_name_list. */ + w32_display_name_list = Fcons (Fcons (display_name, Qnil), + w32_display_name_list); + dpyinfo->name_list_element = XCAR (w32_display_name_list); + dpyinfo->w32_id_name = xmalloc (SCHARS (Vinvocation_name) + SCHARS (Vsystem_name) + 2); sprintf (dpyinfo->w32_id_name, "%s@%s", @@ -6410,7 +6421,27 @@ void x_delete_display (struct w32_display_info *dpyinfo) { - /* FIXME: the only display info apparently can't be deleted. */ + /* Discard this display from w32_display_name_list and w32_display_list. + We can't use Fdelq because that can quit. */ + if (! NILP (w32_display_name_list) + && EQ (XCAR (w32_display_name_list), dpyinfo->name_list_element)) + w32_display_name_list = XCDR (w32_display_name_list); + else + { + Lisp_Object tail; + + tail = w32_display_name_list; + while (CONSP (tail) && CONSP (XCDR (tail))) + { + if (EQ (XCAR (XCDR (tail)), dpyinfo->name_list_element)) + { + XSETCDR (tail, XCDR (XCDR (tail))); + break; + } + tail = XCDR (tail); + } + } + /* free palette table */ { struct w32_palette_entry * plist; @@ -6547,6 +6578,9 @@ void syms_of_w32term (void) { + staticpro (&w32_display_name_list); + w32_display_name_list = Qnil; + DEFSYM (Qvendor_specific_keysyms, "vendor-specific-keysyms"); DEFSYM (Qadded, "added"); === modified file 'src/w32term.h' --- src/w32term.h 2014-02-04 16:13:51 +0000 +++ src/w32term.h 2014-05-17 22:15:56 +0000 @@ -71,7 +71,8 @@ /* The generic display parameters corresponding to this w32 display. */ struct terminal *terminal; - /* This is a cons cell of the form (NAME . FONT-LIST-CACHE). */ + /* This is a cons cell of the form (NAME . FONT-LIST-CACHE). + The same cons cell also appears in x_display_name_list. */ Lisp_Object name_list_element; /* Number of frames that are on this display. */ @@ -200,6 +201,12 @@ extern struct w32_display_info *x_display_list; extern struct w32_display_info one_w32_display_info; +/* This is a list of cons cells, each of the form (NAME . FONT-LIST-CACHE), + one for each element of w32_display_list and in the same order. + NAME is the name of the frame. + FONT-LIST-CACHE records previous values returned by x-list-fonts. */ +extern Lisp_Object w32_display_name_list; + extern struct frame *x_window_to_frame (struct w32_display_info *, HWND); struct w32_display_info *x_display_info_for_name (Lisp_Object);