diff options
author | Karl Heuer <kwzh@gnu.org> | 1995-12-21 16:57:00 +0000 |
---|---|---|
committer | Karl Heuer <kwzh@gnu.org> | 1995-12-21 16:57:00 +0000 |
commit | 71eda2d573235b5b1a4a603eddbee12061a9070d (patch) | |
tree | ccacebb96aa75d225e09c200a41573116a85c10f /src/callint.c | |
parent | 29ea926860f748b411725cff9a6b2640a5fe10aa (diff) | |
download | emacs-71eda2d573235b5b1a4a603eddbee12061a9070d.tar.gz |
(Fcall_interactively): Handle an arg of form (FCN ARGS...).
(Fcall_interactively): Move have_prefix_arg label to 'p'.
Diffstat (limited to 'src/callint.c')
-rw-r--r-- | src/callint.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/callint.c b/src/callint.c index c8117d169d2..94f64c63528 100644 --- a/src/callint.c +++ b/src/callint.c @@ -174,13 +174,16 @@ See `interactive'.\n\ \n\ Optional second arg RECORD-FLAG non-nil\n\ means unconditionally put this command in the command-history.\n\ -Otherwise, this is done only if an arg is read using the minibuffer.") +Otherwise, this is done only if an arg is read using the minibuffer.\n\n\ +FUNCTION may be a list (FUNCTION ARGS...), which means to provide\n\ +the arguments ARGS before the ones read by FUNCTION's interactive spec.") (function, record, keys) Lisp_Object function, record, keys; { Lisp_Object *args, *visargs; unsigned char **argstrings; Lisp_Object fun; + Lisp_Object given_args; Lisp_Object funcar; Lisp_Object specs; Lisp_Object teml; @@ -219,6 +222,16 @@ Otherwise, this is done only if an arg is read using the minibuffer.") /* Save this now, since use of minibuffer will clobber it. */ prefix_arg = Vcurrent_prefix_arg; + /* Separate out any initial args specified by the caller. */ + if (CONSP (function) && ! EQ (XCONS (function)->car, Qlambda) + && ! EQ (XCONS (function)->car, Qautoload)) + { + given_args = XCONS (function)->cdr; + function = XCONS (function)->car; + } + else + given_args = Qnil; + retry: if (SYMBOLP (function)) @@ -290,7 +303,7 @@ Otherwise, this is done only if an arg is read using the minibuffer.") i = num_input_chars; input = specs; /* Compute the arg values using the user's expression. */ - specs = Feval (specs); + specs = nconc2 (Fcopy_sequence (given_args), Feval (specs)); if (i != num_input_chars || !NILP (record)) { /* We should record this command on the command history. */ @@ -403,7 +416,8 @@ Otherwise, this is done only if an arg is read using the minibuffer.") else tem = (unsigned char *) ""; } - count = j; + /* Add in the number of args the caller specified. */ + count = j + XINT (Flength (given_args)); args = (Lisp_Object *) alloca ((count + 1) * sizeof (Lisp_Object)); visargs = (Lisp_Object *) alloca ((count + 1) * sizeof (Lisp_Object)); @@ -417,6 +431,16 @@ Otherwise, this is done only if an arg is read using the minibuffer.") varies[i] = 0; } + /* Put any args that the caller specified + into the vector. */ + i = 1; + while (!NILP (given_args)) + { + visargs[i] = args[i] = XCONS (given_args)->car; + given_args = XCONS (given_args)->cdr; + i++; + } + GCPRO4 (prefix_arg, function, *args, *visargs); gcpro3.nvars = (count + 1); gcpro4.nvars = (count + 1); @@ -425,7 +449,7 @@ Otherwise, this is done only if an arg is read using the minibuffer.") specbind (Qenable_recursive_minibuffers, Qt); tem = string; - for (i = 1; *tem; i++) + for (; *tem; i++) { strncpy (prompt1, tem + 1, sizeof prompt1 - 1); prompt1[sizeof prompt1 - 1] = 0; @@ -566,13 +590,13 @@ Otherwise, this is done only if an arg is read using the minibuffer.") break; case 'P': /* Prefix arg in raw form. Does no I/O. */ - have_prefix_arg: args[i] = prefix_arg; /* visargs[i] = Qnil; */ varies[i] = -1; break; case 'p': /* Prefix arg converted to number. No I/O. */ + have_prefix_arg: args[i] = Fprefix_numeric_value (prefix_arg); /* visargs[i] = Qnil; */ varies[i] = -1; |