diff options
| author | Kenichi Handa | 2010-08-25 14:15:20 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2010-08-25 14:15:20 +0900 |
| commit | 4e603db3429957e6b26953c177f00a9c9d1c8766 (patch) | |
| tree | 8206240e3006468bff9dfda5fb3696f80fbcb9f0 /src/cmds.c | |
| parent | b60f961f6cdc1095e778ad624657bb57788512af (diff) | |
| parent | f6aa6ec68ed936800ef2c3aefa42102e60b654cb (diff) | |
| download | emacs-4e603db3429957e6b26953c177f00a9c9d1c8766.tar.gz emacs-4e603db3429957e6b26953c177f00a9c9d1c8766.zip | |
merge trunk
Diffstat (limited to 'src/cmds.c')
| -rw-r--r-- | src/cmds.c | 41 |
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. */ |
| 38 | Lisp_Object Qoverwrite_mode_binary; | 38 | Lisp_Object Qoverwrite_mode_binary; |
| 39 | 39 | ||
| 40 | /* Non-nil means put this face on the next self-inserting character. */ | ||
| 41 | Lisp_Object Vself_insert_face; | ||
| 42 | |||
| 43 | /* This is the command that set up Vself_insert_face. */ | ||
| 44 | Lisp_Object Vself_insert_face_command; | ||
| 45 | |||
| 46 | static int internal_self_insert (int, int); | 40 | static int internal_self_insert (int, int); |
| 47 | 41 | ||
| 48 | DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0, | 42 | DEFUN ("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 | ||
| 348 | static Lisp_Object Qexpand_abbrev; | 342 | static Lisp_Object Qexpand_abbrev; |
| 343 | static Lisp_Object Qpost_self_insert_hook, Vpost_self_insert_hook; | ||
| 349 | 344 | ||
| 350 | static int | 345 | static int |
| 351 | internal_self_insert (int c, int noautofill) | 346 | internal_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); |
| 555 | See 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'. |
| 560 | If `last-command' does not equal this value, we ignore `self-insert-face'. */); | 547 | This 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. |