# HG changeset patch # User Stefan Monnier # Date 1250053668 0 # Node ID b729d024f6dc18aa98422f7eed7b7b3dee970125 # Parent e2940cb3d84e83efdd111b5101931be0797626ec * cmds.c (nonundocount): New global variable. (keys_of_cmds): Initialize it. (Fself_insert_command): Use it to combine upto 20 sequential chars into a single undo entry, just like the Qself_insert_command code in keyboard.c does. Call frame_make_pointer_invisible, also like the Qself_insert_command code in keyboard.c does. * keyboard.c (command_loop_1): Use the new global nonundocount rather than its own local replacement for it. diff -r e2940cb3d84e -r b729d024f6dc src/ChangeLog --- a/src/ChangeLog Tue Aug 11 23:26:04 2009 +0000 +++ b/src/ChangeLog Wed Aug 12 05:07:48 2009 +0000 @@ -1,12 +1,23 @@ +2009-08-12 Stefan Monnier + + * cmds.c (nonundocount): New global variable. + (keys_of_cmds): Initialize it. + (Fself_insert_command): Use it to combine upto 20 sequential chars + into a single undo entry, just like the Qself_insert_command code in + keyboard.c does. + Call frame_make_pointer_invisible, also like the Qself_insert_command + code in keyboard.c does. + * keyboard.c (command_loop_1): Use the new global nonundocount rather + than its own local replacement for it. + 2009-08-10 Ken Raeburn - * fns.c (concat): Don't re-set string length to its current - value. - - * coding.h (decode_coding_string, encode_coding_string): Use - SBYTES macro. - - * doprnt.c (doprnt_lisp): Unused function deleted. + * fns.c (concat): Don't re-set string length to its current value. + + * coding.h (decode_coding_string, encode_coding_string): + Use SBYTES macro. + + * doprnt.c (doprnt_lisp): Delete unused function. (doprnt): Merge with doprnt1, discarding lispstrings code. * lisp.h (doprnt_lisp): Don't declare. @@ -62,23 +73,21 @@ * nsfont.m (nsfont_draw): Revert 2009-07-15 change. - * nsterm.m (ns_maybe_dumpglyphs_background): Revert 2009-07-15 - change. + * nsterm.m (ns_maybe_dumpglyphs_background): Revert 2009-07-15 change. (ns_get_color): Revert 2009-07-16 change. 2009-07-25 Eli Zaretskii * lread.c (syms_of_lread) : New variable. - (Fload): Use it to force load messages, even if NOMESSAGES is - non-nil. + (Fload): Use it to force load messages, even if NOMESSAGES is non-nil. 2009-07-25 Ken Raeburn - * coding.h (decode_coding_string, encode_coding_string): Use - SCHARS macro. + * coding.h (decode_coding_string, encode_coding_string): + Use SCHARS macro. * lread.c: Rewrite 2009-07-21 changes. - (load_depth): Deleted. + (load_depth): Delete. (Qload_in_progress): New variable. (load_unwind): Don't reference load_depth or load_in_progress. (Fload): Likewise; specbind Qload_in_progress instead. @@ -104,8 +113,8 @@ 2009-07-22 Jason Rumney - * w32fns.c (w32_wnd_proc) [WM_IME_STARTCOMPOSITION]: Position - IME window at cursor (Bug#2570). + * w32fns.c (w32_wnd_proc) [WM_IME_STARTCOMPOSITION]: + Position IME window at cursor (Bug#2570). (w32_wnd_proc) [WM_IME_CHAR]: Release context when finished. (globals_of_w32fns): Dynamically load functions required above. @@ -181,16 +190,15 @@ (font_delete_unmatched): Likewise. (font_list_entities): The return type changed. (font_select_entity): The format of the second argument changed. - (font_find_for_lface): Adjusted for the above changes. Don't - suppress the checking of C even if the repertory supports it. - (Flist_fonts): Adjusted for the above changes. - - * ftfont.c (ftfont_spec_pattern): New arg langname. Caller - changed. - (ftfont_list): Adjusted for the change of ftfont_spec_pattern. + (font_find_for_lface): Adjuste for the above changes. + Don't suppress the checking of C even if the repertory supports it. + (Flist_fonts): Adjust for the above changes. + + * ftfont.c (ftfont_spec_pattern): New arg langname. Change caller. + (ftfont_list): Adjust for the change of ftfont_spec_pattern. Reject a font who has adstyle property that is different from a langname derived from registry property. - (ftfont_match): Adjusted for the change of ftfont_spec_pattern. + (ftfont_match): Adjust for the change of ftfont_spec_pattern. 2009-07-13 Eli Zaretskii @@ -207,10 +215,10 @@ 2009-07-11 Eli Zaretskii - * dired.c (directory_files_internal_w32_unwind) [WINDOWSNT]: New - function. - (directory_files_internal) [WINDOWSNT]: Bind - w32-get-true-file-attributes to either t or nil, depending whether + * dired.c (directory_files_internal_w32_unwind) [WINDOWSNT]: + New function. + (directory_files_internal) [WINDOWSNT]: + Bind w32-get-true-file-attributes to either t or nil, depending whether the filesystem of the directory is fast or slow. * w32.c (logon_network_drive): Don't assume PATH is an absolute @@ -232,8 +240,7 @@ 2009-07-09 Eli Zaretskii - * w32proc.c (syms_of_ntproc) : Doc - fix. + * w32proc.c (syms_of_ntproc) : Doc fix. * w32.c (stat): Treat UNC file names as residing on remote drives. (Bug#3542) @@ -284,8 +291,7 @@ (multibyte_char_to_unibyte_safe): Likewise. (Funibyte_char_to_multibyte): Don't check charset_unibyte. - * xdisp.c (get_next_display_element): Decode it->c by - charset_unibyte. + * xdisp.c (get_next_display_element): Decode it->c by charset_unibyte. (x_produce_glyphs): Likewise. * .gdbinit (xcharset): Fix the treating $arg0. @@ -345,8 +351,8 @@ (read_avail_input): Call frame_make_pointer_visible. * frame.c (Vmake_pointer_invisible): New variable. - (frame_make_pointer_invisible, frame_make_pointer_visible): New - functions. + (frame_make_pointer_invisible, frame_make_pointer_visible): + New functions. (syms_of_frame): DEFVAR make-pointer-invisible, initialize to Qt. * frame.h: Declare frame_make_pointer_invisible and @@ -365,7 +371,7 @@ * gtkutil.c (xg_frame_set_char_size): Do not set pixel width/height here or call change_frame_size. Just call flush_and_sync. - (flush_and_sync): Reintroduced. + (flush_and_sync): Reintroduce. 2009-07-01 Jan Djärv @@ -402,8 +408,8 @@ (x_set_font, x_figure_window_size): Do not handle fullscreen specially. (syms_of_frame): Initialize Qmaximized. - * frame.h (fullscreen_type): Add FULLSCREEN_MAXIMIZED. Declare - Qfullwidth, Qfullheight, Qfullboth, Qmaximized. + * frame.h (fullscreen_type): Add FULLSCREEN_MAXIMIZED. + Declare Qfullwidth, Qfullheight, Qfullboth, Qmaximized. * xterm.c (handle_one_xevent): Remove call to x_check_fullscreen for Expose event. Add call to x_check_fullscreen for MapNotify event. @@ -421,8 +427,8 @@ flush_and_sync. (xg_height_changed): New function. (xg_create_frame_widgets): Remove call to gtk_widget_set_size_request - and gtk_window_set_policy. Set frame gravity after parsing the geometry - string. + and gtk_window_set_policy. Set frame gravity after parsing the + geometry string. (xg_update_frame_menubar, free_frame_menubar) (xg_tool_bar_detach_callback, xg_tool_bar_attach_callback) (update_frame_tool_bar, free_frame_tool_bar): Call xg_height_changed. @@ -433,8 +439,8 @@ * keyboard.c (decode_keyboard_code): New function. (tty_read_avail_input): Decode the input bytes if necessary. - * coding.c (setup_coding_system): Initialize - coding->carryover_bytes to 0. + * coding.c (setup_coding_system): + Initialize coding->carryover_bytes to 0. (Fset_keyboard_coding_system_internal): If CODING-SYSTEM is nil, use Qno_conversion. @@ -444,8 +450,7 @@ 2009-06-30 Chong Yidong - * xftfont.c (xftfont_open): Avoid passing NULL argument to - XftLockFace. + * xftfont.c (xftfont_open): Avoid passing NULL argument to XftLockFace. 2009-06-30 Jason Rumney @@ -477,8 +482,8 @@ * xdisp.c (start_display, handle_face_prop) (move_it_vertically_backward, cursor_row_fully_visible_p) - (redisplay_window, try_window_id, produce_image_glyph): Delete - some #ifdef-ed out code chunks that are now obsolete. + (redisplay_window, try_window_id, produce_image_glyph): + Delete some #ifdef-ed out code chunks that are now obsolete. * xterm.c (x_update_window_begin, x_new_focus_frame) (x_scroll_bar_handle_click, handle_one_xevent) @@ -550,8 +555,8 @@ 2009-06-23 Jim Meyering - * src/ftfont.c (setup_otf_gstring, ftfont_shape_by_flt): Use - xmalloc and xrealloc (not malloc and realloc), so subsequent heap + * src/ftfont.c (setup_otf_gstring, ftfont_shape_by_flt): + Use xmalloc and xrealloc (not malloc and realloc), so subsequent heap pointer dereferences are guaranteed to be valid. 2009-06-23 Kenichi Handa @@ -605,8 +610,7 @@ 2009-06-21 Chong Yidong - * xdisp.c (IT_DISPLAYING_WHITESPACE): Define for - !HAVE_WINDOW_SYSTEM. + * xdisp.c (IT_DISPLAYING_WHITESPACE): Define for !HAVE_WINDOW_SYSTEM. (move_it_in_display_line_to, move_it_in_display_line_to) (display_line): Remove #ifdef HAVE_WINDOW_SYSTEM. @@ -635,8 +639,7 @@ 2009-06-18 Kenichi Handa - * coding.c (decode_coding_iso_2022): Check MSB of bytes more - rigidly. + * coding.c (decode_coding_iso_2022): Check MSB of bytes more rigidly. 2009-06-18 Andreas Schwab @@ -760,8 +763,7 @@ 2009-06-08 Felix Mueller (tiny change) - * nsterm.m (ns_init_paths): Append path separator to INFOPATH - variable. + * nsterm.m (ns_init_paths): Append path separator to INFOPATH variable. 2009-06-08 Wolfgang Lux (tiny change) @@ -786,8 +788,8 @@ 2009-05-29 Kenichi Handa - * coding.c (get_translation_table): Check - Venable_character_translation. + * coding.c (get_translation_table): + Check Venable_character_translation. 2009-05-26 David Reitter @@ -1044,8 +1046,7 @@ * dispnew.c (Fsend_string_to_terminal): Doc fix. - * data.c (Fterminal_local_value, Fset_terminal_local_value): Doc - fixes. + * data.c (Fterminal_local_value, Fset_terminal_local_value): Doc fixes. * coding.c (Fterminal_coding_system): Doc fix. @@ -1055,15 +1056,15 @@ (Fx_server_vendor, Fx_server_version, Fx_display_screens) (Fx_display_mm_height, Fx_display_mm_width) (Fx_display_backing_store, Fx_display_visual_class) - (Fx_display_save_under, Fx_close_connection, Fx_synchronize): Doc - fixes, replacing "terminal id" with "terminal object". + (Fx_display_save_under, Fx_close_connection, Fx_synchronize): + Doc fixes, replacing "terminal id" with "terminal object". (check_x_display_info): Handle terminal objects instead of terminal ids. * term.c (Ftty_display_color_p, Ftty_display_color_cells) (Ftty_type, Fcontrolling_tty_p, Ftty_no_underline, Fsuspend_tty) - (Fresume_tty, Vsuspend_tty_functions, Vresume_tty_functions): Doc - fixes, replacing "terminal id" with "terminal object". + (Fresume_tty, Vsuspend_tty_functions, Vresume_tty_functions): + Doc fixes, replacing "terminal id" with "terminal object". 2009-04-21 Kenichi Handa @@ -1072,9 +1073,8 @@ * coding.c (decode_coding_utf_16): Reduce charbuf_end for the worst case. - (decode_coding_emacs_mule, decode_coding_iso_2022) - (decode_coding_sjis, decode_coding_big5, decode_coding_charset): - Likewise. + (decode_coding_sjis, decode_coding_big5, decode_coding_charset) + (decode_coding_emacs_mule, decode_coding_iso_2022): Likewise. 2009-04-19 Jason Rumney @@ -1094,8 +1094,8 @@ 2009-04-19 Jan Djärv - * gtkutil.c (xg_tool_bar_menu_proxy, update_frame_tool_bar): Use - G_CALLBACK instead of GTK_SIGNAL_FUNC which is deprecated. + * gtkutil.c (xg_tool_bar_menu_proxy, update_frame_tool_bar): + Use G_CALLBACK instead of GTK_SIGNAL_FUNC which is deprecated. (xg_initialize): Use g_type_class_ref instead of gtk_type_class which is deprecated. @@ -1141,8 +1141,7 @@ 2009-04-16 Kenichi Handa - * xfont.c (xfont_has_char): Special handling of `ja' and `ko' - adstyle. + * xfont.c (xfont_has_char): Special handling of `ja' and `ko' adstyle. * xftfont.c (xftfont_has_char): Special handling of `ja' and `ko' adstyle. @@ -1151,8 +1150,8 @@ (enum ftfont_cache_for): New enum. (fc_charset_table): Undo the previous change. (ftfont_get_latin1_charset): Delete it. - (ftfont_pattern_entity): Check cache by ftfont_lookup_cache. Set - FONT_SIZE_INDEX of the entity to 0 for a scalable font. For a + (ftfont_pattern_entity): Check cache by ftfont_lookup_cache. + Set FONT_SIZE_INDEX of the entity to 0 for a scalable font. For a non-scarable font, try to get AVERAGE_WIDTH. (ftfont_lookup_cache): Argument FOR-FACE is changed to CACHE_FOR. Change ft_face_cache from a list of a hash-table. Don't check @@ -1160,8 +1159,7 @@ (ftfont_get_fc_charset): Call ftfont_lookup_cache with FTFONT_CACHE_FOR_CHARET. (ftfont_get_charset): Undo the previous change. - (ftfont_open): Call ftfont_lookup_cache with - FTFONT_CACHE_FOR_FACE. + (ftfont_open): Call ftfont_lookup_cache with FTFONT_CACHE_FOR_FACE. (ftfont_close): Likewise. (ftfont_has_char): Special handling of `ja' and `ko' adstyle. @@ -1220,8 +1218,7 @@ 2009-04-13 Kenichi Handa - * font.c (font_delete_unmatched): Preserve the order of list - elements. + * font.c (font_delete_unmatched): Preserve the order of list elements. (font_select_entity): Suppress the code to optimize for the same kind of fonts. (font_load_for_lface): Get a font that supports at least ASCII @@ -1237,8 +1234,7 @@ Delete iso-8859-1 range from the charset of fonts whose adstyle is `ko' or `ja'. (ftfont_get_fc_charset): Call ftfont_lookup_cache with ENTITY. - (ftfont_get_charset): For iso8859-1, call - ftfont_get_latin1_charset. + (ftfont_get_charset): For iso8859-1, call ftfont_get_latin1_charset. (ftfont_list): Don't refuse a font spec with non-nil `adstyle' property. (ftfont_open): Call ftfont_lookup_cache with ENTITY. @@ -1258,8 +1254,7 @@ * dispnew.c (redraw_overlapping_rows): Fix detection of overlapping for topmost and bottommost rows. - * ftfont.c (ftfont_text_extents): Fix calculation of - metrics->descent. + * ftfont.c (ftfont_text_extents): Fix calculation of metrics->descent. 2009-04-06 Jason Rumney diff -r e2940cb3d84e -r b729d024f6dc src/cmds.c --- a/src/cmds.c Tue Aug 11 23:26:04 2009 +0000 +++ b/src/cmds.c Wed Aug 12 05:07:48 2009 +0000 @@ -315,15 +315,42 @@ return value; } +int nonundocount; + /* Note that there's code in command_loop_1 which typically avoids calling this. */ DEFUN ("self-insert-command", Fself_insert_command, Sself_insert_command, 1, 1, "p", doc: /* Insert the character you type. -Whichever character you type to run this command is inserted. */) +Whichever character you type to run this command is inserted. +Before insertion, `expand-abbrev' is executed if the inserted character does +not have word syntax and the previous character in the buffer does. +After insertion, the value of `auto-fill-function' is called if the +`auto-fill-chars' table has a non-nil value for the inserted character. */) (n) Lisp_Object n; { CHECK_NUMBER (n); + int remove_boundary = 1; + + if (!EQ (Vthis_command, current_kboard->Vlast_command)) + nonundocount = 0; + + if (NILP (Vexecuting_kbd_macro) + && !EQ (minibuf_window, selected_window)) + { + if (nonundocount <= 0 || nonundocount >= 20) + { + remove_boundary = 0; + nonundocount = 0; + } + nonundocount++; + } + + if (remove_boundary + && CONSP (current_buffer->undo_list) + && NILP (XCAR (current_buffer->undo_list))) + /* Remove the undo_boundary that was just pushed. */ + current_buffer->undo_list = XCDR (current_buffer->undo_list); /* Barf if the key that invoked this was not a character. */ if (!CHARACTERP (last_command_event)) @@ -353,9 +380,13 @@ else while (XINT (n) > 0) { + int val; /* Ok since old and new vals both nonneg */ XSETFASTINT (n, XFASTINT (n) - 1); - internal_self_insert (character, XFASTINT (n) != 0); + val = internal_self_insert (character, XFASTINT (n) != 0); + if (val == 2) + nonundocount = 0; + frame_make_pointer_invisible (); } } @@ -611,6 +642,7 @@ { int n; + nonundocount = 0; initial_define_key (global_map, Ctl ('I'), "self-insert-command"); for (n = 040; n < 0177; n++) initial_define_key (global_map, n, "self-insert-command"); diff -r e2940cb3d84e -r b729d024f6dc src/keyboard.c --- a/src/keyboard.c Tue Aug 11 23:26:04 2009 +0000 +++ b/src/keyboard.c Wed Aug 12 05:07:48 2009 +0000 @@ -1519,12 +1519,13 @@ } #endif +extern int nonundocount; /* Declared in cmds.c. */ + Lisp_Object command_loop_1 () { Lisp_Object cmd; int lose; - int nonundocount; Lisp_Object keybuf[30]; int i; int prev_modiff = 0; @@ -1540,7 +1541,6 @@ waiting_for_input = 0; cancel_echoing (); - nonundocount = 0; this_command_key_count = 0; this_command_key_count_reset = 0; this_single_command_key_start = 0; @@ -1898,7 +1898,7 @@ #endif nonundocount = 0; - if (NILP (current_kboard->Vprefix_arg)) + if (NILP (current_kboard->Vprefix_arg)) /* FIXME: Why? --Stef */ Fundo_boundary (); Fcommand_execute (Vthis_command, Qnil, Qnil, Qnil);