comparison src/callint.c @ 13308:99457b67e20c

(Fcall_interactively): New arg KEYS.
author Richard M. Stallman <rms@gnu.org>
date Fri, 27 Oct 1995 21:55:33 +0000
parents 297a0e21501a
children 8c89b569cfa9
comparison
equal deleted inserted replaced
13307:4bc9015f709e 13308:99457b67e20c
162 && NILP (current_buffer->mark_active)) 162 && NILP (current_buffer->mark_active))
163 Fsignal (Qmark_inactive, Qnil); 163 Fsignal (Qmark_inactive, Qnil);
164 } 164 }
165 165
166 166
167 DEFUN ("call-interactively", Fcall_interactively, Scall_interactively, 1, 2, 0, 167 DEFUN ("call-interactively", Fcall_interactively, Scall_interactively, 1, 3, 0,
168 "Call FUNCTION, reading args according to its interactive calling specs.\n\ 168 "Call FUNCTION, reading args according to its interactive calling specs.\n\
169 Return the value FUNCTION returns.\n\ 169 Return the value FUNCTION returns.\n\
170 The function contains a specification of how to do the argument reading.\n\ 170 The function contains a specification of how to do the argument reading.\n\
171 In the case of user-defined functions, this is specified by placing a call\n\ 171 In the case of user-defined functions, this is specified by placing a call\n\
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.")
178 (function, record) 178 (function, record, keys)
179 Lisp_Object function, record; 179 Lisp_Object function, record, keys;
180 { 180 {
181 Lisp_Object *args, *visargs; 181 Lisp_Object *args, *visargs;
182 unsigned char **argstrings; 182 unsigned char **argstrings;
183 Lisp_Object fun; 183 Lisp_Object fun;
184 Lisp_Object funcar; 184 Lisp_Object funcar;
204 int count, foo; 204 int count, foo;
205 char prompt1[100]; 205 char prompt1[100];
206 char *tem1; 206 char *tem1;
207 int arg_from_tty = 0; 207 int arg_from_tty = 0;
208 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 208 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
209 int key_count;
210
211 if (NILP (keys))
212 keys = this_command_keys, key_count = this_command_key_count;
213 else
214 {
215 CHECK_VECTOR (keys, 3);
216 key_count = XVECTOR (keys)->size;
217 }
209 218
210 /* Save this now, since use of minibuffer will clobber it. */ 219 /* Save this now, since use of minibuffer will clobber it. */
211 prefix_arg = Vcurrent_prefix_arg; 220 prefix_arg = Vcurrent_prefix_arg;
212 221
213 retry: 222 retry:
320 } 329 }
321 330
322 /* Here if function specifies a string to control parsing the defaults */ 331 /* Here if function specifies a string to control parsing the defaults */
323 332
324 /* Set next_event to point to the first event with parameters. */ 333 /* Set next_event to point to the first event with parameters. */
325 for (next_event = 0; next_event < this_command_key_count; next_event++) 334 for (next_event = 0; next_event < key_count; next_event++)
326 if (EVENT_HAS_PARAMETERS 335 if (EVENT_HAS_PARAMETERS (XVECTOR (keys)->contents[next_event]))
327 (XVECTOR (this_command_keys)->contents[next_event]))
328 break; 336 break;
329 337
330 /* Handle special starting chars `*' and `@'. Also `-'. */ 338 /* Handle special starting chars `*' and `@'. Also `-'. */
331 /* Note that `+' is reserved for user extensions. */ 339 /* Note that `+' is reserved for user extensions. */
332 while (1) 340 while (1)
344 string++; 352 string++;
345 else if (*string == '@') 353 else if (*string == '@')
346 { 354 {
347 Lisp_Object event; 355 Lisp_Object event;
348 356
349 event = XVECTOR (this_command_keys)->contents[next_event]; 357 event = XVECTOR (keys)->contents[next_event];
350 if (EVENT_HAS_PARAMETERS (event) 358 if (EVENT_HAS_PARAMETERS (event)
351 && (event = XCONS (event)->cdr, CONSP (event)) 359 && (event = XCONS (event)->cdr, CONSP (event))
352 && (event = XCONS (event)->car, CONSP (event)) 360 && (event = XCONS (event)->car, CONSP (event))
353 && (event = XCONS (event)->car, WINDOWP (event))) 361 && (event = XCONS (event)->car, WINDOWP (event)))
354 { 362 {
507 teml = args[i]; 515 teml = args[i];
508 visargs[i] = Fkey_description (teml); 516 visargs[i] = Fkey_description (teml);
509 break; 517 break;
510 518
511 case 'e': /* The invoking event. */ 519 case 'e': /* The invoking event. */
512 if (next_event >= this_command_key_count) 520 if (next_event >= key_count)
513 error ("%s must be bound to an event with parameters", 521 error ("%s must be bound to an event with parameters",
514 (SYMBOLP (function) 522 (SYMBOLP (function)
515 ? (char *) XSYMBOL (function)->name->data 523 ? (char *) XSYMBOL (function)->name->data
516 : "command")); 524 : "command"));
517 args[i] = XVECTOR (this_command_keys)->contents[next_event++]; 525 args[i] = XVECTOR (keys)->contents[next_event++];
518 varies[i] = -1; 526 varies[i] = -1;
519 527
520 /* Find the next parameterized event. */ 528 /* Find the next parameterized event. */
521 while (next_event < this_command_key_count 529 while (next_event < key_count
522 && ! (EVENT_HAS_PARAMETERS 530 && ! (EVENT_HAS_PARAMETERS
523 (XVECTOR (this_command_keys)->contents[next_event]))) 531 (XVECTOR (keys)->contents[next_event])))
524 next_event++; 532 next_event++;
525 533
526 break; 534 break;
527 535
528 case 'm': /* Value of mark. Does not do I/O. */ 536 case 'm': /* Value of mark. Does not do I/O. */