summaryrefslogtreecommitdiff
path: root/src/cmds.c
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2018-11-17 10:47:48 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2018-11-17 10:47:48 -0500
commit81f0e05a02013bd1c9ea177e234561348b108578 (patch)
tree43ac15d6ceadb08f6ea63c9799ed26e23699060f /src/cmds.c
parent644a308b4e1513e04be9360e1586e14b32ec0159 (diff)
downloademacs-81f0e05a02013bd1c9ea177e234561348b108578.tar.gz
* src/cmds.c (Fself_insert_command): Get last-command-event via (new) arg.
Diffstat (limited to 'src/cmds.c')
-rw-r--r--src/cmds.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/cmds.c b/src/cmds.c
index 1616efbb446..f6803f460a8 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -260,11 +260,10 @@ because it respects values of `delete-active-region' and `overwrite-mode'. */)
return Qnil;
}
-/* Note that there's code in command_loop_1 which typically avoids
- calling this. */
-DEFUN ("self-insert-command", Fself_insert_command, Sself_insert_command, 1, 1, "p",
+DEFUN ("self-insert-command", Fself_insert_command, Sself_insert_command, 1, 2,
+ "(list (prefix-numeric-value current-prefix-arg) last-command-event)",
doc: /* Insert the character you type.
-Whichever character you type to run this command is inserted.
+Whichever character C you type to run this command is inserted.
The numeric prefix argument N says how many times to repeat the insertion.
Before insertion, `expand-abbrev' is executed if the inserted character does
not have word syntax and the previous character in the buffer does.
@@ -272,10 +271,14 @@ After insertion, `internal-auto-fill' is called if
`auto-fill-function' is non-nil and if the `auto-fill-chars' table has
a non-nil value for the inserted character. At the end, it runs
`post-self-insert-hook'. */)
- (Lisp_Object n)
+ (Lisp_Object n, Lisp_Object c)
{
CHECK_FIXNUM (n);
+ /* Backward compatibility. */
+ if (NILP (c))
+ c = last_command_event;
+
if (XFIXNUM (n) < 0)
error ("Negative repetition argument %"pI"d", XFIXNUM (n));
@@ -283,11 +286,11 @@ a non-nil value for the inserted character. At the end, it runs
call0 (Qundo_auto_amalgamate);
/* Barf if the key that invoked this was not a character. */
- if (!CHARACTERP (last_command_event))
+ if (!CHARACTERP (c))
bitch_at_user ();
else {
int character = translate_char (Vtranslation_table_for_input,
- XFIXNUM (last_command_event));
+ XFIXNUM (c));
int val = internal_self_insert (character, XFIXNAT (n));
if (val == 2)
Fset (Qundo_auto__this_command_amalgamating, Qnil);