diff --git a/src/emacs.c b/src/emacs.c index 6929886424f..23e0c6f5318 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2050,6 +2050,10 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem #endif #ifdef HAVE_NS + /* For early calls to ns_lisp_to_color or Fns_list_colors. */ + if (!dump_mode) + ns_init_colors (); + if (!noninteractive) { #ifdef NS_IMPL_COCOA diff --git a/src/nsfns.m b/src/nsfns.m index 646bc26f956..ae8e6e30e66 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -2231,7 +2231,9 @@ font descriptor. If string contains `fontset' and not return build_string (ns_xlfd_to_fontname (SSDATA (name))); } -static void +/* Called in emacs.c to support early calls to ns_lisp_to_color or + Fns_list_colors. */ +void ns_init_colors (void) { NSTRACE ("ns_init_colors"); @@ -2286,8 +2288,6 @@ ns_init_colors (void) } } -static BOOL ns_init_colors_done = NO; - DEFUN ("ns-list-colors", Fns_list_colors, Sns_list_colors, 0, 1, 0, doc: /* Return a list of all available colors. The optional argument FRAME is currently ignored. */) @@ -2298,12 +2298,6 @@ The optional argument FRAME is currently ignored. */) NSColorList *clist; NSAutoreleasePool *pool; - if (ns_init_colors_done == NO) - { - ns_init_colors (); - ns_init_colors_done = YES; - } - if (!NILP (frame)) { CHECK_FRAME (frame); diff --git a/src/nsterm.h b/src/nsterm.h index 7c1ee4cf535..610ca4c4acc 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -1150,6 +1150,7 @@ extern const char *ns_get_pending_menu_title (void); #endif /* Implemented in nsfns.m, published in nsterm.m. */ +extern void ns_init_colors (void); #ifdef __OBJC__ extern void ns_move_tooltip_to_mouse_location (NSPoint); #endif @@ -1161,7 +1162,6 @@ extern void ns_change_tab_bar_height (struct frame *f, int height); extern const char *ns_get_string_resource (void *_rdb, const char *name, const char *class); - /* C access to ObjC functionality. */ extern void ns_release_object (void *obj); extern void ns_retain_object (void *obj);