aboutsummaryrefslogtreecommitdiffstats
path: root/src/cmds.c
diff options
context:
space:
mode:
authorPhillip Lord2015-11-12 22:01:22 +0000
committerPhillip Lord2015-11-12 22:01:22 +0000
commit20aa42e8204f8f0139ba3880cb32ddf88acc9bf4 (patch)
treef77644c920b0f6a5a2f5849a064c6828c17530b1 /src/cmds.c
parentd2f73db50bec29724cb1324910350ad24420b174 (diff)
parent44dfa86b7d382b84564d68472da1448d08f48129 (diff)
downloademacs-20aa42e8204f8f0139ba3880cb32ddf88acc9bf4.tar.gz
emacs-20aa42e8204f8f0139ba3880cb32ddf88acc9bf4.zip
; Merge branch 'fix/no-undo-boundary-on-secondary-buffer-change'
Conflicts: src/cmds.c src/keyboard.c
Diffstat (limited to 'src/cmds.c')
-rw-r--r--src/cmds.c56
1 files changed, 14 insertions, 42 deletions
diff --git a/src/cmds.c b/src/cmds.c
index 0afc023e681..167ebb74302 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -218,36 +218,6 @@ to t. */)
218 return Qnil; 218 return Qnil;
219} 219}
220 220
221static int nonundocount;
222
223static void
224remove_excessive_undo_boundaries (void)
225{
226 bool remove_boundary = true;
227
228 if (!EQ (Vthis_command, KVAR (current_kboard, Vlast_command)))
229 nonundocount = 0;
230
231 if (NILP (Vexecuting_kbd_macro))
232 {
233 if (nonundocount <= 0 || nonundocount >= 20)
234 {
235 remove_boundary = false;
236 nonundocount = 0;
237 }
238 nonundocount++;
239 }
240
241 if (remove_boundary
242 && CONSP (BVAR (current_buffer, undo_list))
243 && NILP (XCAR (BVAR (current_buffer, undo_list)))
244 /* Only remove auto-added boundaries, not boundaries
245 added by explicit calls to undo-boundary. */
246 && EQ (BVAR (current_buffer, undo_list), last_undo_boundary))
247 /* Remove the undo_boundary that was just pushed. */
248 bset_undo_list (current_buffer, XCDR (BVAR (current_buffer, undo_list)));
249}
250
251DEFUN ("delete-char", Fdelete_char, Sdelete_char, 1, 2, "p\nP", 221DEFUN ("delete-char", Fdelete_char, Sdelete_char, 1, 2, "p\nP",
252 doc: /* Delete the following N characters (previous if N is negative). 222 doc: /* Delete the following N characters (previous if N is negative).
253Optional second arg KILLFLAG non-nil means kill instead (save in kill ring). 223Optional second arg KILLFLAG non-nil means kill instead (save in kill ring).
@@ -263,7 +233,7 @@ because it respects values of `delete-active-region' and `overwrite-mode'. */)
263 CHECK_NUMBER (n); 233 CHECK_NUMBER (n);
264 234
265 if (eabs (XINT (n)) < 2) 235 if (eabs (XINT (n)) < 2)
266 remove_excessive_undo_boundaries (); 236 call0 (Qundo_auto__amalgamate);
267 237
268 pos = PT + XINT (n); 238 pos = PT + XINT (n);
269 if (NILP (killflag)) 239 if (NILP (killflag))
@@ -309,20 +279,19 @@ At the end, it runs `post-self-insert-hook'. */)
309 error ("Negative repetition argument %"pI"d", XINT (n)); 279 error ("Negative repetition argument %"pI"d", XINT (n));
310 280
311 if (XFASTINT (n) < 2) 281 if (XFASTINT (n) < 2)
312 remove_excessive_undo_boundaries (); 282 call0 (Qundo_auto__amalgamate);
313 283
314 /* Barf if the key that invoked this was not a character. */ 284 /* Barf if the key that invoked this was not a character. */
315 if (!CHARACTERP (last_command_event)) 285 if (!CHARACTERP (last_command_event))
316 bitch_at_user (); 286 bitch_at_user ();
317 else 287 else {
318 { 288 int character = translate_char (Vtranslation_table_for_input,
319 int character = translate_char (Vtranslation_table_for_input, 289 XINT (last_command_event));
320 XINT (last_command_event)); 290 int val = internal_self_insert (character, XFASTINT (n));
321 int val = internal_self_insert (character, XFASTINT (n)); 291 if (val == 2)
322 if (val == 2) 292 Fset (Qundo_auto__this_command_amalgamating, Qnil);
323 nonundocount = 0; 293 frame_make_pointer_invisible (SELECTED_FRAME ());
324 frame_make_pointer_invisible (SELECTED_FRAME ()); 294 }
325 }
326 295
327 return Qnil; 296 return Qnil;
328} 297}
@@ -525,6 +494,10 @@ internal_self_insert (int c, EMACS_INT n)
525void 494void
526syms_of_cmds (void) 495syms_of_cmds (void)
527{ 496{
497 DEFSYM (Qundo_auto__amalgamate, "undo-auto--amalgamate");
498 DEFSYM (Qundo_auto__this_command_amalgamating,
499 "undo-auto--this-command-amalgamating");
500
528 DEFSYM (Qkill_forward_chars, "kill-forward-chars"); 501 DEFSYM (Qkill_forward_chars, "kill-forward-chars");
529 502
530 /* A possible value for a buffer's overwrite-mode variable. */ 503 /* A possible value for a buffer's overwrite-mode variable. */
@@ -554,7 +527,6 @@ keys_of_cmds (void)
554{ 527{
555 int n; 528 int n;
556 529
557 nonundocount = 0;
558 initial_define_key (global_map, Ctl ('I'), "self-insert-command"); 530 initial_define_key (global_map, Ctl ('I'), "self-insert-command");
559 for (n = 040; n < 0177; n++) 531 for (n = 040; n < 0177; n++)
560 initial_define_key (global_map, n, "self-insert-command"); 532 initial_define_key (global_map, n, "self-insert-command");