------------------------------------------------------------ revno: 116935 committer: Daniel Colascione branch nick: trunk timestamp: Thu 2014-04-03 00:14:02 -0700 message: Clean up array size calculations diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-04-03 00:44:00 +0000 +++ src/ChangeLog 2014-04-03 07:14:02 +0000 @@ -1,5 +1,66 @@ 2014-04-03 Daniel Colascione + In all places below, change expressions of the form sizeof(arr) / + sizeof(arr[0]) to EARRAYSIZE(arr). + + * xterm.c (x_term_init): See above. + + * xfns.c (best_xim_style): See above. + + * xfaces.c (Fdump_colors): See above. + + * w32fns.c (w32_default_color_map): See above. + + * w32.c: + (init_environment): See above. + (N_ENV_VARS): See above. + + * unexcw.c (read_exe_header): See above. + + * term.c (term_get_fkeys_1): See above. + + * sysdep.c (init_baud_rate): See above. + + * nsterm.m (ns_convert_key): See above. + + * nsfns.m (get_geometry_from_preferences): See above. + + * msdos.c (dos_set_window_size): See above. + (init_environment): See above. + + * macfont.m (mac_font_get_glyph_for_cid): See above. + (macfont_store_descriptor_attributes): See above. + (macfont_create_attributes_with_spec): See above. + (mac_ctfont_get_glyph_for_cid): See above. + + * keyboard.c (command_loop_1): See above. + (read_menu_command): See above. + (make_lispy_event): See above. + (NUM_MOD_NAMES): See above. + (read_key_sequence_vs): See above. + (Fcurrent_input_mode): See above. + (syms_of_keyboard): See above. + + * image.c (xpm_str_to_color_key): See above. + + * fringe.c (MAX_STANDARD_FRINGE_BITMAPS): See above. + + * frame.c (x_set_frame_parameters): See above. + + * fileio.c (Ffile_selinux_context): See above. + + * emacs.c (sort_args): See above. + + * dosfns.c (): + (msdos_stdcolor_name): See above. + + * dired.c (file_attributes): See above. + + * chartab.c: + (uniprop_decoder_count,uniprop_encode_count): See above. + +2014-04-02 Daniel Colascione + * data.c (Ffset): Abort if we're trying to set a function call to a dead lisp object. === modified file 'src/chartab.c' --- src/chartab.c 2013-12-01 22:33:13 +0000 +++ src/chartab.c 2014-04-03 07:14:02 +0000 @@ -1221,9 +1221,7 @@ static uniprop_decoder_t uniprop_decoder [] = { uniprop_decode_value_run_length }; -static int uniprop_decoder_count - = (sizeof uniprop_decoder) / sizeof (uniprop_decoder[0]); - +static const int uniprop_decoder_count = EARRAYSIZE (uniprop_decoder); /* Return the decoder of char-table TABLE or nil if none. */ @@ -1301,9 +1299,7 @@ uniprop_encode_value_run_length, uniprop_encode_value_numeric }; -static int uniprop_encoder_count - = (sizeof uniprop_encoder) / sizeof (uniprop_encoder[0]); - +static const int uniprop_encoder_count = EARRAYSIZE (uniprop_encoder); /* Return the encoder of char-table TABLE or nil if none. */ === modified file 'src/dired.c' --- src/dired.c 2014-01-01 07:43:34 +0000 +++ src/dired.c 2014-04-03 07:14:02 +0000 @@ -984,7 +984,7 @@ values[10] = INTEGER_TO_CONS (s.st_ino); values[11] = INTEGER_TO_CONS (s.st_dev); - return Flist (sizeof (values) / sizeof (values[0]), values); + return Flist (EARRAYSIZE (values), values); } DEFUN ("file-attributes-lessp", Ffile_attributes_lessp, Sfile_attributes_lessp, 2, 2, 0, === modified file 'src/dosfns.c' --- src/dosfns.c 2014-01-01 07:43:34 +0000 +++ src/dosfns.c 2014-04-03 07:14:02 +0000 @@ -402,7 +402,7 @@ { int i; - for (i = 0; i < sizeof (vga_colors) / sizeof (vga_colors[0]); i++) + for (i = 0; i < EARRAYSIZE (vga_colors); i++) if (xstrcasecmp (name, vga_colors[i]) == 0) return i; @@ -422,7 +422,7 @@ return build_string (unspecified_fg); else if (idx == FACE_TTY_DEFAULT_BG_COLOR) return build_string (unspecified_bg); - else if (idx >= 0 && idx < sizeof (vga_colors) / sizeof (vga_colors[0])) + else if (idx >= 0 && idx < EARRAYSIZE (vga_colors)) return build_string (vga_colors[idx]); else return Qunspecified; /* meaning the default */ === modified file 'src/emacs.c' --- src/emacs.c 2014-03-28 23:11:39 +0000 +++ src/emacs.c 2014-04-03 07:14:02 +0000 @@ -1817,7 +1817,7 @@ } /* Look for a match with a known old-fashioned option. */ - for (i = 0; i < sizeof (standard_args) / sizeof (standard_args[0]); i++) + for (i = 0; i < EARRAYSIZE (standard_args); i++) if (!strcmp (argv[from], standard_args[i].name)) { options[from] = standard_args[i].nargs; @@ -1839,8 +1839,7 @@ match = -1; - for (i = 0; - i < sizeof (standard_args) / sizeof (standard_args[0]); i++) + for (i = 0; i < EARRAYSIZE (standard_args); i++) if (standard_args[i].longname && !strncmp (argv[from], standard_args[i].longname, thislen)) === modified file 'src/fileio.c' --- src/fileio.c 2014-03-26 15:57:13 +0000 +++ src/fileio.c 2014-04-03 07:14:02 +0000 @@ -2909,7 +2909,7 @@ } #endif - return Flist (sizeof (values) / sizeof (values[0]), values); + return Flist (EARRAYSIZE (values), values); } DEFUN ("set-file-selinux-context", Fset_file_selinux_context, === modified file 'src/frame.c' --- src/frame.c 2014-03-30 13:31:45 +0000 +++ src/frame.c 2014-04-03 07:14:02 +0000 @@ -2867,8 +2867,7 @@ param_index = Fget (prop, Qx_frame_parameter); if (NATNUMP (param_index) - && (XFASTINT (param_index) - < sizeof (frame_parms)/sizeof (frame_parms[0])) + && XFASTINT (param_index) < EARRAYSIZE (frame_parms) && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)]) (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, val, old_value); } @@ -2916,8 +2915,7 @@ param_index = Fget (prop, Qx_frame_parameter); if (NATNUMP (param_index) - && (XFASTINT (param_index) - < sizeof (frame_parms)/sizeof (frame_parms[0])) + && XFASTINT (param_index) < EARRAYSIZE (frame_parms) && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)]) (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, val, old_value); } @@ -3228,8 +3226,7 @@ { Lisp_Object parm_index = Fget (Qbackground_color, Qx_frame_parameter); if (NATNUMP (parm_index) - && (XFASTINT (parm_index) - < sizeof (frame_parms)/sizeof (frame_parms[0])) + && XFASTINT (parm_index) < EARRAYSIZE (frame_parms) && FRAME_RIF (f)->frame_parm_handlers[XFASTINT (parm_index)]) (*FRAME_RIF (f)->frame_parm_handlers[XFASTINT (parm_index)]) (f, bgcolor, Qnil); @@ -4563,7 +4560,7 @@ { int i; - for (i = 0; i < sizeof (frame_parms) / sizeof (frame_parms[0]); i++) + for (i = 0; i < EARRAYSIZE (frame_parms); i++) { Lisp_Object v = intern_c_string (frame_parms[i].name); if (frame_parms[i].variable) === modified file 'src/fringe.c' --- src/fringe.c 2014-02-05 10:46:44 +0000 +++ src/fringe.c 2014-04-03 07:14:02 +0000 @@ -474,7 +474,7 @@ #define NO_FRINGE_BITMAP 0 #define UNDEF_FRINGE_BITMAP 1 -#define MAX_STANDARD_FRINGE_BITMAPS (sizeof (standard_bitmaps)/sizeof (standard_bitmaps[0])) +#define MAX_STANDARD_FRINGE_BITMAPS EARRAYSIZE (standard_bitmaps) static struct fringe_bitmap **fringe_bitmaps; static Lisp_Object *fringe_faces; === modified file 'src/image.c' --- src/image.c 2014-03-27 01:17:54 +0000 +++ src/image.c 2014-04-03 07:14:02 +0000 @@ -3955,9 +3955,7 @@ { int i; - for (i = 0; - i < sizeof xpm_color_key_strings / sizeof xpm_color_key_strings[0]; - i++) + for (i = 0; i < EARRAYSIZE (xpm_color_key_strings); i++) if (strcmp (xpm_color_key_strings[i], s) == 0) return i; return -1; === modified file 'src/keyboard.c' --- src/keyboard.c 2014-03-26 10:21:55 +0000 +++ src/keyboard.c 2014-04-03 07:14:02 +0000 @@ -1446,7 +1446,7 @@ Vthis_command_keys_shift_translated = Qnil; /* Read next key sequence; i gets its length. */ - i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0], + i = read_key_sequence (keybuf, EARRAYSIZE (keybuf), Qnil, 0, 1, 1, 0); /* A filter may have run while we were reading the input. */ @@ -1694,7 +1694,7 @@ menus. */ specbind (Qecho_keystrokes, make_number (0)); - i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0], + i = read_key_sequence (keybuf, EARRAYSIZE (keybuf), Qnil, 0, 1, 1, 1); unbind_to (count, Qnil); @@ -5484,8 +5484,7 @@ event->modifiers, Qfunction_key, Qnil, lispy_accent_keys, &accent_key_syms, - (sizeof (lispy_accent_keys) - / sizeof (lispy_accent_keys[0]))); + EARRAYSIZE (lispy_accent_keys)); #if 0 #ifdef XK_kana_A @@ -5494,8 +5493,7 @@ event->modifiers & ~shift_modifier, Qfunction_key, Qnil, lispy_kana_keys, &func_key_syms, - (sizeof (lispy_kana_keys) - / sizeof (lispy_kana_keys[0]))); + EARRAYSIZE (lispy_kana_keys)); #endif /* XK_kana_A */ #endif /* 0 */ @@ -5506,8 +5504,7 @@ event->modifiers, Qfunction_key, Qnil, iso_lispy_function_keys, &func_key_syms, - (sizeof (iso_lispy_function_keys) - / sizeof (iso_lispy_function_keys[0]))); + EARRAYSIZE (iso_lispy_function_keys)); #endif /* Handle system-specific or unknown keysyms. */ @@ -5533,20 +5530,17 @@ event->modifiers, Qfunction_key, Qnil, lispy_function_keys, &func_key_syms, - (sizeof (lispy_function_keys) - / sizeof (lispy_function_keys[0]))); + EARRAYSIZE (lispy_function_keys)); #ifdef HAVE_NTGUI case MULTIMEDIA_KEY_EVENT: - if (event->code < (sizeof (lispy_multimedia_keys) - / sizeof (lispy_multimedia_keys[0])) + if (event->code < EARRAYSIZE (lispy_multimedia_keys) && event->code > 0 && lispy_multimedia_keys[event->code]) { return modify_event_symbol (event->code, event->modifiers, Qfunction_key, Qnil, lispy_multimedia_keys, &func_key_syms, - (sizeof (lispy_multimedia_keys) - / sizeof (lispy_multimedia_keys[0]))); + EARRAYSIZE (lispy_multimedia_keys)); } return Qnil; #endif @@ -6268,7 +6262,7 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "alt", "super", "hyper", "shift", "control", "meta" }; -#define NUM_MOD_NAMES (sizeof (modifier_names) / sizeof (modifier_names[0])) +#define NUM_MOD_NAMES EARRAYSIZE (modifier_names) static Lisp_Object modifier_symbols; @@ -9758,7 +9752,7 @@ memset (keybuf, 0, sizeof keybuf); GCPRO1 (keybuf[0]); - gcpro1.nvars = (sizeof keybuf / sizeof (keybuf[0])); + gcpro1.nvars = EARRAYSIZE (keybuf); if (NILP (continue_echo)) { @@ -9772,7 +9766,7 @@ cancel_hourglass (); #endif - i = read_key_sequence (keybuf, (sizeof keybuf / sizeof (keybuf[0])), + i = read_key_sequence (keybuf, EARRAYSIZE (keybuf), prompt, ! NILP (dont_downcase_last), ! NILP (can_return_switch_frame), 0, 0); @@ -10675,7 +10669,7 @@ } XSETFASTINT (val[3], quit_char); - return Flist (sizeof (val) / sizeof (val[0]), val); + return Flist (EARRAYSIZE (val), val); } DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, 2, 4, 0, @@ -11043,7 +11037,7 @@ { int i; - int len = sizeof (head_table) / sizeof (head_table[0]); + int len = EARRAYSIZE (head_table); for (i = 0; i < len; i++) { @@ -11059,14 +11053,13 @@ staticpro (&button_down_location); mouse_syms = Fmake_vector (make_number (5), Qnil); staticpro (&mouse_syms); - wheel_syms = Fmake_vector (make_number (sizeof (lispy_wheel_names) - / sizeof (lispy_wheel_names[0])), + wheel_syms = Fmake_vector (make_number (EARRAYSIZE (lispy_wheel_names)), Qnil); staticpro (&wheel_syms); { int i; - int len = sizeof (modifier_names) / sizeof (modifier_names[0]); + int len = EARRAYSIZE (modifier_names); modifier_symbols = Fmake_vector (make_number (len), Qnil); for (i = 0; i < len; i++) === modified file 'src/macfont.m' --- src/macfont.m 2014-01-13 10:32:48 +0000 +++ src/macfont.m 2014-04-03 07:14:02 +0000 @@ -237,8 +237,7 @@ unichar characters[] = {0xfffd}; NSString *string = [NSString stringWithCharacters:characters - length:(sizeof (characters) - / sizeof (characters[0]))]; + length:EARRAYSIZE (characters)]; NSGlyphInfo *glyphInfo = [NSGlyphInfo glyphInfoWithCharacterIdentifier:cid collection:collection @@ -826,7 +825,7 @@ {{0, 100}, {1, 200}, {CGFLOAT_MAX, CGFLOAT_MAX}}}}; int i; - for (i = 0; i < sizeof (numeric_traits) / sizeof (numeric_traits[0]); i++) + for (i = 0; i < EARRAYSIZE (numeric_traits); i++) { num = CFDictionaryGetValue (dict, numeric_traits[i].trait); if (num && CFNumberGetValue (num, kCFNumberCGFloatType, &floatval)) @@ -1908,7 +1907,7 @@ if (! traits) goto err; - for (i = 0; i < sizeof (numeric_traits) / sizeof (numeric_traits[0]); i++) + for (i = 0; i < EARRAYSIZE (numeric_traits); i++) { tmp = AREF (spec, numeric_traits[i].index); if (INTEGERP (tmp)) @@ -3584,7 +3583,7 @@ { attributes = CFDictionaryCreate (NULL, (const void **) keys, (const void **) values, - sizeof (keys) / sizeof (keys[0]), + EARRAYSIZE (keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFRelease (values[1]); @@ -3795,8 +3794,8 @@ CTLineRef ctline = NULL; string = CFStringCreateWithCharacters (NULL, characters, - sizeof (characters) - / sizeof (characters[0])); + EARRAYSIZE (characters)); + if (string) { CTGlyphInfoRef glyph_info = @@ -3811,7 +3810,7 @@ attributes = CFDictionaryCreate (NULL, (const void **) keys, (const void **) values, - sizeof (keys) / sizeof (keys[0]), + EARRAYSIZE (keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFRelease (glyph_info); === modified file 'src/msdos.c' --- src/msdos.c 2014-01-01 07:43:34 +0000 +++ src/msdos.c 2014-04-03 07:14:02 +0000 @@ -564,7 +564,7 @@ }; int i = 0; - while (i < sizeof (std_dimension) / sizeof (std_dimension[0])) + while (i < EARRAYSIZE (std_dimension)) { if (std_dimension[i].need_vga <= have_vga && std_dimension[i].rows >= *rows) @@ -3465,7 +3465,7 @@ static const char * const tempdirs[] = { "$TMPDIR", "$TEMP", "$TMP", "c:/" }; - const int imax = sizeof (tempdirs) / sizeof (tempdirs[0]); + const int imax = EARRAYSIZE (tempdirs); /* Make sure they have a usable $TMPDIR. Many Emacs functions use temporary files and assume "/tmp" if $TMPDIR is unset, which === modified file 'src/nsfns.m' --- src/nsfns.m 2014-02-11 18:05:01 +0000 +++ src/nsfns.m 2014-04-03 07:14:02 +0000 @@ -1024,7 +1024,7 @@ }; int i; - for (i = 0; i < sizeof (r)/sizeof (r[0]); ++i) + for (i = 0; i < EARRAYSIZE (r); ++i) { if (NILP (Fassq (r[i].tem, parms))) { === modified file 'src/nsterm.m' --- src/nsterm.m 2014-03-30 17:21:20 +0000 +++ src/nsterm.m 2014-04-03 07:14:02 +0000 @@ -2012,8 +2012,7 @@ Internal call used by NSView-keyDown. -------------------------------------------------------------------------- */ { - const unsigned last_keysym = (sizeof (convert_ns_to_X_keysym) - / sizeof (convert_ns_to_X_keysym[0])); + const unsigned last_keysym = EARRAYSIZE (convert_ns_to_X_keysym); unsigned keysym; /* An array would be faster, but less easy to read. */ for (keysym = 0; keysym < last_keysym; keysym += 2) === modified file 'src/sysdep.c' --- src/sysdep.c 2014-03-26 10:21:55 +0000 +++ src/sysdep.c 2014-04-03 07:14:02 +0000 @@ -255,7 +255,7 @@ #endif /* not DOS_NT */ } - baud_rate = (emacs_ospeed < sizeof baud_convert / sizeof baud_convert[0] + baud_rate = (emacs_ospeed < EARRAYSIZE (baud_convert) ? baud_convert[emacs_ospeed] : 9600); if (baud_rate == 0) baud_rate = 1200; === modified file 'src/term.c' --- src/term.c 2014-03-25 14:43:26 +0000 +++ src/term.c 2014-04-03 07:14:02 +0000 @@ -1339,7 +1339,7 @@ if (!KEYMAPP (KVAR (kboard, Vinput_decode_map))) kset_input_decode_map (kboard, Fmake_sparse_keymap (Qnil)); - for (i = 0; i < (sizeof (keys) / sizeof (keys[0])); i++) + for (i = 0; i < EARRAYSIZE (keys); i++) { char *sequence = tgetstr (keys[i].cap, address); if (sequence) === modified file 'src/unexcw.c' --- src/unexcw.c 2014-03-21 07:26:47 +0000 +++ src/unexcw.c 2014-04-03 07:14:02 +0000 @@ -81,8 +81,7 @@ #endif assert (exe_header_buffer->file_header.f_nscns > 0); assert (exe_header_buffer->file_header.f_nscns <= - sizeof (exe_header_buffer->section_header) / - sizeof (exe_header_buffer->section_header[0])); + EARRAYSIZE (exe_header_buffer->section_header)); assert (exe_header_buffer->file_header.f_opthdr > 0); ret = === modified file 'src/w32.c' --- src/w32.c 2014-03-26 10:21:55 +0000 +++ src/w32.c 2014-04-03 07:14:02 +0000 @@ -1707,7 +1707,7 @@ /* We maintain 1-sec samples for the last 16 minutes in a circular buffer. */ static struct load_sample samples[16*60]; static int first_idx = -1, last_idx = -1; -static int max_idx = sizeof (samples) / sizeof (samples[0]); +static int max_idx = EARRAYSIZE (samples); static int buf_next (int from) @@ -2511,7 +2511,7 @@ int i; - const int imax = sizeof (tempdirs) / sizeof (tempdirs[0]); + const int imax = EARRAYSIZE (tempdirs); /* Implementation note: This function explicitly works with ANSI file names, not with UTF-8 encoded file names. This is because @@ -2584,7 +2584,7 @@ {"LANG", NULL}, }; -#define N_ENV_VARS sizeof (dflt_envvars)/sizeof (dflt_envvars[0]) +#define N_ENV_VARS EARRAYSIZE (dflt_envvars) /* We need to copy dflt_envvars[] and work on the copy because we don't want the dumped Emacs to inherit the values of === modified file 'src/w32fns.c' --- src/w32fns.c 2014-03-26 10:21:55 +0000 +++ src/w32fns.c 2014-04-03 07:14:02 +0000 @@ -723,8 +723,7 @@ cmap = Qnil; - for (i = 0; i < sizeof (w32_color_map) / sizeof (w32_color_map[0]); - pc++, i++) + for (i = 0; i < EARRAYSIZE (w32_color_map); pc++, i++) cmap = Fcons (Fcons (build_string (pc->name), make_number (pc->colorref)), cmap); === modified file 'src/xfaces.c' --- src/xfaces.c 2014-02-04 07:36:58 +0000 +++ src/xfaces.c 2014-04-03 07:14:02 +0000 @@ -515,7 +515,7 @@ fputc ('\n', stderr); - for (i = n = 0; i < sizeof color_count / sizeof color_count[0]; ++i) + for (i = n = 0; i < EARRAYSIZE (color_count); ++i) if (color_count[i]) { fprintf (stderr, "%3d: %5d", i, color_count[i]); === modified file 'src/xfns.c' --- src/xfns.c 2014-03-23 11:44:21 +0000 +++ src/xfns.c 2014-04-03 07:14:02 +0000 @@ -1944,8 +1944,7 @@ best_xim_style (XIMStyles *xim) { int i, j; - int nr_supported = - sizeof (supported_xim_styles) / sizeof (supported_xim_styles[0]); + int nr_supported = EARRAYSIZE (supported_xim_styles); for (i = 0; i < nr_supported; ++i) for (j = 0; j < xim->count_styles; ++j) === modified file 'src/xterm.c' --- src/xterm.c 2014-04-02 16:17:08 +0000 +++ src/xterm.c 2014-04-03 07:14:02 +0000 @@ -10103,7 +10103,7 @@ }; int i; - const int atom_count = sizeof (atom_refs) / sizeof (atom_refs[0]); + const int atom_count = EARRAYSIZE (atom_refs); /* 1 for _XSETTINGS_SN */ const int total_atom_count = 1 + atom_count; Atom *atoms_return = xmalloc (total_atom_count * sizeof *atoms_return); ------------------------------------------------------------ revno: 116934 committer: Glenn Morris branch nick: trunk timestamp: Wed 2014-04-02 21:16:18 -0400 message: * make-dist: Further update AC_INIT regexp. diff: === modified file 'ChangeLog' --- ChangeLog 2014-04-02 15:14:50 +0000 +++ ChangeLog 2014-04-03 01:16:18 +0000 @@ -1,3 +1,7 @@ +2014-04-03 Glenn Morris + + * make-dist: Further update AC_INIT regexp. + 2014-04-02 Glenn Morris * configure.ac: Make the final "Does Emacs use Gsettings" message === modified file 'make-dist' --- make-dist 2014-03-29 00:14:16 +0000 +++ make-dist 2014-04-03 01:16:18 +0000 @@ -160,7 +160,7 @@ ### Find out which version of Emacs this is. version=` - sed -n 's/^AC_INIT(GNU Emacs,[ ]*\([^ )]*\).*/\1/p' &2 ------------------------------------------------------------ revno: 116933 committer: Daniel Colascione branch nick: trunk timestamp: Wed 2014-04-02 17:44:00 -0700 message: Add missing src/ChangeLog text that somehow ended up in last commit message instead diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-04-03 00:18:08 +0000 +++ src/ChangeLog 2014-04-03 00:44:00 +0000 @@ -5,6 +5,16 @@ * lisp.h (EARRAYSIZE): New macro. + * alloc.c: Include execinfo.h if available. + (SUSPICIOUS_OBJECT_CHECKING): New macro; define unconditionally. + (suspicious_free_record): New structure. + (suspicious_objects,suspicious_object_index) + (suspicious_free_history, suspicious_free_history_index): New + variables. + (find_suspicious_object_in_range,detect_suspicious_free) + (Fsuspicious_object): New functions. + (cleanup_vector): Call find_suspicious_object_in_range. + 2014-04-02 Martin Rudalics * xterm.c (x_new_font): Don't calculate non-toolkit scrollbar ------------------------------------------------------------ revno: 116932 committer: Daniel Colascione branch nick: debug timestamp: Wed 2014-04-02 17:37:51 -0700 message: Fix typo * alloc.c: Include execinfo.h if available. (SUSPICIOUS_OBJECT_CHECKING): New macro; define unconditionally. (suspicious_free_record): New structure. (suspicious_objects,suspicious_object_index) (suspicious_free_history, suspicious_free_history_index): New variables. (find_suspicious_object_in_range,detect_suspicious_free,Fsuspicious_object): New functions. (cleanup_vector): Call find_suspicious_object_in_range. diff: === modified file 'src/alloc.c' --- src/alloc.c 2014-04-03 00:18:08 +0000 +++ src/alloc.c 2014-04-03 00:37:51 +0000 @@ -6862,7 +6862,7 @@ suspicious_free_history_index = 0; } - memset (rec, 0, sizeof (rec)); + memset (rec, 0, sizeof (*rec)); rec->suspicious_object = ptr; #ifdef HAVE_EXECINFO_H backtrace (&rec->backtrace[0], EARRAYSIZE (rec->backtrace)); ------------------------------------------------------------ revno: 116931 committer: Daniel Colascione branch nick: debug timestamp: Wed 2014-04-02 17:18:08 -0700 message: Add GC bug investigation code diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-04-02 17:21:34 +0000 +++ lisp/ChangeLog 2014-04-03 00:18:08 +0000 @@ -1,3 +1,9 @@ +2014-04-03 Daniel Colascione + + * subr.el (set-transient-map): Remove rms's workaround entirely; + use new `suspicious-object' subr to mark our lambda for closer + scrutiny during gc. + 2014-04-02 Richard Stallman * subr.el (set-transient-map): Comment out previous change. === modified file 'lisp/subr.el' --- lisp/subr.el 2014-04-02 17:21:34 +0000 +++ lisp/subr.el 2014-04-03 00:18:08 +0000 @@ -4292,33 +4292,34 @@ ;; Don't use letrec, because equal (in add/remove-hook) would get trapped ;; in a cycle. (fset clearfun - (lambda () - (with-demoted-errors "set-transient-map PCH: %S" - (unless (cond - ((not (eq map (cadr overriding-terminal-local-map))) - ;; There's presumably some other transient-map in - ;; effect. Wait for that one to terminate before we - ;; remove ourselves. - ;; For example, if isearch and C-u both use transient - ;; maps, then the lifetime of the C-u should be nested - ;; within isearch's, so the pre-command-hook of - ;; isearch should be suspended during the C-u one so - ;; we don't exit isearch just because we hit 1 after - ;; C-u and that 1 exits isearch whereas it doesn't - ;; exit C-u. - t) - ((null keep-pred) nil) - ((eq t keep-pred) - (eq this-command - (lookup-key map (this-command-keys-vector)))) - (t (funcall keep-pred))) - (internal-pop-keymap map 'overriding-terminal-local-map) - (remove-hook 'pre-command-hook clearfun) - (when on-exit (funcall on-exit)) -;; Comment out the fset if you want to debug the GC bug. + (suspicious-object + (lambda () + (with-demoted-errors "set-transient-map PCH: %S" + (unless (cond + ((not (eq map (cadr overriding-terminal-local-map))) + ;; There's presumably some other transient-map in + ;; effect. Wait for that one to terminate before we + ;; remove ourselves. + ;; For example, if isearch and C-u both use transient + ;; maps, then the lifetime of the C-u should be nested + ;; within isearch's, so the pre-command-hook of + ;; isearch should be suspended during the C-u one so + ;; we don't exit isearch just because we hit 1 after + ;; C-u and that 1 exits isearch whereas it doesn't + ;; exit C-u. + t) + ((null keep-pred) nil) + ((eq t keep-pred) + (eq this-command + (lookup-key map (this-command-keys-vector)))) + (t (funcall keep-pred))) + (internal-pop-keymap map 'overriding-terminal-local-map) + (remove-hook 'pre-command-hook clearfun) + (when on-exit (funcall on-exit)) + ;; Comment out the fset if you want to debug the GC bug. ;;; (fset clearfun nil) ;;; (set clearfun nil) - )))) + ))))) (add-hook 'pre-command-hook clearfun) (internal-push-keymap map 'overriding-terminal-local-map))) === modified file 'src/ChangeLog' --- src/ChangeLog 2014-04-02 16:17:08 +0000 +++ src/ChangeLog 2014-04-03 00:18:08 +0000 @@ -1,3 +1,10 @@ +2014-04-03 Daniel Colascione + + * data.c (Ffset): Abort if we're trying to set a function call to + a dead lisp object. + + * lisp.h (EARRAYSIZE): New macro. + 2014-04-02 Martin Rudalics * xterm.c (x_new_font): Don't calculate non-toolkit scrollbar === modified file 'src/alloc.c' --- src/alloc.c 2014-03-23 21:58:19 +0000 +++ src/alloc.c 2014-04-03 00:18:08 +0000 @@ -48,6 +48,10 @@ #include +#ifdef HAVE_EXECINFO_H +#include /* For backtrace */ +#endif + #if (defined ENABLE_CHECKING \ && defined HAVE_VALGRIND_VALGRIND_H \ && !defined USE_VALGRIND) @@ -192,6 +196,36 @@ const char *pending_malloc_warning; +#if 0 /* Normally, pointer sanity only on request... */ +#ifdef ENABLE_CHECKING +#define SUSPICIOUS_OBJECT_CHECKING 1 +#endif +#endif + +/* ... but unconditionally use SUSPICIOUS_OBJECT_CHECKING while the GC + bug is unresolved. */ +#define SUSPICIOUS_OBJECT_CHECKING 1 + +#ifdef SUSPICIOUS_OBJECT_CHECKING +struct suspicious_free_record { + void* suspicious_object; +#ifdef HAVE_EXECINFO_H + void* backtrace[128]; +#endif +}; +static void* suspicious_objects[32]; +static int suspicious_object_index; +struct suspicious_free_record suspicious_free_history[64]; +static int suspicious_free_history_index; +/* Find the first currently-monitored suspicious pointer in range + [begin,end) or NULL if no such pointer exists. */ +static void* find_suspicious_object_in_range (void* begin, void* end); +static void detect_suspicious_free (void* ptr); +#else +#define find_suspicious_object_in_range(begin, end) NULL +#define detect_suspicious_free(ptr) (void) +#endif + /* Maximum amount of C stack to save when a GC happens. */ #ifndef MAX_SAVE_STACK @@ -2922,6 +2956,7 @@ static void cleanup_vector (struct Lisp_Vector *vector) { + detect_suspicious_free (vector); if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_FONT) && ((vector->header.size & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX)) @@ -3081,6 +3116,9 @@ mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); #endif + if (find_suspicious_object_in_range (p, (char*)p + nbytes)) + emacs_abort (); + consing_since_gc += nbytes; vector_cells_consed += len; } @@ -3780,6 +3818,7 @@ Vmemory_full = Qnil; #endif } + /************************************************************************ C Stack Marking @@ -6787,6 +6826,71 @@ return found; } +#ifdef SUSPICIOUS_OBJECT_CHECKING + +static void* +find_suspicious_object_in_range (void* begin, void* end) +{ + char* begin_a = begin; + char* end_a = end; + int i; + + for (i = 0; i < EARRAYSIZE (suspicious_objects); ++i) { + char* suspicious_object = suspicious_objects[i]; + if (begin_a <= suspicious_object && suspicious_object < end_a) + return suspicious_object; + } + + return NULL; +} + +static void +detect_suspicious_free (void* ptr) +{ + int i; + struct suspicious_free_record* rec; + + eassert (ptr != NULL); + + for (i = 0; i < EARRAYSIZE (suspicious_objects); ++i) + if (suspicious_objects[i] == ptr) + { + rec = &suspicious_free_history[suspicious_free_history_index++]; + if (suspicious_free_history_index == + EARRAYSIZE (suspicious_free_history)) + { + suspicious_free_history_index = 0; + } + + memset (rec, 0, sizeof (rec)); + rec->suspicious_object = ptr; +#ifdef HAVE_EXECINFO_H + backtrace (&rec->backtrace[0], EARRAYSIZE (rec->backtrace)); +#endif + suspicious_objects[i] = NULL; + } +} + +#endif /* SUSPICIOUS_OBJECT_CHECKING */ + +DEFUN ("suspicious-object", Fsuspicious_object, Ssuspicious_object, 1, 1, 0, + doc: /* Return OBJ, maybe marking it for extra scrutiny. +If Emacs is compiled with suspicous object checking, capture +a stack trace when OBJ is freed in order to help track down +garbage collection bugs. Otherwise, do nothing and return OBJ. */) + (Lisp_Object obj) +{ +#ifdef SUSPICIOUS_OBJECT_CHECKING + /* Right now, we care only about vectors. */ + if (VECTORLIKEP (obj)) { + suspicious_objects[suspicious_object_index++] = XVECTOR (obj); + if (suspicious_object_index == EARRAYSIZE (suspicious_objects)) + suspicious_object_index = 0; + } +#endif + return obj; +} + #ifdef ENABLE_CHECKING bool suppress_checking; @@ -6957,6 +7061,7 @@ defsubr (&Sgarbage_collect); defsubr (&Smemory_limit); defsubr (&Smemory_use_counts); + defsubr (&Ssuspicious_object); #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES defsubr (&Sgc_status); === modified file 'src/data.c' --- src/data.c 2014-02-20 07:38:47 +0000 +++ src/data.c 2014-04-03 00:18:08 +0000 @@ -727,6 +727,11 @@ if (AUTOLOADP (function)) Fput (symbol, Qautoload, XCDR (function)); + /* Convert to eassert or remove after GC bug is found. In the + meantime, check unconditionally, at a slight perf hit. */ + if (valid_lisp_object_p (definition) < 1) + emacs_abort (); + set_symbol_function (symbol, definition); return definition; === modified file 'src/lisp.h' --- src/lisp.h 2014-03-27 22:52:14 +0000 +++ src/lisp.h 2014-04-03 00:18:08 +0000 @@ -58,6 +58,9 @@ #define max(a, b) ((a) > (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b)) +/* Find number of elements in array */ +#define EARRAYSIZE(arr) (sizeof (arr) / sizeof ((arr)[0])) + /* EMACS_INT - signed integer wide enough to hold an Emacs value EMACS_INT_MAX - maximum value of EMACS_INT; can be used in #if pI - printf length modifier for EMACS_INT ------------------------------------------------------------ revno: 116930 author: Richard Stallman committer: Richard Stallman branch nick: trunk timestamp: Wed 2014-04-02 13:21:34 -0400 message: Revert subr.el workaround for GC bug. * subr.el (set-transient-map): Comment out previous change. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-04-02 15:14:50 +0000 +++ lisp/ChangeLog 2014-04-02 17:21:34 +0000 @@ -1,3 +1,7 @@ +2014-04-02 Richard Stallman + + * subr.el (set-transient-map): Comment out previous change. + 2014-04-02 Glenn Morris * menu-bar.el (menu-bar-file-menu): === modified file 'lisp/subr.el' --- lisp/subr.el 2014-03-22 22:12:52 +0000 +++ lisp/subr.el 2014-04-02 17:21:34 +0000 @@ -4316,8 +4316,9 @@ (remove-hook 'pre-command-hook clearfun) (when on-exit (funcall on-exit)) ;; Comment out the fset if you want to debug the GC bug. - (fset clearfun nil) - (set clearfun nil))))) +;;; (fset clearfun nil) +;;; (set clearfun nil) + )))) (add-hook 'pre-command-hook clearfun) (internal-push-keymap map 'overriding-terminal-local-map))) ------------------------------------------------------------ revno: 116929 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2014-04-02 20:17:08 +0400 message: * xterm.c (x_term_init) [USE_LUCID]: Fix minor memory leak. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-04-02 15:14:50 +0000 +++ src/ChangeLog 2014-04-02 16:17:08 +0000 @@ -23,6 +23,8 @@ (font_matching_entity): Likewise. If matching entity is found, insert 1-item vector with this entity instead of entity itself (Bug#17125). + * xterm.c (x_term_init) [USE_LUCID]: Fix minor memory leak. + 2014-04-01 Paul Eggert * fns.c (validate_subarray): Rename from validate_substring, === modified file 'src/xterm.c' --- src/xterm.c 2014-04-02 15:14:50 +0000 +++ src/xterm.c 2014-04-02 16:17:08 +0000 @@ -10162,6 +10162,7 @@ #ifdef USE_LUCID { + XFontStruct *xfont = NULL; XrmValue d, fr, to; Font font; @@ -10175,8 +10176,10 @@ x_catch_errors (dpy); if (!XtCallConverter (dpy, XtCvtStringToFont, &d, 1, &fr, &to, NULL)) emacs_abort (); - if (x_had_errors_p (dpy) || !XQueryFont (dpy, font)) + if (x_had_errors_p (dpy) || !((xfont = XQueryFont (dpy, font)))) XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15"); + if (xfont) + XFreeFont (dpy, xfont); x_uncatch_errors (); } #endif ------------------------------------------------------------ revno: 116928 [merge] committer: Juanma Barranquero branch nick: trunk timestamp: Wed 2014-04-02 17:14:50 +0200 message: Merge from emacs-24; up to r116894 diff: === modified file 'ChangeLog' --- ChangeLog 2014-03-31 05:02:08 +0000 +++ ChangeLog 2014-04-02 15:14:50 +0000 @@ -1,3 +1,8 @@ +2014-04-02 Glenn Morris + + * configure.ac: Make the final "Does Emacs use Gsettings" message + consistent with src/config.h. + 2014-03-31 Jan Djärv * configure.ac: Fix errors from previous checkin (GSettings check). === modified file 'configure.ac' --- configure.ac 2014-04-01 16:17:19 +0000 +++ configure.ac 2014-04-02 15:14:50 +0000 @@ -2438,7 +2438,6 @@ old_LIBS=$LIBS LIBS="$LIBS $GSETTINGS_LIBS" AC_MSG_CHECKING([whether GSettings is in gio]) - GSETTINGS_COMPILES=no AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[/* Check that gsettings really is present. */ @@ -2449,10 +2448,10 @@ GSettings *settings; GVariant *val = g_settings_get_value (settings, ""); ]])], - [GSETTINGS_COMPILES=yes]) - AC_MSG_RESULT([$GSETTINGS_COMPILES]) + [], HAVE_GSETTINGS=no) + AC_MSG_RESULT([$HAVE_GSETTINGS]) - if test "$GSETTINGS_COMPILES" = "yes"; then + if test "$HAVE_GSETTINGS" = "yes"; then AC_DEFINE(HAVE_GSETTINGS, 1, [Define to 1 if using GSettings.]) SETTINGS_CFLAGS="$GSETTINGS_CFLAGS" SETTINGS_LIBS="$GSETTINGS_LIBS" === modified file 'etc/CONTRIBUTE' --- etc/CONTRIBUTE 2014-01-12 16:37:42 +0000 +++ etc/CONTRIBUTE 2014-03-28 19:44:37 +0000 @@ -54,11 +54,15 @@ require that the copyright be assigned to the FSF. For the reasons behind this, see: http://www.gnu.org/licenses/why-assign.html . -Copyright assignment is a simple process. If you live in the US, you +Copyright assignment is a simple process. Residents of some countries can do it entirely electronically. We can help you get started, and answer any questions you may have (or point you to the people with the answers), at the emacs-devel@gnu.org mailing list. +(Please note: general discussion about why some GNU projects ask +for a copyright assignment is off-topic for emacs-devel. +See gnu-misc-discuss instead.) + A copyright disclaimer is also a possibility, but we prefer an assignment. Note that the disclaimer, like an assignment, involves you sending signed paperwork to the FSF (simply saying "this is in the public domain" === modified file 'etc/NEWS' --- etc/NEWS 2014-04-01 13:20:20 +0000 +++ etc/NEWS 2014-04-02 15:14:50 +0000 @@ -1455,19 +1455,22 @@ argument, with the same interpretation as the returned value of `visited-file-modtime'. -** Autorevert changes +** Revert and Autorevert changes + +*** The default value of `revert-buffer-function' is no longer nil. +Instead it defaults to a function that does what the nil value used to. +The same applies for `revert-buffer-insert-file-contents-function'. --- -*** If Emacs is compiled with file notification support, notifications -are used instead of checking the time stamp of the files. You can -disable this by setting the user option `auto-revert-use-notify' to -nil. Alternatively, a regular expression of directories to be -excluded from file notifications can be specified by +*** If Emacs is compiled with file notification support, it uses notifications +instead of checking file time stamps. To disable this, set the user option +`auto-revert-use-notify' to nil. Alternatively, you can specify a regular +expression matching directories to be excluded from file notifications via `auto-revert-notify-exclude-dir-regexp'. --- *** The new user option `auto-revert-remote-files' enables reversion -of remote files when set to non-nil. +of remote files, if set to non-nil. ** Face changes === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-04-02 09:59:06 +0000 +++ lisp/ChangeLog 2014-04-02 15:14:50 +0000 @@ -1,3 +1,26 @@ +2014-04-02 Glenn Morris + + * menu-bar.el (menu-bar-file-menu): + * vc/ediff.el (ediff-current-file): + Update for revert-buffer-function no longer being nil by default. + + * simple.el (command-execute): Respect nil disabled-command-function. + +2014-04-02 Nicolas Richard + + * simple.el (command-execute): Do not execute the command when it + is disabled; fixes thinko in 2013-02-20 conversion from C. (Bug#17151) + +2014-04-02 Juri Linkov + + * dired-aux.el (dired-compress-file): Don't use string-match-p + because its match data is used afterwards. + +2014-04-02 Stefan Monnier + + * emacs-lisp/package.el (package-built-in-p): Treat a min-version of + 0 like nil. + 2014-04-02 João Távora * elec-pair.el (electric-pair-inhibit-if-helps-balance): Inhibit @@ -111,8 +134,8 @@ 2014-03-27 Dmitry Gutov - * progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight - special globals with font-lock-builtin-face. (Bug#17057) + * progmodes/ruby-mode.el (ruby-font-lock-keywords): + Highlight special globals with font-lock-builtin-face. (Bug#17057) * progmodes/ruby-mode.el (ruby-syntax-propertize-function): Don't propertize `?' or `!' as symbol constituent when after === modified file 'lisp/cedet/ede/dired.el' --- lisp/cedet/ede/dired.el 2014-03-29 02:59:51 +0000 +++ lisp/cedet/ede/dired.el 2014-04-02 15:14:50 +0000 @@ -3,7 +3,7 @@ ;; Copyright (C) 1998-2000, 2003, 2009-2014 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam -;; Version: 0.4 +;; Old-Version: 0.4 ;; Keywords: project, make ;; This file is part of GNU Emacs. === modified file 'lisp/cedet/ede/project-am.el' --- lisp/cedet/ede/project-am.el 2014-01-01 07:43:34 +0000 +++ lisp/cedet/ede/project-am.el 2014-03-31 17:01:19 +0000 @@ -1,10 +1,10 @@ ;;; project-am.el --- A project management scheme based on automake files. -;; Copyright (C) 1998-2000, 2003, 2005, 2007-2014 Free Software -;; Foundation, Inc. +;; Copyright (C) 1998-2000, 2003, 2005, 2007-2014 +;; Free Software Foundation, Inc. ;; Author: Eric M. Ludlam -;; Version: 0.0.3 +;; Old-Version: 0.0.3 ;; Keywords: project, make ;; This file is part of GNU Emacs. === modified file 'lisp/dired-aux.el' --- lisp/dired-aux.el 2014-03-22 23:56:19 +0000 +++ lisp/dired-aux.el 2014-04-02 15:14:50 +0000 @@ -887,7 +887,7 @@ ;; See if any suffix rule matches this file name. (while suffixes (let (case-fold-search) - (if (string-match-p (car (car suffixes)) file) + (if (string-match (car (car suffixes)) file) (setq suffix (car suffixes) suffixes nil)) (setq suffixes (cdr suffixes)))) ;; If so, compute desired new name. === modified file 'lisp/dired.el' --- lisp/dired.el 2014-03-23 10:24:01 +0000 +++ lisp/dired.el 2014-04-02 15:14:50 +0000 @@ -3867,7 +3867,7 @@ ;;; Start of automatically extracted autoloads. -;;;### (autoloads nil "dired-aux" "dired-aux.el" "edcfeacd242f6163e847594870855b9e") +;;;### (autoloads nil "dired-aux" "dired-aux.el" "6969bb4414a8a31b91342ab922a94efb") ;;; Generated autoloads from dired-aux.el (autoload 'dired-diff "dired-aux" "\ === modified file 'lisp/emacs-lisp/package.el' --- lisp/emacs-lisp/package.el 2014-03-26 15:21:17 +0000 +++ lisp/emacs-lisp/package.el 2014-03-28 22:47:46 +0000 @@ -536,7 +536,7 @@ (let ((bi (assq package package--builtin-versions))) (cond (bi (version-list-<= min-version (cdr bi))) - (min-version nil) + ((remove 0 min-version) nil) (t (require 'finder-inf nil t) ; For `package--builtins'. (assq package package--builtins)))))) === modified file 'lisp/erc/erc-lang.el' --- lisp/erc/erc-lang.el 2014-02-10 01:34:22 +0000 +++ lisp/erc/erc-lang.el 2014-03-31 19:01:59 +0000 @@ -4,7 +4,7 @@ ;; Author: Alex Schroeder ;; Maintainer: emacs-devel@gnu.org -;; Version: 1.0.0 +;; Old-Version: 1.0.0 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcLang ;; Keywords: comm languages processes === modified file 'lisp/erc/erc-list.el' --- lisp/erc/erc-list.el 2014-02-10 01:34:22 +0000 +++ lisp/erc/erc-list.el 2014-03-31 19:01:59 +0000 @@ -4,7 +4,7 @@ ;; Author: Tom Tromey ;; Maintainer: emacs-devel@gnu.org -;; Version: 0.1 +;; Old-Version: 0.1 ;; Keywords: comm ;; This file is part of GNU Emacs. === modified file 'lisp/gnus/nnmairix.el' --- lisp/gnus/nnmairix.el 2014-01-01 07:43:34 +0000 +++ lisp/gnus/nnmairix.el 2014-03-31 19:01:59 +0000 @@ -4,7 +4,7 @@ ;; Author: David Engster ;; Keywords: mail searching -;; Version: 0.6 +;; Old-Version: 0.6 ;; This file is part of GNU Emacs. === modified file 'lisp/menu-bar.el' --- lisp/menu-bar.el 2014-02-10 01:34:22 +0000 +++ lisp/menu-bar.el 2014-04-02 07:07:11 +0000 @@ -149,8 +149,11 @@ :help "Recover edits from a crashed session")) (bindings--define-key menu [revert-buffer] '(menu-item "Revert Buffer" revert-buffer - :enable (or revert-buffer-function - revert-buffer-insert-file-contents-function + :enable (or (not (eq revert-buffer-function + 'revert-buffer--default)) + (not (eq + revert-buffer-insert-file-contents-function + 'revert-buffer-insert-file-contents--default-function)) (and buffer-file-number (or (buffer-modified-p) (not (verify-visited-file-modtime === modified file 'lisp/progmodes/cc-guess.el' --- lisp/progmodes/cc-guess.el 2014-01-01 07:43:34 +0000 +++ lisp/progmodes/cc-guess.el 2014-03-31 19:01:59 +0000 @@ -1,13 +1,12 @@ ;;; cc-guess.el --- guess indentation values by scanning existing code -;; Copyright (C) 1985, 1987, 1992-2006, 2011-2014 Free Software -;; Foundation, Inc. +;; Copyright (C) 1985, 1987, 1992-2006, 2011-2014 +;; Free Software Foundation, Inc. ;; Author: 1994-1995 Barry A. Warsaw ;; 2011- Masatake YAMATO ;; Maintainer: bug-cc-mode@gnu.org ;; Created: August 1994, split from cc-mode.el -;; Version: See cc-mode.el ;; Keywords: c languages oop ;; This file is part of GNU Emacs. === modified file 'lisp/simple.el' --- lisp/simple.el 2014-03-31 00:35:12 +0000 +++ lisp/simple.el 2014-04-02 15:14:50 +0000 @@ -1628,36 +1628,37 @@ (prog1 prefix-arg (setq current-prefix-arg prefix-arg) (setq prefix-arg nil))))) - (and (symbolp cmd) - (get cmd 'disabled) - ;; FIXME: Weird calling convention! - (run-hooks 'disabled-command-function)) - (let ((final cmd)) - (while - (progn - (setq final (indirect-function final)) - (if (autoloadp final) - (setq final (autoload-do-load final cmd))))) - (cond - ((arrayp final) - ;; If requested, place the macro in the command history. For - ;; other sorts of commands, call-interactively takes care of this. - (when record-flag - (push `(execute-kbd-macro ,final ,prefixarg) command-history) - ;; Don't keep command history around forever. - (when (and (numberp history-length) (> history-length 0)) - (let ((cell (nthcdr history-length command-history))) - (if (consp cell) (setcdr cell nil))))) - (execute-kbd-macro final prefixarg)) - (t - ;; Pass `cmd' rather than `final', for the backtrace's sake. - (prog1 (call-interactively cmd record-flag keys) - (when (and (symbolp cmd) - (get cmd 'byte-obsolete-info) - (not (get cmd 'command-execute-obsolete-warned))) - (put cmd 'command-execute-obsolete-warned t) - (message "%s" (macroexp--obsolete-warning - cmd (get cmd 'byte-obsolete-info) "command"))))))))) + (if (and (symbolp cmd) + (get cmd 'disabled) + disabled-command-function) + ;; FIXME: Weird calling convention! + (run-hooks 'disabled-command-function) + (let ((final cmd)) + (while + (progn + (setq final (indirect-function final)) + (if (autoloadp final) + (setq final (autoload-do-load final cmd))))) + (cond + ((arrayp final) + ;; If requested, place the macro in the command history. For + ;; other sorts of commands, call-interactively takes care of this. + (when record-flag + (push `(execute-kbd-macro ,final ,prefixarg) command-history) + ;; Don't keep command history around forever. + (when (and (numberp history-length) (> history-length 0)) + (let ((cell (nthcdr history-length command-history))) + (if (consp cell) (setcdr cell nil))))) + (execute-kbd-macro final prefixarg)) + (t + ;; Pass `cmd' rather than `final', for the backtrace's sake. + (prog1 (call-interactively cmd record-flag keys) + (when (and (symbolp cmd) + (get cmd 'byte-obsolete-info) + (not (get cmd 'command-execute-obsolete-warned))) + (put cmd 'command-execute-obsolete-warned t) + (message "%s" (macroexp--obsolete-warning + cmd (get cmd 'byte-obsolete-info) "command")))))))))) (defvar minibuffer-history nil "Default minibuffer history list. === modified file 'lisp/vc/ediff.el' --- lisp/vc/ediff.el 2014-01-01 07:43:34 +0000 +++ lisp/vc/ediff.el 2014-04-02 07:07:11 +0000 @@ -367,8 +367,10 @@ This command can be used instead of `revert-buffer'. If there is nothing to revert then this command fails." (interactive) - (unless (or revert-buffer-function - revert-buffer-insert-file-contents-function + ;; This duplicates code from menu-bar.el. + (unless (or (not (eq revert-buffer-function 'revert-buffer--default)) + (not (eq revert-buffer-insert-file-contents-function + 'revert-buffer-insert-file-contents--default-function)) (and buffer-file-number (or (buffer-modified-p) (not (verify-visited-file-modtime === modified file 'nt/INSTALL' --- nt/INSTALL 2014-02-18 00:45:43 +0000 +++ nt/INSTALL 2014-03-30 18:55:19 +0000 @@ -9,15 +9,15 @@ supported (but the Emacs binary produced by this build will run on Windows 9X as well). + Do not use this recipe with Cygwin. For building on Cygwin, use the + normal installation instructions, ../INSTALL. + * For the brave (a.k.a. "impatient"): For those who have a working MSYS/MinGW development environment and are comfortable with running Posix configure scripts, here are the concise instructions for configuring and building the native Windows - binary of Emacs with these tools. - - Do not use this recipe with Cygwin. For building on Cygwin, use the - normal installation instructions, ../INSTALL. + binary of Emacs with these tools: 0. Start the MSYS Bash window. Everything else below is done from that window's Bash prompt. @@ -49,7 +49,7 @@ You can pass other options to the configure script. Here's a typical example (for an in-place debug build): - CPPFLAGS='-DGLYPH_DEBUG=1' CFLAGS='-O0 -g3' ./configure --prefix=/d/usr/emacs --enable-checking + CFLAGS='-O0 -g3' ./configure --prefix=/d/usr/emacs --enable-checking='yes,glyphs' 3. After the configure script finishes, it should display the resulting configuration. After that, type @@ -82,7 +82,7 @@ A correct installation makes all the rest almost trivial; a botched installation will likely make you miserable for quite some time. - There are two alternative to installing MinGW + MSYS: using the GUI + There are two alternatives to installing MinGW + MSYS: using the GUI installer, called mingw-get, provided by the MinGW project, or manual installation. The next two sections describe each one of these. @@ -169,7 +169,7 @@ you are building from the repository: . Texinfo (needed to produce the Info manuals when building from - bzr, and for "make install") + bzr/git, and for "make install") Available from http://sourceforge.net/projects/ezwinports/files/. @@ -373,11 +373,11 @@ A few frequently used options are needed when you want to produce an unoptimized binary with runtime checks enabled: - CPPFLAGS='-DGLYPH_DEBUG=1' CFLAGS='-O0 -g3' ./configure --prefix=PREFIX --enable-checking + CFLAGS='-O0 -g3' ./configure --prefix=PREFIX --enable-checking='yes,glyphs' Once invoked, the configure script will run for some time, and, if successful, will eventually produce a summary of the configuration - like this: + similar to this: Configured for `i686-pc-mingw32'. @@ -724,43 +724,6 @@ You need the libiconv-X.Y.Z-N-mingw32-dev.tar.lzma tarball from that site. -* Experimental SVG support - - To compile with SVG, you will need pkg-config to be installed, as - the configure script invokes pkg-config to find out which compiler - switches to use for SVG. See above for the URL where you can find - pkg-config for Windows. - - SVG support is currently experimental, and not built by default. - Specify --with-rsvg and ensure you have all the dependencies in your - include path. Unless you have built a minimalist librsvg yourself - (untested), librsvg depends on a significant chunk of GTK+ to build, - plus a few Gnome libraries, libxml2, libbz2 and zlib at runtime. The - easiest way to obtain the dependencies required for building is to - download a pre-bundled GTK+ development environment for Windows. - - To use librsvg at runtime, ensure that librsvg and its dependencies - are on your PATH. If you didn't build librsvg yourself, you will - need to check with where you downloaded it from for the - dependencies, as there are different build options. If it is a - short list, then it most likely only lists the immediate - dependencies of librsvg, but the dependencies themselves have - dependencies - so don't download individual libraries from GTK+, - download and install the whole thing. If you think you've got all - the dependencies and SVG support is still not working, check your - PATH for other libraries that shadow the ones you downloaded. - Libraries of the same name from different sources may not be - compatible, this problem was encountered with libbzip2 from GnuWin32 - with libcroco from gnome.org. - - If you can see etc/images/splash.svg, then you have managed to get - SVG support working. Congratulations for making it through DLL hell - to this point. You'll probably find that some SVG images crash - Emacs. Problems have been observed in some images that contain - text, they seem to be a problem in the Windows port of Pango, or - maybe a problem with the way Cairo or librsvg is using it that - doesn't show up on other platforms. - This file is part of GNU Emacs. === modified file 'src/ChangeLog' --- src/ChangeLog 2014-04-02 13:24:19 +0000 +++ src/ChangeLog 2014-04-02 15:14:50 +0000 @@ -1,3 +1,22 @@ +2014-04-02 Martin Rudalics + + * xterm.c (x_new_font): Don't calculate non-toolkit scrollbar + width from font width (Bug#17163). + + * frame.c (x_set_frame_parameters): Calculate default values of + new frame sizes only after all other frame parameters have been + processed (Bug#17142). + +2014-04-02 Ken Brown + + * conf_post.h (SYSTEM_PURESIZE_EXTRA) [CYGWIN]: Set to 10000. + (Bug#17112) + +2014-04-02 YAMAMOTO Mitsuharu + + * xterm.c (x_draw_image_glyph_string): Adjust image background + width accordingly when its x position is adjusted. (Bug#17115) + 2014-04-02 Dmitry Antipov * font.c (font_list_entities): Do not add empty vector to font cache. === modified file 'src/conf_post.h' --- src/conf_post.h 2014-01-20 16:55:28 +0000 +++ src/conf_post.h 2014-03-28 16:32:54 +0000 @@ -161,6 +161,10 @@ #endif #endif +#ifdef CYGWIN +#define SYSTEM_PURESIZE_EXTRA 10000 +#endif + #if defined HAVE_NTGUI && !defined DebPrint # ifdef EMACSDEBUG extern void _DebPrint (const char *fmt, ...); === modified file 'src/frame.c' --- src/frame.c 2014-03-20 14:09:37 +0000 +++ src/frame.c 2014-03-30 13:31:45 +0000 @@ -2795,6 +2795,7 @@ set them both at once. So we wait until we've looked at the entire list before we set them. */ int width, height; + bool width_change = 0, height_change = 0; /* Same here. */ Lisp_Object left, top; @@ -2810,7 +2811,6 @@ #ifdef HAVE_X_WINDOWS bool icon_left_no_change = 0, icon_top_no_change = 0; #endif - bool size_changed = 0; struct gcpro gcpro1, gcpro2; i = 0; @@ -2844,18 +2844,6 @@ top = left = Qunbound; icon_left = icon_top = Qunbound; - /* Provide default values for HEIGHT and WIDTH. */ - width = (f->new_width - ? (f->new_pixelwise - ? f->new_width - : (f->new_width * FRAME_COLUMN_WIDTH (f))) - : FRAME_TEXT_WIDTH (f)); - height = (f->new_height - ? (f->new_pixelwise - ? f->new_height - : (f->new_height * FRAME_LINE_HEIGHT (f))) - : FRAME_TEXT_HEIGHT (f)); - /* Process foreground_color and background_color before anything else. They are independent of other properties, but other properties (e.g., cursor_color) are dependent upon them. */ @@ -2897,12 +2885,12 @@ if (EQ (prop, Qwidth) && RANGED_INTEGERP (0, val, INT_MAX)) { - size_changed = 1; + width_change = 1; width = XFASTINT (val) * FRAME_COLUMN_WIDTH (f) ; } else if (EQ (prop, Qheight) && RANGED_INTEGERP (0, val, INT_MAX)) { - size_changed = 1; + height_change = 1; height = XFASTINT (val) * FRAME_LINE_HEIGHT (f); } else if (EQ (prop, Qtop)) @@ -2989,11 +2977,30 @@ XSETFRAME (frame, f); - if (size_changed + if ((width_change || height_change) && (width != FRAME_TEXT_WIDTH (f) || height != FRAME_TEXT_HEIGHT (f) || f->new_height || f->new_width)) - Fset_frame_size (frame, make_number (width), make_number (height), Qt); + { + /* If necessary provide default values for HEIGHT and WIDTH. Do + that here since otherwise a size change implied by an + intermittent font change may get lost as in Bug#17142. */ + if (!width_change) + width = (f->new_width + ? (f->new_pixelwise + ? f->new_width + : (f->new_width * FRAME_COLUMN_WIDTH (f))) + : FRAME_TEXT_WIDTH (f)); + + if (!height_change) + height = (f->new_height + ? (f->new_pixelwise + ? f->new_height + : (f->new_height * FRAME_LINE_HEIGHT (f))) + : FRAME_TEXT_HEIGHT (f)); + + Fset_frame_size (frame, make_number (width), make_number (height), Qt); + } if ((!NILP (left) || !NILP (top)) && ! (left_no_change && top_no_change) === modified file 'src/xterm.c' --- src/xterm.c 2014-03-31 07:13:58 +0000 +++ src/xterm.c 2014-04-02 15:14:50 +0000 @@ -2399,15 +2399,19 @@ { int x = s->x; int y = s->y; + int width = s->background_width; if (s->first_glyph->left_box_line_p && s->slice.x == 0) - x += box_line_hwidth; + { + x += box_line_hwidth; + width -= box_line_hwidth; + } if (s->slice.y == 0) y += box_line_vwidth; - x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height); + x_draw_glyph_string_bg_rect (s, x, y, width, height); } s->background_filled_p = 1; @@ -7775,20 +7779,16 @@ compute_fringe_widths (f, 1); + /* Compute character columns occupied by scrollbar. + + Don't do things differently for non-toolkit scrollbars + (Bug#17163). */ unit = FRAME_COLUMN_WIDTH (f); -#ifdef USE_TOOLKIT_SCROLL_BARS - /* The width of a toolkit scrollbar does not change with the new - font but we have to calculate the number of columns it occupies - anew. */ - FRAME_CONFIG_SCROLL_BAR_COLS (f) - = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + unit - 1) / unit; -#else - /* The width of a non-toolkit scrollbar is at least 14 pixels and a - multiple of the frame's character width. */ - FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + unit - 1) / unit; - FRAME_CONFIG_SCROLL_BAR_WIDTH (f) - = FRAME_CONFIG_SCROLL_BAR_COLS (f) * unit; -#endif + if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0) + FRAME_CONFIG_SCROLL_BAR_COLS (f) + = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + unit - 1) / unit; + else + FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + unit - 1) / unit; if (FRAME_X_WINDOW (f) != 0) { @@ -7994,7 +7994,7 @@ { #ifdef HAVE_X11R6_XIM struct xim_inst_t *xim_inst = dpyinfo->xim_callback_data; - + if (dpyinfo->display) { Bool ret = XUnregisterIMInstantiateCallback ------------------------------------------------------------ revno: 116927 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2014-04-02 17:24:19 +0400 message: * font.c (font_list_entities): Do not add empty vector to font cache. (font_matching_entity): Likewise. If matching entity is found, insert 1-item vector with this entity instead of entity itself (Bug#17125). diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-04-01 20:18:12 +0000 +++ src/ChangeLog 2014-04-02 13:24:19 +0000 @@ -1,3 +1,9 @@ +2014-04-02 Dmitry Antipov + + * font.c (font_list_entities): Do not add empty vector to font cache. + (font_matching_entity): Likewise. If matching entity is found, insert + 1-item vector with this entity instead of entity itself (Bug#17125). + 2014-04-01 Paul Eggert * fns.c (validate_subarray): Rename from validate_substring, === modified file 'src/font.c' --- src/font.c 2014-03-03 19:58:20 +0000 +++ src/font.c 2014-04-02 13:24:19 +0000 @@ -2753,22 +2753,21 @@ val = XCDR (val); else { - Lisp_Object copy; - val = driver_list->driver->list (f, scratch_font_spec); - if (NILP (val)) - val = zero_vector; - else - val = Fvconcat (1, &val); - copy = copy_font_spec (scratch_font_spec); - ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); - XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); + if (!NILP (val)) + { + Lisp_Object copy = copy_font_spec (scratch_font_spec); + + val = Fvconcat (1, &val); + ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); + XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); + } } - if (ASIZE (val) > 0 + if (VECTORP (val) && ASIZE (val) > 0 && (need_filtering || ! NILP (Vface_ignored_fonts))) val = font_delete_unmatched (val, need_filtering ? spec : Qnil, size); - if (ASIZE (val) > 0) + if (VECTORP (val) && ASIZE (val) > 0) list = Fcons (val, list); } @@ -2804,7 +2803,6 @@ && (NILP (ftype) || EQ (driver_list->driver->type, ftype))) { Lisp_Object cache = font_get_cache (f, driver_list->driver); - Lisp_Object copy; ASET (work, FONT_TYPE_INDEX, driver_list->driver->type); entity = assoc_no_quit (work, XCDR (cache)); @@ -2813,9 +2811,14 @@ else { entity = driver_list->driver->match (f, work); - copy = copy_font_spec (work); - ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); - XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache))); + if (!NILP (entity)) + { + Lisp_Object copy = copy_font_spec (work); + Lisp_Object match = Fvector (1, &entity); + + ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); + XSETCDR (cache, Fcons (Fcons (copy, match), XCDR (cache))); + } } if (! NILP (entity)) break; ------------------------------------------------------------ revno: 116926 committer: João Távora branch nick: trunk timestamp: Wed 2014-04-02 10:59:06 +0100 message: Inhibit quote autopairing more frequently * lisp/elec-pair.el (electric-pair-inhibit-if-helps-balance): Inhibit quote pairing if point-max is inside an unterminated string. (electric-pair--looking-at-unterminated-string-p): Delete. (electric-pair--in-unterminated-string-p): New function. * test/automated/electric-tests.el (inhibit-if-strings-mismatched): New test, change from `inhibit-only-of-next-is-mismatched'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-04-01 20:48:02 +0000 +++ lisp/ChangeLog 2014-04-02 09:59:06 +0000 @@ -1,3 +1,11 @@ +2014-04-02 João Távora + + * elec-pair.el (electric-pair-inhibit-if-helps-balance): Inhibit + quote pairing if point-max is inside an unterminated string. + (electric-pair--looking-at-unterminated-string-p): + Delete. + (electric-pair--in-unterminated-string-p): New function. + 2014-04-01 Daniel Colascione * minibuffer.el (minibuffer-complete): Prevent assertion failure === modified file 'lisp/elec-pair.el' --- lisp/elec-pair.el 2014-02-23 00:19:11 +0000 +++ lisp/elec-pair.el 2014-04-02 09:59:06 +0000 @@ -364,18 +364,17 @@ (funcall ended-prematurely-fn))))))) (cons innermost outermost))) -(defun electric-pair--looking-at-unterminated-string-p (char) - "Return non-nil if following string starts with CHAR and is unterminated." - ;; FIXME: ugly/naive - (save-excursion - (skip-chars-forward (format "^%c" char)) - (while (not (zerop (% (save-excursion (skip-syntax-backward "\\")) 2))) - (unless (eobp) - (forward-char 1) - (skip-chars-forward (format "^%c" char)))) - (and (not (eobp)) - (condition-case nil - (progn (forward-sexp) nil) +(defun electric-pair--in-unterminated-string-p (char) + "Return non-nil if inside unterminated string started by CHAR" + (let* ((ppss (syntax-ppss)) + (relevant-ppss (if (nth 4 ppss) ; in comment + (electric-pair--syntax-ppss) + ppss)) + (string-delim (nth 3 relevant-ppss))) + (and (or (eq t string-delim) + (eq char string-delim)) + (condition-case nil (progn (scan-sexps (nth 8 relevant-ppss) 1) + nil) (scan-error t))))) (defun electric-pair--inside-string-p (char) @@ -409,7 +408,9 @@ (t (eq (cdr outermost) pair))))) ((eq syntax ?\") - (electric-pair--looking-at-unterminated-string-p char)))) + (save-excursion + (goto-char (point-max)) + (electric-pair--in-unterminated-string-p char))))) (insert-char char))))) (defun electric-pair-skip-if-helps-balance (char) === modified file 'test/ChangeLog' --- test/ChangeLog 2014-03-26 15:57:13 +0000 +++ test/ChangeLog 2014-04-02 09:59:06 +0000 @@ -1,3 +1,8 @@ +2014-04-02 João Távora + + * automated/electric-tests.el (inhibit-if-strings-mismatched): + New test, change from `inhibit-only-of-next-is-mismatched'. + 2014-03-26 Barry O'Reilly * automated/undo-tests.el (undo-test-marker-adjustment-nominal): === modified file 'test/automated/electric-tests.el' --- test/automated/electric-tests.el 2014-01-01 07:43:34 +0000 +++ test/automated/electric-tests.el 2014-04-02 09:59:06 +0000 @@ -295,9 +295,9 @@ :bindings `((electric-pair-text-syntax-table . ,prog-mode-syntax-table))) -(define-electric-pair-test inhibit-only-if-next-is-mismatched +(define-electric-pair-test inhibit-if-strings-mismatched "\"foo\"\"bar" "\"" - :expected-string "\"\"\"foo\"\"bar" + :expected-string "\"\"foo\"\"bar" :expected-point 2 :test-in-strings nil :bindings `((electric-pair-text-syntax-table ------------------------------------------------------------ revno: 116925 committer: Daniel Colascione branch nick: trunk timestamp: Tue 2014-04-01 13:48:02 -0700 message: Prevent assertion failure when trying to complete the prompt diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-03-31 01:31:17 +0000 +++ lisp/ChangeLog 2014-04-01 20:48:02 +0000 @@ -1,3 +1,8 @@ +2014-04-01 Daniel Colascione + + * minibuffer.el (minibuffer-complete): Prevent assertion failure + when trying to complete the prompt. + 2014-03-31 Leo Liu * emacs-lisp/eldoc.el (eldoc-print-current-symbol-info): Refactor === modified file 'lisp/minibuffer.el' --- lisp/minibuffer.el 2014-03-05 07:04:01 +0000 +++ lisp/minibuffer.el 2014-04-01 20:48:02 +0000 @@ -1092,9 +1092,10 @@ If you repeat this command after it displayed such a list, scroll the window of possible completions." (interactive) - (completion-in-region (minibuffer-prompt-end) (point-max) - minibuffer-completion-table - minibuffer-completion-predicate)) + (when (<= (minibuffer-prompt-end) (point)) + (completion-in-region (minibuffer-prompt-end) (point-max) + minibuffer-completion-table + minibuffer-completion-predicate))) (defun completion--in-region-1 (beg end) ;; If the previous command was not this, ------------------------------------------------------------ Use --include-merged or -n0 to see merged revisions.