diff options
| author | Richard M. Stallman | 1995-02-13 16:54:58 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-02-13 16:54:58 +0000 |
| commit | 189fad68dd3b54a083a2e65912d2c9c59a073bb0 (patch) | |
| tree | a83106f4c92a271b849e28c5c101e99847055dee /src | |
| parent | f4249c6f781819f1a1aa1535acd073fce2e409af (diff) | |
| download | emacs-189fad68dd3b54a083a2e65912d2c9c59a073bb0.tar.gz emacs-189fad68dd3b54a083a2e65912d2c9c59a073bb0.zip | |
(Vself_insert_face, Vself_insert_face_command): New variables.
(syms_of_cmds): Set up Lisp variables. Doc syntax fix.
(internal_self_insert): Handle Vself_insert_face.
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmds.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/src/cmds.c b/src/cmds.c index af3b08ae659..abad2cf63af 100644 --- a/src/cmds.c +++ b/src/cmds.c | |||
| @@ -31,10 +31,17 @@ Lisp_Object Vuse_hard_newlines; | |||
| 31 | /* A possible value for a buffer's overwrite-mode variable. */ | 31 | /* A possible value for a buffer's overwrite-mode variable. */ |
| 32 | Lisp_Object Qoverwrite_mode_binary; | 32 | Lisp_Object Qoverwrite_mode_binary; |
| 33 | 33 | ||
| 34 | /* Non-nil means put this face on the next self-inserting character. */ | ||
| 35 | Lisp_Object Vself_insert_face; | ||
| 36 | |||
| 37 | /* This is the command that set up Vself_insert_face. */ | ||
| 38 | Lisp_Object Vself_insert_face_command; | ||
| 39 | |||
| 34 | #ifdef USE_TEXT_PROPERTIES | 40 | #ifdef USE_TEXT_PROPERTIES |
| 35 | Lisp_Object Qhard; | 41 | Lisp_Object Qhard; |
| 36 | #endif | 42 | #endif |
| 37 | 43 | ||
| 44 | extern Lisp_Object Qface; | ||
| 38 | 45 | ||
| 39 | DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "p", | 46 | DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "p", |
| 40 | "Move point right ARG characters (left if ARG negative).\n\ | 47 | "Move point right ARG characters (left if ARG negative).\n\ |
| @@ -366,6 +373,17 @@ internal_self_insert (c1, noautofill) | |||
| 366 | } | 373 | } |
| 367 | else | 374 | else |
| 368 | insert_and_inherit (&c1, 1); | 375 | insert_and_inherit (&c1, 1); |
| 376 | |||
| 377 | /* If previous command specified a face to use, use it. */ | ||
| 378 | if (!NILP (Vself_insert_face) | ||
| 379 | && EQ (last_command, Vself_insert_face_command)) | ||
| 380 | { | ||
| 381 | Lisp_Object before, after; | ||
| 382 | XSETINT (before, PT - 1); | ||
| 383 | XSETINT (after, PT); | ||
| 384 | Fput_text_property (before, after, Qface, Vself_insert_face, Qnil); | ||
| 385 | Vself_insert_face = Qnil; | ||
| 386 | } | ||
| 369 | synt = SYNTAX (c); | 387 | synt = SYNTAX (c); |
| 370 | if ((synt == Sclose || synt == Smath) | 388 | if ((synt == Sclose || synt == Smath) |
| 371 | && !NILP (Vblink_paren_function) && INTERACTIVE) | 389 | && !NILP (Vblink_paren_function) && INTERACTIVE) |
| @@ -393,15 +411,25 @@ syms_of_cmds () | |||
| 393 | staticpro (&Qhard); | 411 | staticpro (&Qhard); |
| 394 | 412 | ||
| 395 | DEFVAR_BOOL ("use-hard-newlines", &Vuse_hard_newlines, | 413 | DEFVAR_BOOL ("use-hard-newlines", &Vuse_hard_newlines, |
| 396 | "Non-nil means to distinguish hard and soft newlines. | 414 | "Non-nil means to distinguish hard and soft newlines.\n\ |
| 397 | When this is non-nil, the functions `newline' and `open-line' add the | 415 | When this is non-nil, the functions `newline' and `open-line' add the\n\ |
| 398 | text-property `hard' to newlines that they insert. Also, a line is | 416 | text-property `hard' to newlines that they insert. Also, a line is\n\ |
| 399 | only considered as a candidate to match `paragraph-start' or | 417 | only considered as a candidate to match `paragraph-start' or\n\ |
| 400 | `paragraph-separate' if it follows a hard newline. Newlines not | 418 | `paragraph-separate' if it follows a hard newline. Newlines not\n\ |
| 401 | marked hard are called \"soft\", and are always internal to | 419 | marked hard are called \"soft\", and are always internal to\n\ |
| 402 | paragraphs. The fill functions always insert soft newlines."); | 420 | paragraphs. The fill functions always insert soft newlines."); |
| 403 | Vuse_hard_newlines = 0; | 421 | Vuse_hard_newlines = 0; |
| 404 | 422 | ||
| 423 | DEFVAR_LISP ("self-insert-face", &Vself_insert_face, | ||
| 424 | "If non-nil, set the face of the next self-inserting character to this.\n\ | ||
| 425 | See also `self-insert-face-command'."); | ||
| 426 | Vself_insert_face = Qnil; | ||
| 427 | |||
| 428 | DEFVAR_LISP ("self-insert-face-command", &Vself_insert_face_command, | ||
| 429 | "This is the command that set up `self-insert-face'.\n\ | ||
| 430 | If `last-command' does not equal this value, we ignore `self-insert-face'."); | ||
| 431 | Vself_insert_face_command = Qnil; | ||
| 432 | |||
| 405 | DEFVAR_LISP ("blink-paren-function", &Vblink_paren_function, | 433 | DEFVAR_LISP ("blink-paren-function", &Vblink_paren_function, |
| 406 | "Function called, if non-nil, whenever a close parenthesis is inserted.\n\ | 434 | "Function called, if non-nil, whenever a close parenthesis is inserted.\n\ |
| 407 | More precisely, a char with closeparen syntax is self-inserted."); | 435 | More precisely, a char with closeparen syntax is self-inserted."); |