aboutsummaryrefslogtreecommitdiffstats
path: root/src/cmds.c
diff options
context:
space:
mode:
authorRichard M. Stallman1995-02-13 16:54:58 +0000
committerRichard M. Stallman1995-02-13 16:54:58 +0000
commit189fad68dd3b54a083a2e65912d2c9c59a073bb0 (patch)
treea83106f4c92a271b849e28c5c101e99847055dee /src/cmds.c
parentf4249c6f781819f1a1aa1535acd073fce2e409af (diff)
downloademacs-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/cmds.c')
-rw-r--r--src/cmds.c40
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. */
32Lisp_Object Qoverwrite_mode_binary; 32Lisp_Object Qoverwrite_mode_binary;
33 33
34/* Non-nil means put this face on the next self-inserting character. */
35Lisp_Object Vself_insert_face;
36
37/* This is the command that set up Vself_insert_face. */
38Lisp_Object Vself_insert_face_command;
39
34#ifdef USE_TEXT_PROPERTIES 40#ifdef USE_TEXT_PROPERTIES
35Lisp_Object Qhard; 41Lisp_Object Qhard;
36#endif 42#endif
37 43
44extern Lisp_Object Qface;
38 45
39DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "p", 46DEFUN ("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\
397When this is non-nil, the functions `newline' and `open-line' add the 415When this is non-nil, the functions `newline' and `open-line' add the\n\
398text-property `hard' to newlines that they insert. Also, a line is 416text-property `hard' to newlines that they insert. Also, a line is\n\
399only considered as a candidate to match `paragraph-start' or 417only 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\
401marked hard are called \"soft\", and are always internal to 419marked hard are called \"soft\", and are always internal to\n\
402paragraphs. The fill functions always insert soft newlines."); 420paragraphs. 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\
425See 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\
430If `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\
407More precisely, a char with closeparen syntax is self-inserted."); 435More precisely, a char with closeparen syntax is self-inserted.");