aboutsummaryrefslogtreecommitdiffstats
path: root/src/cmds.c
diff options
context:
space:
mode:
authorKenichi Handa2010-08-25 14:15:20 +0900
committerKenichi Handa2010-08-25 14:15:20 +0900
commit4e603db3429957e6b26953c177f00a9c9d1c8766 (patch)
tree8206240e3006468bff9dfda5fb3696f80fbcb9f0 /src/cmds.c
parentb60f961f6cdc1095e778ad624657bb57788512af (diff)
parentf6aa6ec68ed936800ef2c3aefa42102e60b654cb (diff)
downloademacs-4e603db3429957e6b26953c177f00a9c9d1c8766.tar.gz
emacs-4e603db3429957e6b26953c177f00a9c9d1c8766.zip
merge trunk
Diffstat (limited to 'src/cmds.c')
-rw-r--r--src/cmds.c41
1 files changed, 14 insertions, 27 deletions
diff --git a/src/cmds.c b/src/cmds.c
index 4cb6ca199e7..f306ede7ca5 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -37,12 +37,6 @@ Lisp_Object Qkill_forward_chars, Qkill_backward_chars, Vblink_paren_function;
37/* A possible value for a buffer's overwrite-mode variable. */ 37/* A possible value for a buffer's overwrite-mode variable. */
38Lisp_Object Qoverwrite_mode_binary; 38Lisp_Object Qoverwrite_mode_binary;
39 39
40/* Non-nil means put this face on the next self-inserting character. */
41Lisp_Object Vself_insert_face;
42
43/* This is the command that set up Vself_insert_face. */
44Lisp_Object Vself_insert_face_command;
45
46static int internal_self_insert (int, int); 40static int internal_self_insert (int, int);
47 41
48DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0, 42DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0,
@@ -346,6 +340,7 @@ After insertion, the value of `auto-fill-function' is called if the
346 A value of 2 means this did things that call for an undo boundary. */ 340 A value of 2 means this did things that call for an undo boundary. */
347 341
348static Lisp_Object Qexpand_abbrev; 342static Lisp_Object Qexpand_abbrev;
343static Lisp_Object Qpost_self_insert_hook, Vpost_self_insert_hook;
349 344
350static int 345static int
351internal_self_insert (int c, int noautofill) 346internal_self_insert (int c, int noautofill)
@@ -451,10 +446,10 @@ internal_self_insert (int c, int noautofill)
451 && synt != Sword 446 && synt != Sword
452 && NILP (current_buffer->read_only) 447 && NILP (current_buffer->read_only)
453 && PT > BEGV 448 && PT > BEGV
454 && (!NILP (current_buffer->enable_multibyte_characters) 449 && (SYNTAX (!NILP (current_buffer->enable_multibyte_characters)
455 ? SYNTAX (XFASTINT (Fprevious_char ())) == Sword 450 ? XFASTINT (Fprevious_char ())
456 : (SYNTAX (UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ()))) 451 : UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ())))
457 == Sword))) 452 == Sword))
458 { 453 {
459 int modiff = MODIFF; 454 int modiff = MODIFF;
460 Lisp_Object sym; 455 Lisp_Object sym;
@@ -514,15 +509,6 @@ internal_self_insert (int c, int noautofill)
514 hairy = 2; 509 hairy = 2;
515 } 510 }
516 511
517 /* If previous command specified a face to use, use it. */
518 if (!NILP (Vself_insert_face)
519 && EQ (current_kboard->Vlast_command, Vself_insert_face_command))
520 {
521 Fput_text_property (make_number (PT - 1), make_number (PT),
522 Qface, Vself_insert_face, Qnil);
523 Vself_insert_face = Qnil;
524 }
525
526 if ((synt == Sclose || synt == Smath) 512 if ((synt == Sclose || synt == Smath)
527 && !NILP (Vblink_paren_function) && INTERACTIVE 513 && !NILP (Vblink_paren_function) && INTERACTIVE
528 && !noautofill) 514 && !noautofill)
@@ -530,6 +516,9 @@ internal_self_insert (int c, int noautofill)
530 call0 (Vblink_paren_function); 516 call0 (Vblink_paren_function);
531 hairy = 2; 517 hairy = 2;
532 } 518 }
519 /* Run hooks for electric keys. */
520 call1 (Vrun_hooks, Qpost_self_insert_hook);
521
533 return hairy; 522 return hairy;
534} 523}
535 524
@@ -550,15 +539,13 @@ syms_of_cmds (void)
550 Qexpand_abbrev = intern_c_string ("expand-abbrev"); 539 Qexpand_abbrev = intern_c_string ("expand-abbrev");
551 staticpro (&Qexpand_abbrev); 540 staticpro (&Qexpand_abbrev);
552 541
553 DEFVAR_LISP ("self-insert-face", &Vself_insert_face, 542 Qpost_self_insert_hook = intern_c_string ("post-self-insert-hook");
554 doc: /* If non-nil, set the face of the next self-inserting character to this. 543 staticpro (&Qpost_self_insert_hook);
555See also `self-insert-face-command'. */);
556 Vself_insert_face = Qnil;
557 544
558 DEFVAR_LISP ("self-insert-face-command", &Vself_insert_face_command, 545 DEFVAR_LISP ("post-self-insert-hook", &Vpost_self_insert_hook,
559 doc: /* This is the command that set up `self-insert-face'. 546 doc: /* Hook run at the end of `self-insert-command'.
560If `last-command' does not equal this value, we ignore `self-insert-face'. */); 547This run is run after inserting the charater. */);
561 Vself_insert_face_command = Qnil; 548 Vpost_self_insert_hook = Qnil;
562 549
563 DEFVAR_LISP ("blink-paren-function", &Vblink_paren_function, 550 DEFVAR_LISP ("blink-paren-function", &Vblink_paren_function,
564 doc: /* Function called, if non-nil, whenever a close parenthesis is inserted. 551 doc: /* Function called, if non-nil, whenever a close parenthesis is inserted.