summaryrefslogtreecommitdiff
path: root/src/cmds.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-02-13 16:54:58 +0000
committerRichard M. Stallman <rms@gnu.org>1995-02-13 16:54:58 +0000
commitf367f356a9d34c33eecc1c03c5681d8bb12de664 (patch)
tree4b3620d44642273fb39462cb37d31d17f75ce6d1 /src/cmds.c
parent2e858f1509f9dd89293ead5ca45eefd8f4530224 (diff)
downloademacs-f367f356a9d34c33eecc1c03c5681d8bb12de664.tar.gz
(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;
/* A possible value for a buffer's overwrite-mode variable. */
Lisp_Object Qoverwrite_mode_binary;
+/* Non-nil means put this face on the next self-inserting character. */
+Lisp_Object Vself_insert_face;
+
+/* This is the command that set up Vself_insert_face. */
+Lisp_Object Vself_insert_face_command;
+
#ifdef USE_TEXT_PROPERTIES
Lisp_Object Qhard;
#endif
+extern Lisp_Object Qface;
DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "p",
"Move point right ARG characters (left if ARG negative).\n\
@@ -366,6 +373,17 @@ internal_self_insert (c1, noautofill)
}
else
insert_and_inherit (&c1, 1);
+
+ /* If previous command specified a face to use, use it. */
+ if (!NILP (Vself_insert_face)
+ && EQ (last_command, Vself_insert_face_command))
+ {
+ Lisp_Object before, after;
+ XSETINT (before, PT - 1);
+ XSETINT (after, PT);
+ Fput_text_property (before, after, Qface, Vself_insert_face, Qnil);
+ Vself_insert_face = Qnil;
+ }
synt = SYNTAX (c);
if ((synt == Sclose || synt == Smath)
&& !NILP (Vblink_paren_function) && INTERACTIVE)
@@ -393,15 +411,25 @@ syms_of_cmds ()
staticpro (&Qhard);
DEFVAR_BOOL ("use-hard-newlines", &Vuse_hard_newlines,
- "Non-nil means to distinguish hard and soft newlines.
-When this is non-nil, the functions `newline' and `open-line' add the
-text-property `hard' to newlines that they insert. Also, a line is
-only considered as a candidate to match `paragraph-start' or
-`paragraph-separate' if it follows a hard newline. Newlines not
-marked hard are called \"soft\", and are always internal to
+ "Non-nil means to distinguish hard and soft newlines.\n\
+When this is non-nil, the functions `newline' and `open-line' add the\n\
+text-property `hard' to newlines that they insert. Also, a line is\n\
+only considered as a candidate to match `paragraph-start' or\n\
+`paragraph-separate' if it follows a hard newline. Newlines not\n\
+marked hard are called \"soft\", and are always internal to\n\
paragraphs. The fill functions always insert soft newlines.");
Vuse_hard_newlines = 0;
+ DEFVAR_LISP ("self-insert-face", &Vself_insert_face,
+ "If non-nil, set the face of the next self-inserting character to this.\n\
+See also `self-insert-face-command'.");
+ Vself_insert_face = Qnil;
+
+ DEFVAR_LISP ("self-insert-face-command", &Vself_insert_face_command,
+ "This is the command that set up `self-insert-face'.\n\
+If `last-command' does not equal this value, we ignore `self-insert-face'.");
+ Vself_insert_face_command = Qnil;
+
DEFVAR_LISP ("blink-paren-function", &Vblink_paren_function,
"Function called, if non-nil, whenever a close parenthesis is inserted.\n\
More precisely, a char with closeparen syntax is self-inserted.");