Mercurial > emacs
comparison src/callint.c @ 13764:db7fb833ba03
(Fcall_interactively): Handle an arg of form (FCN ARGS...).
(Fcall_interactively): Move have_prefix_arg label to 'p'.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Thu, 21 Dec 1995 16:57:00 +0000 |
parents | 8310d6085087 |
children | f5bd72a6fe48 |
comparison
equal
deleted
inserted
replaced
13763:89bb535d206d | 13764:db7fb833ba03 |
---|---|
172 to the function `interactive' at the top level of the function body.\n\ | 172 to the function `interactive' at the top level of the function body.\n\ |
173 See `interactive'.\n\ | 173 See `interactive'.\n\ |
174 \n\ | 174 \n\ |
175 Optional second arg RECORD-FLAG non-nil\n\ | 175 Optional second arg RECORD-FLAG non-nil\n\ |
176 means unconditionally put this command in the command-history.\n\ | 176 means unconditionally put this command in the command-history.\n\ |
177 Otherwise, this is done only if an arg is read using the minibuffer.") | 177 Otherwise, this is done only if an arg is read using the minibuffer.\n\n\ |
178 FUNCTION may be a list (FUNCTION ARGS...), which means to provide\n\ | |
179 the arguments ARGS before the ones read by FUNCTION's interactive spec.") | |
178 (function, record, keys) | 180 (function, record, keys) |
179 Lisp_Object function, record, keys; | 181 Lisp_Object function, record, keys; |
180 { | 182 { |
181 Lisp_Object *args, *visargs; | 183 Lisp_Object *args, *visargs; |
182 unsigned char **argstrings; | 184 unsigned char **argstrings; |
183 Lisp_Object fun; | 185 Lisp_Object fun; |
186 Lisp_Object given_args; | |
184 Lisp_Object funcar; | 187 Lisp_Object funcar; |
185 Lisp_Object specs; | 188 Lisp_Object specs; |
186 Lisp_Object teml; | 189 Lisp_Object teml; |
187 Lisp_Object enable; | 190 Lisp_Object enable; |
188 int speccount = specpdl_ptr - specpdl; | 191 int speccount = specpdl_ptr - specpdl; |
216 key_count = XVECTOR (keys)->size; | 219 key_count = XVECTOR (keys)->size; |
217 } | 220 } |
218 | 221 |
219 /* Save this now, since use of minibuffer will clobber it. */ | 222 /* Save this now, since use of minibuffer will clobber it. */ |
220 prefix_arg = Vcurrent_prefix_arg; | 223 prefix_arg = Vcurrent_prefix_arg; |
224 | |
225 /* Separate out any initial args specified by the caller. */ | |
226 if (CONSP (function) && ! EQ (XCONS (function)->car, Qlambda) | |
227 && ! EQ (XCONS (function)->car, Qautoload)) | |
228 { | |
229 given_args = XCONS (function)->cdr; | |
230 function = XCONS (function)->car; | |
231 } | |
232 else | |
233 given_args = Qnil; | |
221 | 234 |
222 retry: | 235 retry: |
223 | 236 |
224 if (SYMBOLP (function)) | 237 if (SYMBOLP (function)) |
225 enable = Fget (function, Qenable_recursive_minibuffers); | 238 enable = Fget (function, Qenable_recursive_minibuffers); |
288 { | 301 { |
289 Lisp_Object input; | 302 Lisp_Object input; |
290 i = num_input_chars; | 303 i = num_input_chars; |
291 input = specs; | 304 input = specs; |
292 /* Compute the arg values using the user's expression. */ | 305 /* Compute the arg values using the user's expression. */ |
293 specs = Feval (specs); | 306 specs = nconc2 (Fcopy_sequence (given_args), Feval (specs)); |
294 if (i != num_input_chars || !NILP (record)) | 307 if (i != num_input_chars || !NILP (record)) |
295 { | 308 { |
296 /* We should record this command on the command history. */ | 309 /* We should record this command on the command history. */ |
297 Lisp_Object values, car; | 310 Lisp_Object values, car; |
298 /* Make a copy of the list of values, for the command history, | 311 /* Make a copy of the list of values, for the command history, |
401 if (tem) | 414 if (tem) |
402 tem++; | 415 tem++; |
403 else | 416 else |
404 tem = (unsigned char *) ""; | 417 tem = (unsigned char *) ""; |
405 } | 418 } |
406 count = j; | 419 /* Add in the number of args the caller specified. */ |
420 count = j + XINT (Flength (given_args)); | |
407 | 421 |
408 args = (Lisp_Object *) alloca ((count + 1) * sizeof (Lisp_Object)); | 422 args = (Lisp_Object *) alloca ((count + 1) * sizeof (Lisp_Object)); |
409 visargs = (Lisp_Object *) alloca ((count + 1) * sizeof (Lisp_Object)); | 423 visargs = (Lisp_Object *) alloca ((count + 1) * sizeof (Lisp_Object)); |
410 argstrings = (unsigned char **) alloca ((count + 1) * sizeof (char *)); | 424 argstrings = (unsigned char **) alloca ((count + 1) * sizeof (char *)); |
411 varies = (int *) alloca ((count + 1) * sizeof (int)); | 425 varies = (int *) alloca ((count + 1) * sizeof (int)); |
415 args[i] = Qnil; | 429 args[i] = Qnil; |
416 visargs[i] = Qnil; | 430 visargs[i] = Qnil; |
417 varies[i] = 0; | 431 varies[i] = 0; |
418 } | 432 } |
419 | 433 |
434 /* Put any args that the caller specified | |
435 into the vector. */ | |
436 i = 1; | |
437 while (!NILP (given_args)) | |
438 { | |
439 visargs[i] = args[i] = XCONS (given_args)->car; | |
440 given_args = XCONS (given_args)->cdr; | |
441 i++; | |
442 } | |
443 | |
420 GCPRO4 (prefix_arg, function, *args, *visargs); | 444 GCPRO4 (prefix_arg, function, *args, *visargs); |
421 gcpro3.nvars = (count + 1); | 445 gcpro3.nvars = (count + 1); |
422 gcpro4.nvars = (count + 1); | 446 gcpro4.nvars = (count + 1); |
423 | 447 |
424 if (!NILP (enable)) | 448 if (!NILP (enable)) |
425 specbind (Qenable_recursive_minibuffers, Qt); | 449 specbind (Qenable_recursive_minibuffers, Qt); |
426 | 450 |
427 tem = string; | 451 tem = string; |
428 for (i = 1; *tem; i++) | 452 for (; *tem; i++) |
429 { | 453 { |
430 strncpy (prompt1, tem + 1, sizeof prompt1 - 1); | 454 strncpy (prompt1, tem + 1, sizeof prompt1 - 1); |
431 prompt1[sizeof prompt1 - 1] = 0; | 455 prompt1[sizeof prompt1 - 1] = 0; |
432 tem1 = index (prompt1, '\n'); | 456 tem1 = index (prompt1, '\n'); |
433 if (tem1) *tem1 = 0; | 457 if (tem1) *tem1 = 0; |
564 while (! NUMBERP (args[i])); | 588 while (! NUMBERP (args[i])); |
565 visargs[i] = last_minibuf_string; | 589 visargs[i] = last_minibuf_string; |
566 break; | 590 break; |
567 | 591 |
568 case 'P': /* Prefix arg in raw form. Does no I/O. */ | 592 case 'P': /* Prefix arg in raw form. Does no I/O. */ |
569 have_prefix_arg: | |
570 args[i] = prefix_arg; | 593 args[i] = prefix_arg; |
571 /* visargs[i] = Qnil; */ | 594 /* visargs[i] = Qnil; */ |
572 varies[i] = -1; | 595 varies[i] = -1; |
573 break; | 596 break; |
574 | 597 |
575 case 'p': /* Prefix arg converted to number. No I/O. */ | 598 case 'p': /* Prefix arg converted to number. No I/O. */ |
599 have_prefix_arg: | |
576 args[i] = Fprefix_numeric_value (prefix_arg); | 600 args[i] = Fprefix_numeric_value (prefix_arg); |
577 /* visargs[i] = Qnil; */ | 601 /* visargs[i] = Qnil; */ |
578 varies[i] = -1; | 602 varies[i] = -1; |
579 break; | 603 break; |
580 | 604 |