changeset 13308:99457b67e20c

(Fcall_interactively): New arg KEYS.
author Richard M. Stallman <rms@gnu.org>
date Fri, 27 Oct 1995 21:55:33 +0000
parents 4bc9015f709e
children 499e9df6c0f6
files src/callint.c
diffstat 1 files changed, 19 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/callint.c	Fri Oct 27 17:48:32 1995 +0000
+++ b/src/callint.c	Fri Oct 27 21:55:33 1995 +0000
@@ -164,7 +164,7 @@
 }
 
 
-DEFUN ("call-interactively", Fcall_interactively, Scall_interactively, 1, 2, 0,
+DEFUN ("call-interactively", Fcall_interactively, Scall_interactively, 1, 3, 0,
   "Call FUNCTION, reading args according to its interactive calling specs.\n\
 Return the value FUNCTION returns.\n\
 The function contains a specification of how to do the argument reading.\n\
@@ -175,8 +175,8 @@
 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.")
-  (function, record)
-     Lisp_Object function, record;
+  (function, record, keys)
+     Lisp_Object function, record, keys;
 {
   Lisp_Object *args, *visargs;
   unsigned char **argstrings;
@@ -206,6 +206,15 @@
   char *tem1;
   int arg_from_tty = 0;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
+  int key_count;
+
+  if (NILP (keys))
+    keys = this_command_keys, key_count = this_command_key_count;
+  else
+    {
+      CHECK_VECTOR (keys, 3);
+      key_count = XVECTOR (keys)->size;
+    }
 
   /* Save this now, since use of minibuffer will clobber it. */
   prefix_arg = Vcurrent_prefix_arg;
@@ -322,9 +331,8 @@
   /* Here if function specifies a string to control parsing the defaults */
 
   /* Set next_event to point to the first event with parameters.  */
-  for (next_event = 0; next_event < this_command_key_count; next_event++)
-    if (EVENT_HAS_PARAMETERS
-	(XVECTOR (this_command_keys)->contents[next_event]))
+  for (next_event = 0; next_event < key_count; next_event++)
+    if (EVENT_HAS_PARAMETERS (XVECTOR (keys)->contents[next_event]))
       break;
   
   /* Handle special starting chars `*' and `@'.  Also `-'.  */
@@ -346,7 +354,7 @@
 	{
 	  Lisp_Object event;
 
-	  event = XVECTOR (this_command_keys)->contents[next_event];
+	  event = XVECTOR (keys)->contents[next_event];
 	  if (EVENT_HAS_PARAMETERS (event)
 	      && (event = XCONS (event)->cdr, CONSP (event))
 	      && (event = XCONS (event)->car, CONSP (event))
@@ -509,18 +517,18 @@
 	  break;
 
 	case 'e':		/* The invoking event.  */
-	  if (next_event >= this_command_key_count)
+	  if (next_event >= key_count)
 	    error ("%s must be bound to an event with parameters",
 		   (SYMBOLP (function)
 		    ? (char *) XSYMBOL (function)->name->data
 		    : "command"));
-	  args[i] = XVECTOR (this_command_keys)->contents[next_event++];
+	  args[i] = XVECTOR (keys)->contents[next_event++];
 	  varies[i] = -1;
 
 	  /* Find the next parameterized event.  */
-	  while (next_event < this_command_key_count
+	  while (next_event < key_count
 		 && ! (EVENT_HAS_PARAMETERS
-		       (XVECTOR (this_command_keys)->contents[next_event])))
+		       (XVECTOR (keys)->contents[next_event])))
 	    next_event++;
 
 	  break;