Now on revision 112239. ------------------------------------------------------------ revno: 112239 fixes bug: http://debbugs.gnu.org/13783 committer: Paul Eggert branch nick: trunk timestamp: Sat 2013-04-06 23:21:40 -0700 message: Fix --enable-profiling bug introduced by 2013-02-25 change. This bug was introduced by my 2013-02-25 change that simplified data_start configuration. Without this change, on GNU/Linux an Emacs configured with --enable-profiling fails immediately due to a profiler signal. * configure.ac (LD_SWITCH_SYSTEM_TEMACS): Append -pg if profiling and if not on GNU/Linux or FreeBSD. * lib/Makefile.am (AM_CFLAGS): Add $(PROFILING_CFLAGS), so that lib/*.o is profiled too. * src/Makefile.in: Compile with $(PROFILING_CFLAGS), but do not link with these flags. On platforms where special flags are needed when linking temacs, the flags are now in LD_SWITCH_SYSTEM_TEMACS. (ALL_CFLAGS): Remove $(PROFILING_CFLAGS). (.c.o, .m.o): Compile with $(PROFILING_CFLAGS). diff: === modified file 'ChangeLog' --- ChangeLog 2013-04-04 03:46:25 +0000 +++ ChangeLog 2013-04-07 06:21:40 +0000 @@ -1,3 +1,11 @@ +2013-04-07 Paul Eggert + + Fix --enable-profiling bug introduced by 2013-02-25 change (Bug#13783). + * configure.ac (LD_SWITCH_SYSTEM_TEMACS): Append -pg if profiling + and if not on GNU/Linux or FreeBSD. + * lib/Makefile.am (AM_CFLAGS): Add $(PROFILING_CFLAGS), so that + lib/*.o is profiled too. + 2013-03-30 Paul Eggert Merge from gnulib, incorporating: === modified file 'configure.ac' --- configure.ac 2013-03-27 05:13:31 +0000 +++ configure.ac 2013-04-07 06:21:40 +0000 @@ -4185,6 +4185,13 @@ *) LD_SWITCH_SYSTEM_TEMACS= ;; esac +if test x$ac_enable_profiling != x ; then + case $opsys in + *freebsd | gnu-linux) ;; + *) LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS -pg" ;; + esac +fi + AC_SUBST(LD_SWITCH_SYSTEM_TEMACS) ## Common for all window systems === modified file 'lib/Makefile.am' --- lib/Makefile.am 2013-02-01 06:30:51 +0000 +++ lib/Makefile.am 2013-04-07 06:21:40 +0000 @@ -4,7 +4,7 @@ MOSTLYCLEANFILES = noinst_LIBRARIES = -AM_CFLAGS = $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS) +AM_CFLAGS = $(PROFILING_CFLAGS) $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS) DEFAULT_INCLUDES = -I. -I$(top_srcdir)/lib -I../src -I$(top_srcdir)/src include gnulib.mk === modified file 'src/ChangeLog' --- src/ChangeLog 2013-04-07 04:41:19 +0000 +++ src/ChangeLog 2013-04-07 06:21:40 +0000 @@ -1,3 +1,16 @@ +2013-04-07 Paul Eggert + + Fix --enable-profiling bug introduced by 2013-02-25 change (Bug#13783). + This bug was introduced by my 2013-02-25 change that simplified + data_start configuration. Without this change, on GNU/Linux + an Emacs configured with --enable-profiling fails immediately + due to a profiler signal. + * Makefile.in: Compile with $(PROFILING_CFLAGS), but do not link + with these flags. On platforms where special flags are needed + when linking temacs, the flags are now in LD_SWITCH_SYSTEM_TEMACS. + (ALL_CFLAGS): Remove $(PROFILING_CFLAGS). + (.c.o, .m.o): Compile with $(PROFILING_CFLAGS). + 2013-04-07 Dmitry Antipov Get rid of some platform-specific functions examining window === modified file 'src/Makefile.in' --- src/Makefile.in 2013-03-13 18:42:22 +0000 +++ src/Makefile.in 2013-04-07 06:21:40 +0000 @@ -317,7 +317,7 @@ $(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \ $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \ $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \ - $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) $(PROFILING_CFLAGS) \ + $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \ $(LIBGNUTLS_CFLAGS) \ $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS) ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS) @@ -325,10 +325,10 @@ .SUFFIXES: .m .c.o: @$(MKDEPDIR) - $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< + $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $(PROFILING_CFLAGS) $< .m.o: @$(MKDEPDIR) - $(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $< + $(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $(PROFILING_CFLAGS) $< ## lastfile must follow all files whose initialized data areas should ## be dumped as pure by dump-emacs. ------------------------------------------------------------ revno: 112238 committer: Dmitry Antipov branch nick: trunk timestamp: Sun 2013-04-07 08:41:19 +0400 message: Get rid of some platform-specific functions examining window system and its capabilities. This is a partial rework of the 2013-04-05 change. * lisp.h (have_menus_p): Remove prototype. This function is replaced with platform-independent window_system_available. (check_window_system): Move to... * frame.h (decode_window_system_frame, window_system_available): ...here, add new prototypes. * frame.c (window_system_available, decode_window_system_frame): New functions. (check_window_system): Platform-independent now. * xterm.h (x_in_use): Remove declaration. (check_x_frame): * w32term.h (check_x_frame): * nsterm.h (check_x_frame): Remove prototypes. This function is replaced with platform-independent decode_window_system_frame. * msdos.c (have_menus_p): Remove. * nsfns.m (check_window_system, have_menus_p, check_ns_frame): Remove platform-specific functions. Use check_window_system, decode_window_system_frame and check_ns_display_info where appropriate. Minor style and comment tweaks. * w32fns.c (w32_in_use, check_window_system, have_menus_p) (check_x_frame): Likewise. * xfns.c (x_in_use, check_window_system, have_menus_p, check_x_frame): Likewise. * fileio.c, fns.c, font.c, fontset.c, image.c, menu.c, nsmenu.m: * nsselect.m, nsterm.m, w32font.c, w32menu.c, xfaces.c, xgselect.c: * xmenu.c, xselect.c: All related users changed. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-04-05 14:17:55 +0000 +++ src/ChangeLog 2013-04-07 04:41:19 +0000 @@ -1,3 +1,34 @@ +2013-04-07 Dmitry Antipov + + Get rid of some platform-specific functions examining window + system and its capabilities. This is a partial rework of the + 2013-04-05 change. + * lisp.h (have_menus_p): Remove prototype. This function is + replaced with platform-independent window_system_available. + (check_window_system): Move to... + * frame.h (decode_window_system_frame, window_system_available): + ...here, add new prototypes. + * frame.c (window_system_available, decode_window_system_frame): + New functions. + (check_window_system): Platform-independent now. + * xterm.h (x_in_use): Remove declaration. + (check_x_frame): + * w32term.h (check_x_frame): + * nsterm.h (check_x_frame): Remove prototypes. This function + is replaced with platform-independent decode_window_system_frame. + * msdos.c (have_menus_p): Remove. + * nsfns.m (check_window_system, have_menus_p, check_ns_frame): + Remove platform-specific functions. Use check_window_system, + decode_window_system_frame and check_ns_display_info where + appropriate. Minor style and comment tweaks. + * w32fns.c (w32_in_use, check_window_system, have_menus_p) + (check_x_frame): Likewise. + * xfns.c (x_in_use, check_window_system, have_menus_p, check_x_frame): + Likewise. + * fileio.c, fns.c, font.c, fontset.c, image.c, menu.c, nsmenu.m: + * nsselect.m, nsterm.m, w32font.c, w32menu.c, xfaces.c, xgselect.c: + * xmenu.c, xselect.c: All related users changed. + 2013-04-03 Kenichi Handa The following changes is to optimize the code for reading UTF-8 === modified file 'src/fileio.c' --- src/fileio.c 2013-04-02 01:54:56 +0000 +++ src/fileio.c 2013-04-07 04:41:19 +0000 @@ -5816,7 +5816,7 @@ if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) && use_dialog_box && use_file_dialog - && have_menus_p ()) + && window_system_available (SELECTED_FRAME ())) return Qt; #endif return Qnil; === modified file 'src/fns.c' --- src/fns.c 2013-04-02 01:54:56 +0000 +++ src/fns.c 2013-04-07 04:41:19 +0000 @@ -2443,10 +2443,9 @@ CHECK_STRING (prompt); #ifdef HAVE_MENUS - if (FRAME_WINDOW_P (SELECTED_FRAME ()) - && (NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) + if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) && use_dialog_box - && have_menus_p ()) + && window_system_available (SELECTED_FRAME ())) { Lisp_Object pane, menu, obj; redisplay_preserve_echo_area (4); === modified file 'src/font.c' --- src/font.c 2013-04-05 14:07:02 +0000 +++ src/font.c 2013-04-07 04:41:19 +0000 @@ -4844,11 +4844,9 @@ Lisp_Object info; Lisp_Object font_object; - check_window_system (); - if (! FONTP (name)) CHECK_STRING (name); - f = decode_live_frame (frame); + f = decode_window_system_frame (frame); if (STRINGP (name)) { === modified file 'src/fontset.c' --- src/fontset.c 2013-04-05 14:07:02 +0000 +++ src/fontset.c 2013-04-07 04:41:19 +0000 @@ -1209,7 +1209,7 @@ Lisp_Object fontset; int id; - check_window_system (); + check_window_system (NULL); CHECK_STRING (pattern); @@ -1915,8 +1915,7 @@ Lisp_Object val, elt; int c, i, j, k; - check_window_system (); - + check_window_system (NULL); fontset = check_fontset_name (fontset, &frame); /* Recode fontsets realized on FRAME from the base fontset FONTSET === modified file 'src/frame.c' --- src/frame.c 2013-04-05 14:07:02 +0000 +++ src/frame.c 2013-04-07 04:41:19 +0000 @@ -149,6 +149,37 @@ return XFRAME (frame); } +bool +window_system_available (struct frame *f) +{ + if (f) + return FRAME_WINDOW_P (f) || FRAME_MSDOS_P (f); + else +#ifdef HAVE_WINDOW_SYSTEM + return x_display_list != NULL; +#else + return 0; +#endif +} + +struct frame * +decode_window_system_frame (Lisp_Object frame) +{ + struct frame *f = decode_live_frame (frame); + + if (!window_system_available (f)) + error ("Window system frame should be used"); + return f; +} + +void +check_window_system (struct frame *f) +{ + if (!window_system_available (f)) + error (f ? "Window system frame should be used" + : "Window system is not in use or not initialized"); +} + static void set_menu_bar_lines_1 (Lisp_Object window, int n) { @@ -3493,7 +3524,7 @@ (Lisp_Object attribute, Lisp_Object class, Lisp_Object component, Lisp_Object subclass) { - check_window_system (); + check_window_system (NULL); return xrdb_get_resource (check_x_display_info (Qnil)->xrdb, attribute, class, component, subclass); === modified file 'src/frame.h' --- src/frame.h 2013-03-31 05:45:54 +0000 +++ src/frame.h 2013-04-07 04:41:19 +0000 @@ -958,6 +958,7 @@ extern struct frame *last_nonminibuf_frame; extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); +extern struct frame *decode_window_system_frame (Lisp_Object); extern struct frame *decode_live_frame (Lisp_Object); extern struct frame *decode_any_frame (Lisp_Object); extern struct frame *make_initial_frame (void); @@ -968,6 +969,8 @@ struct kboard *, Lisp_Object); #endif /* HAVE_WINDOW_SYSTEM */ +extern bool window_system_available (struct frame *); +extern void check_window_system (struct frame *); extern void frame_make_pointer_invisible (void); extern void frame_make_pointer_visible (void); extern Lisp_Object delete_frame (Lisp_Object, Lisp_Object); === modified file 'src/image.c' --- src/image.c 2013-03-28 06:40:01 +0000 +++ src/image.c 2013-04-07 04:41:19 +0000 @@ -889,7 +889,7 @@ size = Qnil; if (valid_image_p (spec)) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); ptrdiff_t id = lookup_image (f, spec); struct image *img = IMAGE_FROM_ID (f, id); int width = img->width + 2 * img->hmargin; @@ -919,7 +919,7 @@ mask = Qnil; if (valid_image_p (spec)) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); ptrdiff_t id = lookup_image (f, spec); struct image *img = IMAGE_FROM_ID (f, id); if (img->mask) @@ -942,7 +942,7 @@ ext = Qnil; if (valid_image_p (spec)) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); ptrdiff_t id = lookup_image (f, spec); struct image *img = IMAGE_FROM_ID (f, id); ext = img->lisp_data; @@ -1550,7 +1550,7 @@ if (!(EQ (filter, Qnil) || FRAMEP (filter))) clear_image_caches (filter); else - clear_image_cache (check_x_frame (filter), Qt); + clear_image_cache (decode_window_system_frame (filter), Qt); return Qnil; } @@ -1581,7 +1581,7 @@ } } else - uncache_image (check_x_frame (frame), spec); + uncache_image (decode_window_system_frame (frame), spec); return Qnil; } === modified file 'src/lisp.h' --- src/lisp.h 2013-04-05 14:07:02 +0000 +++ src/lisp.h 2013-04-07 04:41:19 +0000 @@ -3765,22 +3765,12 @@ extern char *x_get_keysym_name (int); #endif /* HAVE_WINDOW_SYSTEM */ -#if defined(HAVE_WINDOW_SYSTEM) || defined (MSDOS) -/* Defined in (x|w32)fns.c, nsfns.m, msdos.c. */ -extern void check_window_system (void); -#endif - #ifdef HAVE_LIBXML2 /* Defined in xml.c. */ extern void syms_of_xml (void); extern void xml_cleanup_parser (void); #endif -#ifdef HAVE_MENUS -/* Defined in (x|w32)fns.c, nsfns.m, msdos.c. */ -extern int have_menus_p (void); -#endif - #ifdef HAVE_DBUS /* Defined in dbusbind.c. */ void syms_of_dbusbind (void); === modified file 'src/menu.c' --- src/menu.c 2013-04-05 14:07:02 +0000 +++ src/menu.c 2013-04-07 04:41:19 +0000 @@ -1086,7 +1086,7 @@ { bool get_current_pos_p = 0; - check_window_system (); + check_window_system (SELECTED_FRAME ()); /* Decode the first argument: find the window and the coordinates. */ if (EQ (position, Qt) === modified file 'src/msdos.c' --- src/msdos.c 2013-04-05 14:07:02 +0000 +++ src/msdos.c 2013-04-07 04:41:19 +0000 @@ -2983,11 +2983,6 @@ /* --------------------------- X Menu emulation ---------------------- */ -/* Report availability of menus. */ - -int -have_menus_p (void) { return 1; } - /* Create a brand new menu structure. */ XMenu * === modified file 'src/nsfns.m' --- src/nsfns.m 2013-04-05 14:07:02 +0000 +++ src/nsfns.m 2013-04-07 04:41:19 +0000 @@ -107,43 +107,6 @@ ========================================================================== */ - -void -check_window_system (void) -{ - if (NSApp == nil) - error ("OpenStep is not in use or not initialized"); -} - - -/* Nonzero if we can use mouse menus. */ -int -have_menus_p (void) -{ - return NSApp != nil; -} - - -/* Extract a frame as a FRAME_PTR, defaulting to the selected frame - and checking validity for NS. */ -static FRAME_PTR -check_ns_frame (Lisp_Object frame) -{ - FRAME_PTR f; - - if (NILP (frame)) - f = SELECTED_FRAME (); - else - { - CHECK_LIVE_FRAME (frame); - f = XFRAME (frame); - } - if (! FRAME_NS_P (f)) - error ("non-Nextstep frame used"); - return f; -} - - /* Let the user specify an Nextstep display with a frame. nil stands for the selected frame--or, if that is not an Nextstep frame, the first Nextstep display on the list. */ @@ -1145,8 +1108,6 @@ Lisp_Object tfont, tfontsize; static int desc_ctr = 1; - check_window_system (); - /* x_get_arg modifies parms. */ parms = Fcopy_alist (parms); @@ -1418,7 +1379,7 @@ FRAME nil means use the selected frame. */) (Lisp_Object frame) { - struct frame *f = check_ns_frame (frame); + struct frame *f = decode_window_system_frame (frame); struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); if (dpyinfo->x_focus_frame != f) @@ -1439,18 +1400,8 @@ doc: /* Pop up the font panel. */) (Lisp_Object frame) { - id fm; - struct frame *f; - - check_window_system (); - fm = [NSFontManager sharedFontManager]; - if (NILP (frame)) - f = SELECTED_FRAME (); - else - { - CHECK_FRAME (frame); - f = XFRAME (frame); - } + struct frame *f = decode_window_system_frame (frame); + id fm = [NSFontManager sharedFontManager]; [fm setSelectedFont: ((struct nsfont_info *)f->output_data.ns->font)->nsfont isMultiple: NO]; @@ -1464,17 +1415,7 @@ doc: /* Pop up the color panel. */) (Lisp_Object frame) { - struct frame *f; - - check_window_system (); - if (NILP (frame)) - f = SELECTED_FRAME (); - else - { - CHECK_FRAME (frame); - f = XFRAME (frame); - } - + check_window_system (NULL); [NSApp orderFrontColorPanel: NSApp]; return Qnil; } @@ -1503,7 +1444,7 @@ NSString *initS = NILP (init) || !STRINGP (init) ? nil : [NSString stringWithUTF8String: SSDATA (init)]; - check_window_system (); + check_window_system (NULL); if (fileDelegate == nil) fileDelegate = [EmacsFileDelegate new]; @@ -1594,11 +1535,10 @@ { const char *value; - check_window_system (); + check_window_system (NULL); if (NILP (owner)) owner = build_string([ns_app_name UTF8String]); CHECK_STRING (name); -/*fprintf (stderr, "ns-get-resource checking resource '%s'\n", SSDATA (name)); */ value = ns_get_defaults_value (SSDATA (name)); @@ -1614,7 +1554,7 @@ If VALUE is nil, the default is removed. */) (Lisp_Object owner, Lisp_Object name, Lisp_Object value) { - check_window_system (); + check_window_system (NULL); if (NILP (owner)) owner = build_string ([ns_app_name UTF8String]); CHECK_STRING (name); @@ -1642,7 +1582,7 @@ doc: /* This function is a no-op. It is only present for completeness. */) (Lisp_Object display) { - check_window_system (); + check_ns_display_info (display); /* This function has no real equivalent under NeXTstep. Return nil to indicate this. */ return Qnil; @@ -1692,7 +1632,7 @@ { int num; - check_window_system (); + check_ns_display_info (display); num = [[NSScreen screens] count]; return (num != 0) ? make_number (num) : Qnil; @@ -1706,7 +1646,7 @@ If omitted or nil, the selected frame's display is used. */) (Lisp_Object display) { - check_window_system (); + check_ns_display_info (display); return make_number ((int) ([ns_get_screen (display) frame].size.height/(92.0/25.4))); } @@ -1719,7 +1659,7 @@ If omitted or nil, the selected frame's display is used. */) (Lisp_Object display) { - check_window_system (); + check_ns_display_info (display); return make_number ((int) ([ns_get_screen (display) frame].size.width/(92.0/25.4))); } @@ -1733,7 +1673,7 @@ If omitted or nil, the selected frame's display is used. */) (Lisp_Object display) { - check_window_system (); + check_ns_display_info (display); switch ([ns_get_window (display) backingType]) { case NSBackingStoreBuffered: @@ -1759,7 +1699,8 @@ (Lisp_Object display) { NSWindowDepth depth; - check_window_system (); + + check_ns_display_info (display); depth = [ns_get_screen (display) depth]; if ( depth == NSBestDepth (NSCalibratedWhiteColorSpace, 2, 2, YES, NULL)) @@ -1786,7 +1727,7 @@ If omitted or nil, the selected frame's display is used. */) (Lisp_Object display) { - check_window_system (); + check_ns_display_info (display); switch ([ns_get_window (display) backingType]) { case NSBackingStoreBuffered: @@ -1836,11 +1777,10 @@ DEFUN ("x-close-connection", Fx_close_connection, Sx_close_connection, 1, 1, 0, doc: /* Close the connection to the current Nextstep display server. -The argument DISPLAY is currently ignored. */) +DISPLAY should be a frame, the display name as a string, or a terminal ID. */) (Lisp_Object display) { - check_window_system (); - /*ns_delete_terminal (dpyinfo->terminal); */ + check_ns_display_info (display); [NSApp terminate: NSApp]; return Qnil; } @@ -1865,7 +1805,7 @@ doc: /* Hides all applications other than Emacs. */) (void) { - check_window_system (); + check_window_system (NULL); [NSApp hideOtherApplications: NSApp]; return Qnil; } @@ -1878,7 +1818,7 @@ the active application. */) (Lisp_Object on) { - check_window_system (); + check_window_system (NULL); if (EQ (on, intern ("activate"))) { [NSApp unhide: NSApp]; @@ -1897,7 +1837,7 @@ doc: /* Shows the 'Info' or 'About' panel for Emacs. */) (void) { - check_window_system (); + check_window_system (NULL); [NSApp orderFrontStandardAboutPanel: nil]; return Qnil; } @@ -1975,7 +1915,7 @@ NSMenu *svcs; id delegate; - check_window_system (); + check_window_system (NULL); svcs = [[NSMenu alloc] initWithTitle: @"Services"]; [NSApp setServicesMenu: svcs]; [NSApp registerServicesMenuSendTypes: ns_send_types @@ -2028,7 +1968,7 @@ char *utfStr; CHECK_STRING (service); - check_window_system (); + check_window_system (NULL); utfStr = SSDATA (service); svcName = [NSString stringWithUTF8String: utfStr]; @@ -2152,7 +2092,7 @@ NSEvent *nxev; CHECK_STRING (script); - check_window_system (); + check_window_system (NULL); block_input (); @@ -2201,15 +2141,6 @@ ========================================================================== */ - -/* called from image.c */ -FRAME_PTR -check_x_frame (Lisp_Object frame) -{ - return check_ns_frame (frame); -} - - /* called from frame.c */ struct ns_display_info * check_x_display_info (Lisp_Object frame) @@ -2235,7 +2166,7 @@ /* remove appname prefix; TODO: allow for !="Emacs" */ char *toCheck = class + (!strncmp (class, "Emacs.", 6) ? 6 : 0); const char *res; - check_window_system (); + check_window_system (NULL); if (inhibit_x_resources) /* --quick was passed, so this is a no-op. */ @@ -2305,7 +2236,7 @@ (Lisp_Object color, Lisp_Object frame) { NSColor * col; - check_window_system (); + check_window_system (NULL); return ns_lisp_to_color (color, &col) ? Qnil : Qt; } @@ -2317,7 +2248,7 @@ NSColor * col; CGFloat red, green, blue, alpha; - check_window_system (); + check_window_system (NULL); CHECK_STRING (color); if (ns_lisp_to_color (color, &col)) @@ -2336,7 +2267,8 @@ { NSWindowDepth depth; NSString *colorSpace; - check_window_system (); + + check_ns_display_info (display); depth = [ns_get_screen (display) depth]; colorSpace = NSColorSpaceFromDepth (depth); @@ -2356,7 +2288,8 @@ (Lisp_Object display) { NSWindowDepth depth; - check_window_system (); + + check_ns_display_info (display); depth = [ns_get_screen (display) depth]; return NSBitsPerPixelFromDepth (depth) > 1 ? Qt : Qnil; @@ -2371,7 +2304,7 @@ If omitted or nil, that stands for the selected frame's display. */) (Lisp_Object display) { - check_window_system (); + check_ns_display_info (display); return make_number ((int) [ns_get_screen (display) frame].size.width); } @@ -2384,7 +2317,7 @@ If omitted or nil, that stands for the selected frame's display. */) (Lisp_Object display) { - check_window_system (); + check_ns_display_info (display); return make_number ((int) [ns_get_screen (display) frame].size.height); } @@ -2404,7 +2337,7 @@ NSScreen *screen; NSRect vScreen; - check_window_system (); + check_ns_display_info (display); screen = ns_get_screen (display); if (!screen) return Qnil; @@ -2428,7 +2361,7 @@ If omitted or nil, that stands for the selected frame's display. */) (Lisp_Object display) { - check_window_system (); + check_ns_display_info (display); return make_number (NSBitsPerPixelFromDepth ([ns_get_screen (display) depth])); } @@ -2442,10 +2375,7 @@ If omitted or nil, that stands for the selected frame's display. */) (Lisp_Object display) { - struct ns_display_info *dpyinfo; - check_window_system (); - - dpyinfo = check_ns_display_info (display); + struct ns_display_info *dpyinfo = check_ns_display_info (display); /* We force 24+ bit depths to 24-bit to prevent an overflow. */ return make_number (1 << min (dpyinfo->n_planes, 24)); } @@ -2558,7 +2488,7 @@ CHECK_STRING (string); str = SSDATA (string); - f = check_x_frame (frame); + f = decode_window_system_frame (frame); if (NILP (timeout)) timeout = make_number (5); else === modified file 'src/nsmenu.m' --- src/nsmenu.m 2013-04-05 14:07:02 +0000 +++ src/nsmenu.m 2013-04-07 04:41:19 +0000 @@ -1409,8 +1409,6 @@ NSTRACE (x-popup-dialog); - check_window_system (); - isQ = NILP (header); if (EQ (position, Qt) @@ -1448,6 +1446,8 @@ else CHECK_WINDOW (window); + check_window_system (f); + p.x = (int)f->left_pos + ((int)FRAME_COLUMN_WIDTH (f) * f->text_cols)/2; p.y = (int)f->top_pos + (FRAME_LINE_HEIGHT (f) * f->text_lines)/2; === modified file 'src/nsselect.m' --- src/nsselect.m 2013-04-05 14:07:02 +0000 +++ src/nsselect.m 2013-04-07 04:41:19 +0000 @@ -354,8 +354,7 @@ Lisp_Object successful_p = Qnil, rest; Lisp_Object target_symbol, data; - - check_window_system (); + check_window_system (NULL); CHECK_SYMBOL (selection); if (NILP (value)) error ("selection value may not be nil."); @@ -409,7 +408,7 @@ (Lisp_Object selection, Lisp_Object time_object, Lisp_Object terminal) { id pb; - check_window_system (); + check_window_system (NULL); CHECK_SYMBOL (selection); if (NILP (assq_no_quit (selection, Vselection_alist))) return Qnil; @@ -436,7 +435,7 @@ id pb; NSArray *types; - check_window_system (); + check_window_system (NULL); CHECK_SYMBOL (selection); if (EQ (selection, Qnil)) selection = QPRIMARY; if (EQ (selection, Qt)) selection = QSECONDARY; @@ -464,7 +463,7 @@ On Nextstep, TERMINAL is unused. */) (Lisp_Object selection, Lisp_Object terminal) { - check_window_system (); + check_window_system (NULL); CHECK_SYMBOL (selection); if (EQ (selection, Qnil)) selection = QPRIMARY; if (EQ (selection, Qt)) selection = QSECONDARY; @@ -492,7 +491,7 @@ { Lisp_Object val; - check_window_system (); + check_window_system (NULL); CHECK_SYMBOL (selection_name); CHECK_SYMBOL (target_type); val = ns_get_local_selection (selection_name, target_type); @@ -516,7 +515,7 @@ (Lisp_Object selection) { id pb; - check_window_system (); + check_window_system (NULL); pb = ns_symbol_to_pb (selection); return pb != nil ? ns_string_from_pasteboard (pb) : Qnil; } @@ -529,7 +528,7 @@ (Lisp_Object selection, Lisp_Object string) { id pb; - check_window_system (); + check_window_system (NULL); pb = ns_symbol_to_pb (selection); if (pb != nil) ns_string_to_pasteboard (pb, string); return Qnil; === modified file 'src/nsterm.h' --- src/nsterm.h 2013-04-05 14:07:02 +0000 +++ src/nsterm.h 2013-04-07 04:41:19 +0000 @@ -577,8 +577,6 @@ extern struct ns_display_info *ns_display_info_for_name (Lisp_Object name); struct ns_display_info *check_x_display_info (Lisp_Object frame); -FRAME_PTR check_x_frame (Lisp_Object frame); - struct ns_output { === modified file 'src/nsterm.m' --- src/nsterm.m 2013-04-05 14:07:02 +0000 +++ src/nsterm.m 2013-04-07 04:41:19 +0000 @@ -1012,8 +1012,9 @@ Bring window to foreground and make it active -------------------------------------------------------------------------- */ { - NSView *view = FRAME_NS_VIEW (f); - check_window_system (); + NSView *view; + check_window_system (f); + view = FRAME_NS_VIEW (f); block_input (); if (FRAME_VISIBLE_P (f)) [[view window] makeKeyAndOrderFront: NSApp]; @@ -1027,8 +1028,9 @@ Send window to back -------------------------------------------------------------------------- */ { - NSView *view = FRAME_NS_VIEW (f); - check_window_system (); + NSView *view; + check_window_system (f); + view = FRAME_NS_VIEW (f); block_input (); [[view window] orderBack: NSApp]; unblock_input (); @@ -1131,9 +1133,10 @@ External: Hide the window (X11 semantics) -------------------------------------------------------------------------- */ { - NSView * view = FRAME_NS_VIEW (f); + NSView *view; NSTRACE (x_make_frame_invisible); - check_window_system (); + check_window_system (f); + view = FRAME_NS_VIEW (f); [[view window] orderOut: NSApp]; SET_FRAME_VISIBLE (f, 0); SET_FRAME_ICONIFIED (f, 0); @@ -1146,10 +1149,13 @@ External: Iconify window -------------------------------------------------------------------------- */ { - NSView * view = FRAME_NS_VIEW (f); - struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); + NSView *view; + struct ns_display_info *dpyinfo; + NSTRACE (x_iconify_frame); - check_window_system (); + check_window_system (f); + view = FRAME_NS_VIEW (f); + dpyinfo = FRAME_NS_DISPLAY_INFO (f); if (dpyinfo->x_highlight_frame == f) dpyinfo->x_highlight_frame = 0; @@ -1174,11 +1180,15 @@ void x_free_frame_resources (struct frame *f) { - NSView *view = FRAME_NS_VIEW (f); - struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); - Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); + NSView *view; + struct ns_display_info *dpyinfo; + Mouse_HLInfo *hlinfo; + NSTRACE (x_free_frame_resources); - check_window_system (); + check_window_system (f); + view = FRAME_NS_VIEW (f); + dpyinfo = FRAME_NS_DISPLAY_INFO (f); + hlinfo = MOUSE_HL_INFO (f); [(EmacsView *)view setWindowClosing: YES]; /* may not have been informed */ @@ -1219,7 +1229,7 @@ -------------------------------------------------------------------------- */ { NSTRACE (x_destroy_window); - check_window_system (); + check_window_system (f); x_free_frame_resources (f); ns_window_num--; } === modified file 'src/w32fns.c' --- src/w32fns.c 2013-04-05 14:07:02 +0000 +++ src/w32fns.c 2013-04-07 04:41:19 +0000 @@ -95,10 +95,6 @@ #define IDC_HAND MAKEINTRESOURCE(32649) #endif -/* Nonzero if using Windows. */ - -static int w32_in_use; - Lisp_Object Qsuppress_icon; Lisp_Object Qundefined_color; Lisp_Object Qcancel_timer; @@ -239,37 +235,6 @@ static unsigned int sound_type = 0xFFFFFFFF; #define MB_EMACS_SILENT (0xFFFFFFFF - 1) - -/* Error if we are not connected to MS-Windows. */ -void -check_window_system (void) -{ - if (! w32_in_use) - error ("MS-Windows not in use or not initialized"); -} - -/* Nonzero if we can use mouse menus. - You should not call this unless HAVE_MENUS is defined. */ - -int -have_menus_p (void) -{ - return w32_in_use; -} - -/* Extract a frame as a FRAME_PTR, defaulting to the selected frame - and checking validity for W32. */ - -FRAME_PTR -check_x_frame (Lisp_Object frame) -{ - struct frame *f = decode_live_frame (frame); - - if (! FRAME_W32_P (f)) - error ("Non-W32 frame used"); - return f; -} - /* Let the user specify a display with a frame. nil stands for the selected frame--or, if that is not a w32 frame, the first display on the list. */ @@ -4567,7 +4532,7 @@ doc: /* Give FRAME input focus, raising to foreground if necessary. */) (Lisp_Object frame) { - x_focus_on_frame (check_x_frame (frame)); + x_focus_on_frame (decode_window_system_frame (frame)); return Qnil; } @@ -4578,7 +4543,7 @@ (Lisp_Object color, Lisp_Object frame) { XColor foo; - FRAME_PTR f = check_x_frame (frame); + FRAME_PTR f = decode_window_system_frame (frame); CHECK_STRING (color); @@ -4593,7 +4558,7 @@ (Lisp_Object color, Lisp_Object frame) { XColor foo; - FRAME_PTR f = check_x_frame (frame); + FRAME_PTR f = decode_window_system_frame (frame); CHECK_STRING (color); @@ -4911,7 +4876,6 @@ if (dpyinfo == 0) error ("Cannot connect to server %s", SDATA (name)); - w32_in_use = 1; XSETFASTINT (Vwindow_system_version, w32_major_version); return dpyinfo; @@ -4941,7 +4905,7 @@ /* If initialization has already been done, return now to avoid overwriting critical parts of one_w32_display_info. */ - if (w32_in_use) + if (window_system_available (NULL)) return Qnil; if (! NILP (xrm_string)) @@ -5010,8 +4974,6 @@ error ("Cannot connect to server %s", SDATA (display)); } - w32_in_use = 1; - XSETFASTINT (Vwindow_system_version, w32_major_version); return Qnil; } @@ -5095,7 +5057,7 @@ (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); Atom prop_atom; CHECK_STRING (prop); @@ -5121,7 +5083,7 @@ FRAME nil or omitted means use the selected frame. Value is PROP. */) (Lisp_Object prop, Lisp_Object frame) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); Atom prop_atom; CHECK_STRING (prop); @@ -5157,7 +5119,7 @@ (Lisp_Object prop, Lisp_Object frame, Lisp_Object type, Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); Atom prop_atom; int rc; Lisp_Object prop_value = Qnil; @@ -5358,8 +5320,6 @@ Lisp_Object buffer; struct buffer *old_buffer; - check_window_system (); - /* Use this general default value to start with until we know if this frame has a specified name. */ Vx_resource_name = Vinvocation_name; @@ -5703,7 +5663,7 @@ GCPRO4 (string, parms, frame, timeout); CHECK_STRING (string); - f = check_x_frame (frame); + f = decode_window_system_frame (frame); if (NILP (timeout)) timeout = make_number (5); else @@ -6354,7 +6314,7 @@ If optional parameter FRAME is not specified, use selected frame. */) (Lisp_Object command, Lisp_Object frame) { - FRAME_PTR f = check_x_frame (frame); + FRAME_PTR f = decode_window_system_frame (frame); CHECK_NUMBER (command); @@ -7312,8 +7272,6 @@ syms_of_w32fns (void) { globals_of_w32fns (); - /* This is zero if not using MS-Windows. */ - w32_in_use = 0; track_mouse_window = NULL; w32_visible_system_caret_hwnd = NULL; === modified file 'src/w32font.c' --- src/w32font.c 2013-03-20 09:56:19 +0000 +++ src/w32font.c 2013-04-07 04:41:19 +0000 @@ -2467,7 +2467,7 @@ in the font selection dialog. */) (Lisp_Object frame, Lisp_Object exclude_proportional) { - FRAME_PTR f = check_x_frame (frame); + FRAME_PTR f = decode_window_system_frame (frame); CHOOSEFONT cf; LOGFONT lf; TEXTMETRIC tm; === modified file 'src/w32menu.c' --- src/w32menu.c 2013-04-05 14:07:02 +0000 +++ src/w32menu.c 2013-04-07 04:41:19 +0000 @@ -140,8 +140,6 @@ FRAME_PTR f = NULL; Lisp_Object window; - check_window_system (); - /* Decode the first argument: find the window or frame to use. */ if (EQ (position, Qt) || (CONSP (position) && (EQ (XCAR (position), Qmenu_bar) @@ -194,6 +192,8 @@ but I don't want to make one now. */ CHECK_WINDOW (window); + check_window_system (f); + #ifndef HAVE_DIALOGS { === modified file 'src/w32term.h' --- src/w32term.h 2013-04-05 14:07:02 +0000 +++ src/w32term.h 2013-04-07 04:41:19 +0000 @@ -739,7 +739,6 @@ struct face; XGCValues *XCreateGC (void *, Window, unsigned long, XGCValues *); -struct frame * check_x_frame (Lisp_Object); typedef DWORD (WINAPI * ClipboardSequence_Proc) (void); typedef BOOL (WINAPI * AppendMenuW_Proc) ( === modified file 'src/xfaces.c' --- src/xfaces.c 2013-04-05 14:07:02 +0000 +++ src/xfaces.c 2013-04-07 04:41:19 +0000 @@ -1634,7 +1634,7 @@ struct frame *f; int size, avgwidth IF_LINT (= 0); - check_window_system (); + check_window_system (NULL); CHECK_STRING (pattern); if (! NILP (maximum)) @@ -1643,8 +1643,8 @@ if (!NILP (width)) CHECK_NUMBER (width); - /* We can't simply call check_x_frame because this function may be - called before any frame is created. */ + /* We can't simply call decode_window_system_frame because + this function may be called before any frame is created. */ f = decode_live_frame (frame); if (! FRAME_WINDOW_P (f)) { @@ -3923,8 +3923,8 @@ struct frame *f; Lisp_Object lface1, lface2; - /* Don't use check_x_frame here because this function is called - before X frames exist. At that time, if FRAME is nil, + /* Don't use decode_window_system_frame here because this function + is called before X frames exist. At that time, if FRAME is nil, selected_frame will be used which is the frame dumped with Emacs. That frame is not an X frame. */ f = EQ (frame, Qt) ? NULL : decode_live_frame (frame); === modified file 'src/xfns.c' --- src/xfns.c 2013-04-05 14:07:02 +0000 +++ src/xfns.c 2013-04-07 04:41:19 +0000 @@ -123,10 +123,6 @@ #define MAXREQUEST(dpy) (XMaxRequestSize (dpy)) -/* Nonzero if using X. */ - -int x_in_use; - static Lisp_Object Qsuppress_icon; static Lisp_Object Qundefined_color; static Lisp_Object Qcompound_text, Qcancel_timer; @@ -139,38 +135,6 @@ static struct x_display_info *x_display_info_for_name (Lisp_Object); - -/* Error if we are not connected to X. */ - -void -check_window_system (void) -{ - if (! x_in_use) - error ("X windows are not in use or not initialized"); -} - -/* Nonzero if we can use mouse menus. - You should not call this unless HAVE_MENUS is defined. */ - -int -have_menus_p (void) -{ - return x_in_use; -} - -/* Extract a frame as a FRAME_PTR, defaulting to the selected frame - and checking validity for X. */ - -FRAME_PTR -check_x_frame (Lisp_Object frame) -{ - struct frame *f = decode_live_frame (frame); - - if (! FRAME_X_P (f)) - error ("Non-X frame used"); - return f; -} - /* Let the user specify an X display with a Lisp object. OBJECT may be nil, a frame or a terminal object. nil stands for the selected frame--or, if that is not an X frame, @@ -205,7 +169,7 @@ dpyinfo = x_display_info_for_name (object); else { - FRAME_PTR f = check_x_frame (object); + FRAME_PTR f = decode_window_system_frame (object); dpyinfo = FRAME_X_DISPLAY_INFO (f); } @@ -2992,7 +2956,7 @@ Signal error if FRAME is not an X frame. */) (Lisp_Object frame) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); block_input (); x_wm_set_size_hint (f, 0, 0); @@ -3483,7 +3447,7 @@ FRAME nil means use the selected frame. */) (Lisp_Object frame) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); Display *dpy = FRAME_X_DISPLAY (f); block_input (); @@ -3516,7 +3480,7 @@ (Lisp_Object color, Lisp_Object frame) { XColor foo; - FRAME_PTR f = check_x_frame (frame); + FRAME_PTR f = decode_window_system_frame (frame); CHECK_STRING (color); @@ -3531,7 +3495,7 @@ (Lisp_Object color, Lisp_Object frame) { XColor foo; - FRAME_PTR f = check_x_frame (frame); + FRAME_PTR f = decode_window_system_frame (frame); CHECK_STRING (color); @@ -3996,7 +3960,6 @@ if (dpyinfo == 0) error ("Cannot connect to X server %s", SDATA (name)); - x_in_use = 1; XSETFASTINT (Vwindow_system_version, 11); return dpyinfo; @@ -4050,8 +4013,6 @@ error ("Cannot connect to X server %s", SDATA (display)); } - x_in_use = 1; - XSETFASTINT (Vwindow_system_version, 11); return Qnil; } @@ -4143,7 +4104,7 @@ (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); Atom prop_atom; Atom target_type = XA_STRING; int element_format = 8; @@ -4221,7 +4182,7 @@ FRAME nil or omitted means use the selected frame. Value is PROP. */) (Lisp_Object prop, Lisp_Object frame) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); Atom prop_atom; CHECK_STRING (prop); @@ -4257,7 +4218,7 @@ (Lisp_Object prop, Lisp_Object frame, Lisp_Object type, Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); Atom prop_atom; int rc; Lisp_Object prop_value = Qnil; @@ -4525,8 +4486,6 @@ Lisp_Object buffer; struct buffer *old_buffer; - check_window_system (); - if (!dpyinfo->terminal->name) error ("Terminal is not live, can't create new frames on it"); @@ -4923,7 +4882,7 @@ if (SCHARS (string) == 0) string = make_unibyte_string (" ", 1); - f = check_x_frame (frame); + f = decode_window_system_frame (frame); if (NILP (timeout)) timeout = make_number (5); else @@ -5246,7 +5205,7 @@ #ifdef USE_GTK if (use_dialog_box && use_file_dialog - && have_menus_p () + && window_system_available (SELECTED_FRAME ()) && xg_uses_old_file_dialog ()) return Qt; #endif @@ -5316,7 +5275,7 @@ ptrdiff_t count = SPECPDL_INDEX (); struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; - check_window_system (); + check_window_system (f); GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); @@ -5486,7 +5445,7 @@ struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; char *cdef_file; - check_window_system (); + check_window_system (f); GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); @@ -5541,15 +5500,13 @@ nil, it defaults to the selected frame. */) (Lisp_Object frame, Lisp_Object ignored) { - FRAME_PTR f = check_x_frame (frame); + FRAME_PTR f = decode_window_system_frame (frame); Lisp_Object font; Lisp_Object font_param; char *default_name = NULL; struct gcpro gcpro1, gcpro2; ptrdiff_t count = SPECPDL_INDEX (); - check_window_system (); - if (popup_activated ()) error ("Trying to use a menu from within a menu-entry"); @@ -5609,7 +5566,7 @@ return Qlambda; #else XkbDescPtr kb; - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); Display *dpy = FRAME_X_DISPLAY (f); Lisp_Object have_keys; int major, minor, op, event, error_code; @@ -5737,9 +5694,6 @@ void syms_of_xfns (void) { - /* This is zero if not using X windows. */ - x_in_use = 0; - /* The section below is built by the lisp expression at the top of the file, just above where these variables are declared. */ /*&&& init symbols here &&&*/ === modified file 'src/xgselect.c' --- src/xgselect.c 2013-03-05 07:10:55 +0000 +++ src/xgselect.c 2013-04-07 04:41:19 +0000 @@ -26,6 +26,7 @@ #include #include #include "xterm.h" +#include "frame.h" int xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, @@ -43,7 +44,7 @@ int i, nfds, tmo_in_millisec; USE_SAFE_ALLOCA; - if (! (x_in_use + if (! (window_system_available (NULL) && g_main_context_pending (context = g_main_context_default ()))) return pselect (fds_lim, rfds, wfds, efds, timeout, sigmask); === modified file 'src/xmenu.c' --- src/xmenu.c 2013-04-05 14:07:02 +0000 +++ src/xmenu.c 2013-04-07 04:41:19 +0000 @@ -223,8 +223,6 @@ FRAME_PTR f = NULL; Lisp_Object window; - check_window_system (); - /* Decode the first argument: find the window or frame to use. */ if (EQ (position, Qt) || (CONSP (position) && (EQ (XCAR (position), Qmenu_bar) @@ -277,8 +275,7 @@ but I don't want to make one now. */ CHECK_WINDOW (window); - if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f)) - error ("Can not put X dialog on this terminal"); + check_window_system (f); /* Force a redisplay before showing the dialog. If a frame is created just before showing the dialog, its contents may not have been fully @@ -485,7 +482,7 @@ (Lisp_Object frame) { XEvent ev; - FRAME_PTR f = check_x_frame (frame); + FRAME_PTR f = decode_window_system_frame (frame); Widget menubar; block_input (); @@ -569,7 +566,7 @@ block_input (). */ block_input (); - f = check_x_frame (frame); + f = decode_window_system_frame (frame); if (FRAME_EXTERNAL_MENU_BAR (f)) set_frame_menubar (f, 0, 1); === modified file 'src/xselect.c' --- src/xselect.c 2013-03-24 12:59:45 +0000 +++ src/xselect.c 2013-04-07 04:41:19 +0000 @@ -2450,7 +2450,7 @@ If the value is 0 or the atom is not known, return the empty string. */) (Lisp_Object value, Lisp_Object frame) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); char *name = 0; char empty[] = ""; Lisp_Object ret = Qnil; @@ -2485,7 +2485,7 @@ (Lisp_Object atom, Lisp_Object frame) { Atom x_atom; - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); ptrdiff_t i; struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); @@ -2618,7 +2618,7 @@ struct x_display_info *dpyinfo = check_x_display_info (display); Window wdest; XEvent event; - struct frame *f = check_x_frame (from); + struct frame *f = decode_window_system_frame (from); int to_root; CHECK_NUMBER (format); @@ -2635,7 +2635,7 @@ if (FRAMEP (dest) || NILP (dest)) { - struct frame *fdest = check_x_frame (dest); + struct frame *fdest = decode_window_system_frame (dest); wdest = FRAME_OUTER_WINDOW (fdest); } else if (STRINGP (dest)) === modified file 'src/xterm.h' --- src/xterm.h 2013-04-05 14:07:02 +0000 +++ src/xterm.h 2013-04-07 04:41:19 +0000 @@ -923,7 +923,6 @@ /* From xfns.c. */ -struct frame *check_x_frame (Lisp_Object); extern void x_free_gcs (struct frame *); /* From xrdb.c. */ @@ -1008,7 +1007,6 @@ extern struct x_display_info * check_x_display_info (Lisp_Object); extern Lisp_Object x_get_focus_frame (struct frame *); -extern int x_in_use; #ifdef USE_GTK extern int xg_set_icon (struct frame *, Lisp_Object); ------------------------------------------------------------ revno: 112237 committer: Glenn Morris branch nick: trunk timestamp: Sat 2013-04-06 13:03:38 -0700 message: Fix typo diff: === modified file 'admin/notes/bugtracker' --- admin/notes/bugtracker 2013-03-31 17:18:09 +0000 +++ admin/notes/bugtracker 2013-04-06 20:03:38 +0000 @@ -103,7 +103,7 @@ to hopefully stop this happening, but it is still better to use X-Debbugs-CC.) If a new report contains X-Debbugs-CC in the input, this is -converted to a real Cc header in the output. (See Bug#1720). +converted to a real Cc header in the output. (See Bug#1780,5384) It is also merged into the Resent-CC header (see below). ** How does Debbugs send out mails? ------------------------------------------------------------ revno: 112236 committer: Dmitry Antipov branch nick: trunk timestamp: Sat 2013-04-06 18:06:39 +0400 message: Do not set x-display-name until X connection is established. This is needed to prevent from weird situation described at . * frame.el (make-frame): Set x-display-name after call to window system initialization function, not before. * term/x-win.el (x-initialize-window-system): Add optional display argument and use it. * term/w32-win.el (w32-initialize-window-system): * term/ns-win.el (ns-initialize-window-system): * term/pc-win.el (msdos-initialize-window-system): Add compatible optional display argument. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-04-06 07:41:09 +0000 +++ lisp/ChangeLog 2013-04-06 14:06:39 +0000 @@ -1,3 +1,17 @@ +2013-04-06 Dmitry Antipov + + Do not set x-display-name until X connection is established. + This is needed to prevent from weird situation described at + . + * frame.el (make-frame): Set x-display-name after call to + window system initialization function, not before. + * term/x-win.el (x-initialize-window-system): Add optional + display argument and use it. + * term/w32-win.el (w32-initialize-window-system): + * term/ns-win.el (ns-initialize-window-system): + * term/pc-win.el (msdos-initialize-window-system): + Add compatible optional display argument. + 2013-04-06 Eli Zaretskii * files.el (normal-backup-enable-predicate): On MS-Windows and === modified file 'lisp/frame.el' --- lisp/frame.el 2013-01-30 23:50:11 +0000 +++ lisp/frame.el 2013-04-06 14:06:39 +0000 @@ -655,9 +655,8 @@ (error "Don't know how to create a frame on window system %s" w)) (unless (get w 'window-system-initialized) - (unless x-display-name - (setq x-display-name display)) - (funcall (cdr (assq w window-system-initialization-alist))) + (funcall (cdr (assq w window-system-initialization-alist)) display) + (setq x-display-name display) (put w 'window-system-initialized t)) ;; Add parameters from `window-system-default-frame-alist'. === modified file 'lisp/term/ns-win.el' --- lisp/term/ns-win.el 2013-01-02 16:13:04 +0000 +++ lisp/term/ns-win.el 2013-04-06 14:06:39 +0000 @@ -895,7 +895,7 @@ ;; Do the actual Nextstep Windows setup here; the above code just ;; defines functions and variables that we use now. -(defun ns-initialize-window-system () +(defun ns-initialize-window-system (&optional display) "Initialize Emacs for Nextstep (Cocoa / GNUstep) windowing." (cl-assert (not ns-initialized)) === modified file 'lisp/term/pc-win.el' --- lisp/term/pc-win.el 2013-01-01 09:11:05 +0000 +++ lisp/term/pc-win.el 2013-04-06 14:06:39 +0000 @@ -403,7 +403,7 @@ (error "terminal-init-internal called for window-system `%s'" (window-system))) -(defun msdos-initialize-window-system () +(defun msdos-initialize-window-system (&optional display) "Initialization function for the `pc' \"window system\"." (or (eq (window-system) 'pc) (error === modified file 'lisp/term/w32-win.el' --- lisp/term/w32-win.el 2013-01-02 16:13:04 +0000 +++ lisp/term/w32-win.el 2013-04-06 14:06:39 +0000 @@ -246,7 +246,7 @@ (declare-function x-parse-geometry "frame.c" (string)) (defvar x-command-line-resources) -(defun w32-initialize-window-system () +(defun w32-initialize-window-system (&optional display) "Initialize Emacs for W32 GUI frames." (cl-assert (not w32-initialized)) === modified file 'lisp/term/x-win.el' --- lisp/term/x-win.el 2013-03-18 19:44:15 +0000 +++ lisp/term/x-win.el 2013-04-06 14:06:39 +0000 @@ -1343,7 +1343,7 @@ (defvar x-display-name) (defvar x-command-line-resources) -(defun x-initialize-window-system () +(defun x-initialize-window-system (&optional display) "Initialize Emacs for X frames and open the first connection to an X server." (cl-assert (not x-initialized)) @@ -1357,7 +1357,7 @@ (while (setq i (string-match "[.*]" x-resource-name)) (aset x-resource-name i ?-)))) - (x-open-connection (or x-display-name + (x-open-connection (or display (setq x-display-name (or (getenv "DISPLAY" (selected-frame)) (getenv "DISPLAY")))) x-command-line-resources ------------------------------------------------------------ revno: 112235 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2013-04-06 10:41:09 +0300 message: Fix the non-creation of backup files in temporary-file directory on Windows. lisp/files.el (normal-backup-enable-predicate): On MS-Windows and MS-DOS compare truenames of temporary-file-directory and of the file, so that 8+3 aliases (usually found in $TEMP on Windows) don't fail comparison by compare-strings. Also, compare file names case-insensitively on MS-Windows and MS-DOS. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-04-05 22:22:12 +0000 +++ lisp/ChangeLog 2013-04-06 07:41:09 +0000 @@ -1,3 +1,11 @@ +2013-04-06 Eli Zaretskii + + * files.el (normal-backup-enable-predicate): On MS-Windows and + MS-DOS compare truenames of temporary-file-directory and of the + file, so that 8+3 aliases (usually found in $TEMP on Windows) + don't fail comparison by compare-strings. Also, compare file + names case-insensitively on MS-Windows and MS-DOS. + 2013-04-05 Stefan Monnier * emacs-lisp/package.el (package-compute-transaction): Fix last fix. === modified file 'lisp/files.el' --- lisp/files.el 2013-03-24 06:42:25 +0000 +++ lisp/files.el 2013-04-06 07:41:09 +0000 @@ -4180,23 +4180,31 @@ "Default `backup-enable-predicate' function. Checks for files in `temporary-file-directory', `small-temporary-file-directory', and /tmp." - (not (or (let ((comp (compare-strings temporary-file-directory 0 nil - name 0 nil))) - ;; Directory is under temporary-file-directory. - (and (not (eq comp t)) - (< comp (- (length temporary-file-directory))))) - (let ((comp (compare-strings "/tmp" 0 nil - name 0 nil))) - ;; Directory is under /tmp. - (and (not (eq comp t)) - (< comp (- (length "/tmp"))))) - (if small-temporary-file-directory - (let ((comp (compare-strings small-temporary-file-directory - 0 nil - name 0 nil))) - ;; Directory is under small-temporary-file-directory. - (and (not (eq comp t)) - (< comp (- (length small-temporary-file-directory))))))))) + (let ((temporary-file-directory temporary-file-directory) + caseless) + ;; On MS-Windows, file-truename will convert short 8+3 alises to + ;; their long file-name equivalents, so compare-strings does TRT. + (if (memq system-type '(ms-dos windows-nt)) + (setq temporary-file-directory (file-truename temporary-file-directory) + name (file-truename name) + caseless t)) + (not (or (let ((comp (compare-strings temporary-file-directory 0 nil + name 0 nil caseless))) + ;; Directory is under temporary-file-directory. + (and (not (eq comp t)) + (< comp (- (length temporary-file-directory))))) + (let ((comp (compare-strings "/tmp" 0 nil + name 0 nil))) + ;; Directory is under /tmp. + (and (not (eq comp t)) + (< comp (- (length "/tmp"))))) + (if small-temporary-file-directory + (let ((comp (compare-strings small-temporary-file-directory + 0 nil + name 0 nil caseless))) + ;; Directory is under small-temporary-file-directory. + (and (not (eq comp t)) + (< comp (- (length small-temporary-file-directory)))))))))) (defun make-backup-file-name (file) "Create the non-numeric backup file name for FILE. ------------------------------------------------------------ revno: 112234 committer: Chong Yidong branch nick: trunk timestamp: Sat 2013-04-06 15:39:48 +0800 message: Improve Lisp manual documentation on setting faces. * display.texi (Faces): Minor clarifications. (Defining Faces): Clarify default vs custom face specs. Document face-spec-set. * display.texi (Overlay Properties): * text.texi (Special Properties): Use the "anonymous face" terminology. Describe foreground-color and background-color forms as compatibility-only. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2013-04-04 03:46:25 +0000 +++ doc/lispref/ChangeLog 2013-04-06 07:39:48 +0000 @@ -1,3 +1,14 @@ +2013-04-06 Chong Yidong + + * display.texi (Faces): Minor clarifications. + (Defining Faces): Clarify default vs custom face specs. Document + face-spec-set. + + * display.texi (Overlay Properties): + * text.texi (Special Properties): Use the "anonymous face" + terminology. Describe foreground-color and background-color forms + as compatibility-only. + 2013-03-24 Eli Zaretskii * compile.texi (Byte-Code Objects): Add index entry. === modified file 'doc/lispref/display.texi' --- doc/lispref/display.texi 2013-02-21 06:03:02 +0000 +++ doc/lispref/display.texi 2013-04-06 07:39:48 +0000 @@ -1510,31 +1510,31 @@ @item face @kindex face @r{(overlay property)} -This property controls the way text is displayed---for example, which -font and which colors. @xref{Faces}, for more information. - -In the simplest case, the value is a face name. It can also be a list; -then each element can be any of these possibilities: +This property controls the appearance of the text (@pxref{Faces}). +The value of the property can be the following: @itemize @bullet @item A face name (a symbol or string). @item -A property list of face attributes. This has the form (@var{keyword} -@var{value} @dots{}), where each @var{keyword} is a face attribute -name and @var{value} is a meaningful value for that attribute. With -this feature, you do not need to create a face each time you want to -specify a particular attribute for certain text. @xref{Face -Attributes}. - -@item -A cons cell, of the form @code{(foreground-color . @var{color-name})} -or @code{(background-color . @var{color-name})}. These elements -specify just the foreground color or just the background color. - -@code{(foreground-color . @var{color-name})} has the same effect as -@code{(:foreground @var{color-name})}; likewise for the background. +An anonymous face: a property list of the form @code{(@var{keyword} +@var{value} @dots{})}, where each @var{keyword} is a face attribute +name and @var{value} is a value for that attribute. + +@item +A list of faces. Each list element should be either a face name or an +anonymous face. This specifies a face which is an aggregate of the +attributes of each of the listed faces. Faces occurring earlier in +the list have higher priority. + +@item +A cons cell of the form @code{(foreground-color . @var{color-name})} +or @code{(background-color . @var{color-name})}. This specifies the +foreground or background color, similar to @code{(:foreground +@var{color-name})} or @code{(:background @var{color-name})}. This +form is supported for backward compatibility only, and should be +avoided. @end itemize @item mouse-face @@ -1901,44 +1901,39 @@ @section Faces @cindex faces - A @dfn{face} is a collection of graphical @dfn{attributes} for -displaying text: font, foreground color, background color, optional -underlining, etc. Faces control how Emacs displays text in buffers, -as well as other parts of the frame such as the mode line. + A @dfn{face} is a collection of graphical attributes for displaying +text: font, foreground color, background color, optional underlining, +etc. Faces control how Emacs displays text in buffers, as well as +other parts of the frame such as the mode line. @cindex anonymous face One way to represent a face is as a property list of attributes, -like @code{(:foreground "red" :weight bold)}. For example, you can -assign such an @dfn{anonymous face} as the value of the @code{face} -text property; this causes Emacs to display the underlying text with -the specified attributes. @xref{Special Properties}. +like @code{(:foreground "red" :weight bold)}. Such a list is called +an @dfn{anonymous face}. For example, you can assign an anonymous +face as the value of the @code{face} text property, and Emacs will +display the underlying text with the specified attributes. +@xref{Special Properties}. @cindex face name More commonly, a face is referred to via a @dfn{face name}: a Lisp -symbol which is associated with a set of face attributes. Named faces -are defined using the @code{defface} macro (@pxref{Defining Faces}). -Emacs defines several standard named faces; @xref{Standard Faces,,, -emacs, The GNU Emacs Manual}. +symbol associated with a set of face attributes@footnote{For backward +compatibility, you can also use a string to specify a face name; that +is equivalent to a Lisp symbol with the same name.}. Named faces are +defined using the @code{defface} macro (@pxref{Defining Faces}). +Emacs comes with several standard named faces (@pxref{Basic Faces}). - Many parts of Emacs require named faces, and do not accept anonymous -faces. These include the functions documented in @ref{Attribute -Functions}, and the variable @code{font-lock-keywords} + Many parts of Emacs required named faces, and do not accept +anonymous faces. These include the functions documented in +@ref{Attribute Functions}, and the variable @code{font-lock-keywords} (@pxref{Search-based Fontification}). Unless otherwise stated, we will use the term @dfn{face} to refer only to named faces. - For backward compatibility, you can also use a string to specify a -face name; that is equivalent to a Lisp symbol with the same name. - @defun facep object This function returns a non-@code{nil} value if @var{object} is a named face: a Lisp symbol or string which serves as a face name. Otherwise, it returns @code{nil}. @end defun - By default, each face name corresponds to the same set of attributes -in all frames. But you can also assign a face name a special set of -attributes in one frame (@pxref{Attribute Functions}). - @menu * Face Attributes:: What is in a face? * Defining Faces:: How to define a face. @@ -2178,32 +2173,47 @@ @node Defining Faces @subsection Defining Faces +@cindex face spec The usual way to define a face is through the @code{defface} macro. -This macro defines a face name, and associates that name with a set of -face attributes. It also sets up the face so that the user can -customize it via the Customize interface (@pxref{Customization}). +This macro associates a face name (a symbol) with a default @dfn{face +spec}. A face spec is a construct which specifies what attributes a +face should have on any given terminal; for example, a face spec might +specify one foreground color on high-color terminals, and a different +foreground color on low-color terminals. + + People are sometimes tempted to create a variable whose value is a +face name. In the vast majority of cases, this is not necessary; the +usual procedure is to define a face with @code{defface}, and then use +its name directly. @defmac defface face spec doc [keyword value]@dots{} -This macro declares @var{face} as a customizable face whose default -attributes are given by @var{spec}. You should not quote the symbol -@var{face}, and it should not end in @samp{-face} (that would be -redundant). The argument @var{doc} is a documentation string for the -face. The additional @var{keyword} arguments have the same meanings -as in @code{defgroup} and @code{defcustom} (@pxref{Common Keywords}). - -When @code{defface} executes, it defines the face according to -@var{spec}, then uses any customizations that were read from the -init file (@pxref{Init File}) to override that specification. - -When you evaluate a @code{defface} form with @kbd{C-M-x} in Emacs -Lisp mode (@code{eval-defun}), a special feature of @code{eval-defun} -overrides any customizations of the face. This way, the face reflects -exactly what the @code{defface} says. - -@cindex face specification -The @var{spec} argument is a @dfn{face specification}, which states -how the face should appear on different kinds of terminals. It should -be an alist whose elements each have the form +This macro declares @var{face} as a named face whose default face spec +is given by @var{spec}. You should not quote the symbol @var{face}, +and it should not end in @samp{-face} (that would be redundant). The +argument @var{doc} is a documentation string for the face. The +additional @var{keyword} arguments have the same meanings as in +@code{defgroup} and @code{defcustom} (@pxref{Common Keywords}). + +If @var{face} already has a default face spec, this macro does +nothing. + +The default face spec determines @var{face}'s appearance when no +customizations are in effect (@pxref{Customization}). If @var{face} +has already been customized (via Custom themes or via customizations +read from the init file), its appearance is determined by the custom +face spec(s), which override the default face spec @var{spec}. +However, if the customizations are subsequently removed, the +appearance of @var{face} will again be determined by its default face +spec. + +As an exception, if you evaluate a @code{defface} form with +@kbd{C-M-x} in Emacs Lisp mode (@code{eval-defun}), a special feature +of @code{eval-defun} overrides any custom face specs on the face, +causing the face to reflect exactly what the @code{defface} says. + +The @var{spec} argument is a @dfn{face spec}, which states how the +face should appear on different kinds of terminals. It should be an +alist whose elements each have the form @example (@var{display} . @var{plist}) @@ -2275,7 +2285,8 @@ @end table @end defmac - Here's how the standard face @code{highlight} is defined: + For example, here's the definition of the standard face +@code{highlight}: @example (defface highlight @@ -2294,65 +2305,56 @@ :group 'basic-faces) @end example - Internally, Emacs stores the face's default specification in its + Internally, Emacs stores each face's default spec in its @code{face-defface-spec} symbol property (@pxref{Symbol Properties}). -The @code{saved-face} property stores the face specification saved by -the user, using the customization buffer; the @code{customized-face} -property stores the face specification customized for the current -session, but not saved; and the @code{theme-face} property stores an -alist associating the active customization settings and Custom themes -with their specifications for that face. The face's documentation -string is stored in the @code{face-documentation} property. But -normally you should not try to set any of these properties directly. -@xref{Applying Customizations}, for the @code{custom-set-faces} -function, which is used to apply customized face settings. - - People are sometimes tempted to create variables whose values -specify a face to use. In the vast majority of cases, this is not -necessary; it is preferable to simply use faces directly. +The @code{saved-face} property stores any face spec saved by the user +using the customization buffer; the @code{customized-face} property +stores the face spec customized for the current session, but not +saved; and the @code{theme-face} property stores an alist associating +the active customization settings and Custom themes with the face +specs for that face. The face's documentation string is stored in the +@code{face-documentation} property. + + Normally, a face is declared just once, using @code{defface}, and +any further changes to its appearance are applied using the Customize +framework (e.g., via the Customize user interface or via the +@code{custom-set-faces} function; @pxref{Applying Customizations}), or +by face remapping (@pxref{Face Remapping}). In the rare event that +you need to change a face spec directly from Lisp, you can use the +@code{face-spec-set} function. + +@defun face-spec-set face spec &optional spec-type +This function applies @var{spec} as a face spec for @code{face}. +@var{spec} should be a face spec, as described in the above +documentation for @code{defface}. + +@cindex override spec @r{(for a face)} +The argument @var{spec-type} determines which spec to set. If it is +@code{nil} or @code{face-override-spec}, this function sets the +@dfn{override spec}, which overrides over all other face specs on +@var{face}. If it is @code{face-defface-spec}, this function sets the +default face spec (the same one set by @code{defface}). If it is +@code{reset}, this function clears out all customization specs and +override specs from @var{face} (in this case, the value of @var{spec} +is ignored). Any other value of @var{spec-type} is reserved for +internal use. +@end defun @node Attribute Functions @subsection Face Attribute Functions - This section describes the functions for accessing and modifying the -attributes of an existing named face. - -@defun set-face-attribute face frame &rest arguments -This function sets one or more attributes of @var{face} for -@var{frame}. The attributes you specify this way override whatever -the @code{defface} says. - -The extra arguments @var{arguments} specify the attributes to set, and -the values for them. They should consist of alternating attribute -names (such as @code{:family} or @code{:underline}) and values. Thus, - -@example -(set-face-attribute 'foo nil - :width 'extended - :weight 'bold) -@end example - -@noindent -sets the attribute @code{:width} to @code{extended} and the attribute -@code{:weight} to @code{bold}. - -If @var{frame} is @code{t}, this function sets the default attributes -for new frames. Default attribute values specified this way override -the @code{defface} for newly created frames. - -If @var{frame} is @code{nil}, this function sets the attributes for -all existing frames, and the default for new frames. -@end defun + This section describes functions for directly accessing and +modifying the attributes of a named face. @defun face-attribute face attribute &optional frame inherit -This returns the value of the @var{attribute} attribute of @var{face} -on @var{frame}. If @var{frame} is @code{nil}, that means the selected -frame (@pxref{Input Focus}). +This function returns the value of the @var{attribute} attribute for +@var{face} on @var{frame}. -If @var{frame} is @code{t}, this returns whatever new-frames default -value you previously specified with @code{set-face-attribute} for the -@var{attribute} attribute of @var{face}. If you have not specified -one, it returns @code{nil}. +If @var{frame} is @code{nil}, that means the selected frame +(@pxref{Input Focus}). If @var{frame} is @code{t}, this function +returns the value of the specified attribute for newly-created frames +(this is normally @code{unspecified}, unless you have specified some +value using @code{set-face-attribute}; see below). If @var{inherit} is @code{nil}, only attributes directly defined by @var{face} are considered, so the return value may be @@ -2411,6 +2413,36 @@ face attribute @var{attribute}, returns @var{value1} unchanged. @end defun + Normally, Emacs uses the face specs of each face to automatically +calculate its attributes on each frame (@pxref{Defining Faces}). The +function @code{set-face-attribute} can override this calculation by +directly assigning attributes to a face, either on a specific frame or +for all frames. This function is mostly intended for internal usage. + +@defun set-face-attribute face frame &rest arguments +This function sets one or more attributes of @var{face} for +@var{frame}. The attributes specifies in this way override the face +spec(s) belonging to @var{face}. + +The extra arguments @var{arguments} specify the attributes to set, and +the values for them. They should consist of alternating attribute +names (such as @code{:family} or @code{:underline}) and values. Thus, + +@example +(set-face-attribute 'foo nil :weight 'bold :slant 'italic) +@end example + +@noindent +sets the attribute @code{:weight} to @code{bold} and the attribute +@code{:slant} to @code{italic}. + + +If @var{frame} is @code{t}, this function sets the default attributes +for newly created frames. If @var{frame} is @code{nil}, this function +sets the attributes for all existing frames, as well as for newly +created frames. +@end defun + The following commands and functions mostly provide compatibility with old versions of Emacs. They work by calling @code{set-face-attribute}. Values of @code{t} and @code{nil} for @@ -2457,16 +2489,17 @@ This swaps the foreground and background colors of face @var{face}. @end deffn - The following functions examine the attributes of a face. If you -don't specify @var{frame}, they refer to the selected frame; @code{t} -refers to the default data for new frames. They return the symbol -@code{unspecified} if the face doesn't define any value for that -attribute. If @var{inherit} is @code{nil}, only an attribute directly -defined by the face is returned. If @var{inherit} is non-@code{nil}, -any faces specified by its @code{:inherit} attribute are considered as -well, and if @var{inherit} is a face or a list of faces, then they are -also considered, until a specified attribute is found. To ensure that -the return value is always specified, use a value of @code{default} for + The following functions examine the attributes of a face. They +mostly provide compatibility with old versions of Emacs. If you don't +specify @var{frame}, they refer to the selected frame; @code{t} refers +to the default data for new frames. They return @code{unspecified} if +the face doesn't define any value for that attribute. If +@var{inherit} is @code{nil}, only an attribute directly defined by the +face is returned. If @var{inherit} is non-@code{nil}, any faces +specified by its @code{:inherit} attribute are considered as well, and +if @var{inherit} is a face or a list of faces, then they are also +considered, until a specified attribute is found. To ensure that the +return value is always specified, use a value of @code{default} for @var{inherit}. @defun face-font face &optional frame @@ -2576,13 +2609,13 @@ any text having the face @var{face} with @var{remapping}, rather than the ordinary definition of @var{face}. -@var{remapping} may be any face specification suitable for a -@code{face} text property: either a face (i.e., a face name or a -property list of attribute/value pairs), or a list of faces. For -details, see the description of the @code{face} text property in -@ref{Special Properties}. @var{remapping} serves as the complete -specification for the remapped face---it replaces the normal -definition of @var{face}, instead of modifying it. +@var{remapping} may be any face spec suitable for a @code{face} text +property: either a face (i.e., a face name or a property list of +attribute/value pairs), or a list of faces. For details, see the +description of the @code{face} text property in @ref{Special +Properties}. @var{remapping} serves as the complete specification for +the remapped face---it replaces the normal definition of @var{face}, +instead of modifying it. If @code{face-remapping-alist} is buffer-local, its local value takes effect only within that buffer. @@ -2629,7 +2662,7 @@ modes to remap faces in the buffers they control. @defun face-remap-add-relative face &rest specs -This functions adds the face specifications in @var{specs} as relative +This functions adds the face spec in @var{specs} as relative remappings for face @var{face} in the current buffer. The remaining arguments, @var{specs}, should form either a list of face names, or a property list of attribute/value pairs. === modified file 'doc/lispref/text.texi' --- doc/lispref/text.texi 2013-02-19 01:20:50 +0000 +++ doc/lispref/text.texi 2013-04-06 07:39:48 +0000 @@ -3008,27 +3008,31 @@ @item face @cindex face codes of text @kindex face @r{(text property)} -The @code{face} property controls the appearance of the character, -such as its font and color. @xref{Faces}. The value of the property -can be the following: +The @code{face} property controls the appearance of the character +(@pxref{Faces}). The value of the property can be the following: @itemize @bullet @item A face name (a symbol or string). @item -A property list of face attributes. This has the form (@var{keyword} -@var{value} @dots{}), where each @var{keyword} is a face attribute -name and @var{value} is a meaningful value for that attribute. With -this feature, you do not need to create a face each time you want to -specify a particular attribute for certain text. +An anonymous face: a property list of the form @code{(@var{keyword} +@var{value} @dots{})}, where each @var{keyword} is a face attribute +name and @var{value} is a value for that attribute. @item -A list of faces. This specifies a face which is an aggregate of the +A list of faces. Each list element should be either a face name or an +anonymous face. This specifies a face which is an aggregate of the attributes of each of the listed faces. Faces occurring earlier in -the list have higher priority. Each list element must have one of the -two above forms (i.e., either a face name or a property list of face -attributes). +the list have higher priority. + +@item +A cons cell of the form @code{(foreground-color . @var{color-name})} +or @code{(background-color . @var{color-name})}. This specifies the +foreground or background color, similar to @code{(:foreground +@var{color-name})} or @code{(:background @var{color-name})}. This +form is supported for backward compatibility only, and should be +avoided. @end itemize Font Lock mode (@pxref{Font Lock Mode}) works in most buffers by ------------------------------------------------------------ revno: 112233 committer: Paul Eggert branch nick: trunk timestamp: Sat 2013-04-06 00:33:18 -0700 message: Spelling fix. diff: === modified file 'src/coding.c' --- src/coding.c 2013-04-05 14:08:56 +0000 +++ src/coding.c 2013-04-06 07:33:18 +0000 @@ -6152,7 +6152,7 @@ } -/* Return the number of charcters at the source if all the bytes are +/* Return the number of characters at the source if all the bytes are valid UTF-8 (of Unicode range). Otherwise, return -1. By side effects, update coding->eol_seen. The value of coding->eol_seen is "logical or" of EOL_SEEN_LF, EOL_SEEN_CR, and EOL_SEEN_CRLF, but ------------------------------------------------------------ revno: 112232 committer: Dmitry Gutov branch nick: trunk timestamp: Sat 2013-04-06 02:22:12 +0400 message: * lisp/whitespace.el (whitespace-color-on, whitespace-color-off): Only call `font-lock-fontify-buffer' when `font-lock-mode' is on. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-04-05 18:46:59 +0000 +++ lisp/ChangeLog 2013-04-05 22:22:12 +0000 @@ -3,6 +3,11 @@ * emacs-lisp/package.el (package-compute-transaction): Fix last fix. Suggested by Donald Curtis (bug#14082). +2013-04-05 Dmitry Gutov + + * whitespace.el (whitespace-color-on, whitespace-color-off): Only + call `font-lock-fontify-buffer' when `font-lock-mode' is on. + 2013-04-05 Jacek ChrzÄ…szcz (tiny change) * ispell.el (ispell-set-spellchecker-params): === modified file 'lisp/whitespace.el' --- lisp/whitespace.el 2013-03-19 15:12:40 +0000 +++ lisp/whitespace.el 2013-04-05 22:22:12 +0000 @@ -2243,7 +2243,8 @@ (whitespace-space-after-tab-regexp 'space))) 1 whitespace-space-after-tab t))))) (font-lock-add-keywords nil whitespace-font-lock-keywords t) - (font-lock-fontify-buffer))) + (when font-lock-mode + (font-lock-fontify-buffer)))) (defun whitespace-color-off () @@ -2253,7 +2254,8 @@ (remove-hook 'post-command-hook #'whitespace-post-command-hook t) (remove-hook 'before-change-functions #'whitespace-buffer-changed t) (font-lock-remove-keywords nil whitespace-font-lock-keywords) - (font-lock-fontify-buffer))) + (when font-lock-mode + (font-lock-fontify-buffer)))) (defun whitespace-trailing-regexp (limit)