1 /* Call a Lisp function interactively.
2 Copyright (C) 1985, 1986, 1992, 1993, 1994 Free Software Foundation, Inc.
3 Copyright (C) 1995, 1996 Ben Wing.
5 This file is part of XEmacs.
7 XEmacs is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with XEmacs; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* Synched up with: FSF 19.30, Mule 2.0. */
27 Mly or JWZ: various changes.
40 extern int num_input_chars;
42 Lisp_Object Vcurrent_prefix_arg;
43 Lisp_Object Qcall_interactively;
44 Lisp_Object Vcommand_history;
46 Lisp_Object Vcommand_debug_status, Qcommand_debug_status;
47 Lisp_Object Qenable_recursive_minibuffers;
50 /* Non-nil means treat the mark as active
51 even if mark_active is 0. */
52 Lisp_Object Vmark_even_if_inactive;
55 #if 0 /* ill-conceived */
56 Lisp_Object Vmouse_leave_buffer_hook, Qmouse_leave_buffer_hook;
59 Lisp_Object QletX, Qsave_excursion;
61 Lisp_Object Qread_from_minibuffer;
62 Lisp_Object Qread_file_name;
63 Lisp_Object Qread_directory_name;
64 Lisp_Object Qcompleting_read;
65 Lisp_Object Qread_buffer;
66 Lisp_Object Qread_function;
67 Lisp_Object Qread_variable;
68 Lisp_Object Qread_expression;
69 Lisp_Object Qread_command;
70 Lisp_Object Qread_number;
71 Lisp_Object Qread_string;
72 Lisp_Object Qevents_to_keys;
74 #if defined(MULE) || defined(FILE_CODING)
75 Lisp_Object Qread_coding_system;
76 Lisp_Object Qread_non_nil_coding_system;
80 DEFUN ("interactive", Finteractive, 0, UNEVALLED, 0, /*
81 Specify a way of parsing arguments for interactive use of a function.
83 (defun foo (arg) "Doc string" (interactive "p") ...use arg...)
84 to make ARG be the prefix argument when `foo' is called as a command.
85 The "call" to `interactive' is actually a declaration rather than a function;
86 it tells `call-interactively' how to read arguments
87 to pass to the function.
88 When actually called, `interactive' just returns nil.
90 The argument of `interactive' is usually a string containing a code letter
91 followed by a prompt. (Some code letters do not use I/O to get
92 the argument and do not need prompts.) To prompt for multiple arguments,
93 give a code letter, its prompt, a newline, and another code letter, etc.
94 Prompts are passed to format, and may use % escapes to print the
95 arguments that have already been read.
96 If the argument is not a string, it is evaluated to get a list of
97 arguments to pass to the function.
98 Just `(interactive)' means pass no args when calling interactively.
100 Code letters available are:
101 a -- Function name: symbol with a function definition.
102 b -- Name of existing buffer.
103 B -- Name of buffer, possibly nonexistent.
105 C -- Command name: symbol with interactive function definition.
106 d -- Value of point as number. Does not do I/O.
108 e -- Last mouse-button or misc-user event that invoked this command.
109 If used more than once, the Nth `e' returns the Nth such event.
111 f -- Existing file name.
112 F -- Possibly nonexistent file name.
113 i -- Always nil, ignore. Use to skip arguments when interactive.
114 k -- Key sequence (a vector of events).
115 K -- Key sequence to be redefined (do not automatically down-case).
116 m -- Value of mark as number. Does not do I/O.
117 n -- Number read using minibuffer.
118 N -- Prefix arg converted to number, or if none, do like code `n'.
119 p -- Prefix arg converted to number. Does not do I/O.
120 P -- Prefix arg in raw form. Does not do I/O.
121 r -- Region: point and mark as 2 numeric args, smallest first. Does no I/O.
124 v -- Variable name: symbol that is user-variable-p.
125 x -- Lisp expression read but not evaluated.
126 X -- Lisp expression read and evaluated.
127 z -- Coding system. (Always nil if no Mule support.)
128 Z -- Coding system, nil if no prefix arg. (Always nil if no Mule support.)
129 In addition, if the string begins with `*'
130 then an error is signaled if the buffer is read-only.
131 This happens before reading any arguments.
132 If the string begins with `@', then the window the mouse is over is selected
133 before anything else is done.
134 If the string begins with `_', then this command will not cause the region
135 to be deactivated when it completes; that is, `zmacs-region-stays' will be
136 set to t when the command exits successfully.
137 You may use any of `@', `*' and `_' at the beginning of the string;
138 they are processed in the order that they appear.
145 /* Originally, this was just a function -- but `custom' used a
146 garden-variety version, so why not make it a subr? */
147 /* #### Move it to another file! */
148 DEFUN ("quote-maybe", Fquote_maybe, 1, 1, 0, /*
149 Quote EXPR if it is not self quoting.
161 || BIT_VECTORP (expr)
162 || (CONSP (expr) && EQ (XCAR (expr), Qlambda)))
163 ? expr : list2 (Qquote, expr));
166 /* Modify EXPR by quotifying each element (except the first). */
168 quotify_args (Lisp_Object expr)
172 for (tail = expr; CONSP (tail); tail = ptr->cdr)
175 ptr->car = Fquote_maybe (ptr->car);
185 if (zmacs_regions && !zmacs_region_active_p)
186 error ("The region is not active now");
188 tem = Fmarker_buffer (current_buffer->mark);
189 if (NILP (tem) || (XBUFFER (tem) != current_buffer))
190 error ("The mark is not set now");
192 return marker_position (current_buffer->mark);
196 callint_prompt (const Bufbyte *prompt_start, Bytecount prompt_length,
197 const Lisp_Object *args, int nargs)
199 Lisp_Object s = make_string (prompt_start, prompt_length);
202 /* Fformat no longer smashes its arg vector, so no need to copy it. */
204 if (!strchr ((char *) XSTRING_DATA (s), '%'))
207 RETURN_UNGCPRO (emacs_doprnt_string_lisp (0, s, 0, nargs, args));
210 /* `lambda' for RECORD-FLAG is an XEmacs addition. */
212 DEFUN ("call-interactively", Fcall_interactively, 1, 3, 0, /*
213 Call FUNCTION, reading args according to its interactive calling specs.
214 Return the value FUNCTION returns.
215 The function contains a specification of how to do the argument reading.
216 In the case of user-defined functions, this is specified by placing a call
217 to the function `interactive' at the top level of the function body.
220 If optional second arg RECORD-FLAG is the symbol `lambda', the interactive
221 calling arguments for FUNCTION are read and returned as a list,
222 but the function is not called on them.
224 If RECORD-FLAG is `t' then unconditionally put this command in the
225 command-history. Otherwise, this is done only if an arg is read using
228 The argument KEYS specifies the value to use instead of (this-command-keys)
229 when reading the arguments.
231 (function, record_flag, keys))
233 /* This function can GC */
234 int speccount = specpdl_depth ();
238 Lisp_Object specs = Qnil;
239 #ifdef IT_SEEMS_THAT_MLY_DOESNT_LIKE_THIS
242 /* If SPECS is a string, we reset prompt_data to string_data
243 * (XSTRING (specs)) every time a GC might have occurred */
244 const char *prompt_data = 0;
245 int prompt_index = 0;
247 int set_zmacs_region_stays = 0;
248 int mouse_event_count = 0;
255 len = XVECTOR_LENGTH (keys);
256 for (i = 0; i < len; i++)
257 CHECK_LIVE_EVENT (XVECTOR_DATA (keys)[i]);
260 /* Save this now, since use of minibuffer will clobber it. */
261 prefix = Vcurrent_prefix_arg;
265 #ifdef IT_SEEMS_THAT_MLY_DOESNT_LIKE_THIS
266 /* Marginal kludge. Use an evaluated interactive spec instead of this! */
267 if (SYMBOLP (function))
268 enable = Fget (function, Qenable_recursive_minibuffers, Qnil);
271 fun = indirect_function (function, 1);
273 /* Decode the kind of function. Either handle it and return,
274 or go to `lose' if not interactive, or go to `retry'
275 to specify a different function, or set either PROMPT_DATA or SPECS. */
279 prompt_data = XSUBR (fun)->prompt;
283 function = wrong_type_argument (Qcommandp, function);
286 #if 0 /* FSFmacs */ /* Huh? Where is this used? */
287 if ((EMACS_INT) prompt_data == 1)
288 /* Let SPECS (which is nil) be used as the args. */
292 else if (COMPILED_FUNCTIONP (fun))
294 Lisp_Compiled_Function *f = XCOMPILED_FUNCTION (fun);
295 if (! f->flags.interactivep)
297 specs = compiled_function_interactive (f);
299 else if (!CONSP (fun))
303 Lisp_Object funcar = Fcar (fun);
305 if (EQ (funcar, Qautoload))
307 struct gcpro gcpro1, gcpro2;
308 GCPRO2 (function, prefix);
309 do_autoload (fun, function);
313 else if (EQ (funcar, Qlambda))
315 specs = Fassq (Qinteractive, Fcdr (Fcdr (fun)));
318 specs = Fcar (Fcdr (specs));
324 /* FSFmacs makes an alloca() copy of prompt_data here.
325 We're more intelligent about this and just reset prompt_data
327 /* If either specs or prompt_data is set to a string, use it. */
328 if (!STRINGP (specs) && prompt_data == 0)
330 struct gcpro gcpro1, gcpro2, gcpro3;
331 int i = num_input_chars;
332 Lisp_Object input = specs;
334 GCPRO3 (function, specs, input);
335 /* Compute the arg values using the user's expression. */
336 specs = Feval (specs);
337 if (EQ (record_flag, Qlambda)) /* XEmacs addition */
342 if (!NILP (record_flag) || i != num_input_chars)
344 /* We should record this command on the command history. */
345 /* #### The following is too specific; should have general
346 mechanism for doing this. */
347 Lisp_Object values, car;
348 /* Make a copy of the list of values, for the command history,
349 and turn them into things we can eval. */
350 values = quotify_args (Fcopy_sequence (specs));
351 /* If the list of args was produced with an explicit call to `list',
352 look for elements that were computed with (region-beginning)
353 or (region-end), and put those expressions into VALUES
354 instead of the present values. */
358 /* Skip through certain special forms. */
359 while (EQ (car, Qlet) || EQ (car, QletX)
360 || EQ (car, Qsave_excursion))
362 while (CONSP (XCDR (input)))
363 input = XCDR (input);
364 input = XCAR (input);
371 Lisp_Object intail, valtail;
372 for (intail = Fcdr (input), valtail = values;
374 intail = Fcdr (intail), valtail = Fcdr (valtail))
380 Lisp_Object eltcar = Fcar (elt);
381 if (EQ (eltcar, Qpoint) ||
382 EQ (eltcar, Qmark) ||
383 EQ (eltcar, Qregion_beginning) ||
384 EQ (eltcar, Qregion_end))
385 Fsetcar (valtail, Fcar (intail));
391 = Fcons (Fcons (function, values), Vcommand_history);
393 single_console_state ();
394 RETURN_UNGCPRO (apply1 (fun, specs));
397 /* Here if function specifies a string to control parsing the defaults */
400 /* Translate interactive prompt. */
403 Lisp_Object domain = Qnil;
404 if (COMPILED_FUNCTIONP (fun))
405 domain = compiled_function_domain (XCOMPILED_FUNCTION (fun));
407 specs = Fgettext (specs);
409 specs = Fdgettext (domain, specs);
411 else if (prompt_data)
412 /* We do not have to worry about domains in this case because
413 prompt_data is non-nil only for built-in functions, which
414 always use the default domain. */
415 prompt_data = gettext (prompt_data);
418 /* Handle special starting chars `*' and `@' and `_'. */
419 /* Note that `+' is reserved for user extensions. */
422 struct gcpro gcpro1, gcpro2;
423 GCPRO2 (function, specs);
428 prompt_data = (const char *) XSTRING_DATA (specs);
430 if (prompt_data[prompt_index] == '+')
431 error ("`+' is not used in `interactive' for ordinary commands");
432 else if (prompt_data[prompt_index] == '*')
435 if (!NILP (current_buffer->read_only))
436 barf_if_buffer_read_only (current_buffer, -1, -1);
438 else if (prompt_data[prompt_index] == '@')
444 event = extract_vector_nth_mouse_event (keys, 0);
447 event = extract_this_command_keys_nth_mouse_event (0);
449 /* Doesn't work; see below */
450 event = Vcurrent_mouse_event;
454 Lisp_Object window = Fevent_window (event);
457 if (MINI_WINDOW_P (XWINDOW (window))
458 && ! (minibuf_level > 0 && EQ (window,
460 error ("Attempt to select inactive minibuffer window");
462 #if 0 /* unclean! see event-stream.c */
463 /* If the current buffer wants to clean up, let it. */
464 if (!NILP (Vmouse_leave_buffer_hook))
465 run_hook (Qmouse_leave_buffer_hook);
468 Fselect_window (window, Qnil);
472 else if (prompt_data[prompt_index] == '_')
475 set_zmacs_region_stays = 1;
485 /* Count the number of arguments the interactive spec would have
486 us give to the function. */
490 for (tem = prompt_data + prompt_index; *tem; )
492 /* 'r' specifications ("point and mark as 2 numeric args")
493 produce *two* arguments. */
498 tem = (const char *) strchr (tem + 1, '\n');
505 #ifdef IT_SEEMS_THAT_MLY_DOESNT_LIKE_THIS
507 specbind (Qenable_recursive_minibuffers, Qt);
512 /* Interactive function or no arguments; just call it */
513 if (EQ (record_flag, Qlambda))
515 if (!NILP (record_flag))
517 Vcommand_history = Fcons (list1 (function), Vcommand_history);
519 specbind (Qcommand_debug_status, Qnil);
520 /* XEmacs: was fun = call0 (fun), but that's backtraced wrong */
525 fun = Ffuncall (1, &fun);
528 if (set_zmacs_region_stays)
529 zmacs_region_stays = 1;
530 return unbind_to (speccount, fun);
533 /* Read interactive arguments */
535 /* args[-1] is the function to call */
536 /* args[n] is the n'th argument to the function */
537 int alloca_size = (1 /* function to call */
538 + argcount /* actual arguments */
539 + argcount /* visargs */
540 + argcount /* varies */
542 Lisp_Object *args = alloca_array (Lisp_Object, alloca_size) + 1;
543 /* visargs is an array of either Qnil or user-friendlier versions (often
544 * strings) of previous arguments, to use in prompts for successive
545 * arguments. ("Often strings" because emacs didn't used to have
546 * format %S and prin1-to-string.) */
547 Lisp_Object *visargs = args + argcount;
548 /* If varies[i] is non-null, the i'th argument shouldn't just have
549 its value in this call quoted in the command history. It should be
550 recorded as a call to the function named varies[i]]. */
551 Lisp_Object *varies = visargs + argcount;
552 int arg_from_tty = 0;
554 struct gcpro gcpro1, gcpro2;
557 for (argnum = 0; argnum < alloca_size - 1; argnum++)
560 /* Must GC-protect args[-1] (ie function) because Ffuncall doesn't */
561 /* `function' itself isn't GC-protected -- use args[-1] from here
562 (actually, doesn't matter since Emacs GC doesn't relocate, sigh) */
563 GCPRO2 (prefix, args[-1]);
564 gcpro2.nvars = alloca_size;
566 for (argnum = 0; ; argnum++)
568 const char *prompt_start = prompt_data + prompt_index + 1;
569 const char *prompt_limit = (const char *) strchr (prompt_start, '\n');
571 prompt_length = ((prompt_limit)
572 ? (prompt_limit - prompt_start)
573 : strlen (prompt_start));
574 if (prompt_limit && prompt_limit[1] == 0)
576 prompt_limit = 0; /* "sfoo:\n" -- strip tailing return */
579 /* This uses `visargs' instead of `args' so that global-set-key
580 prompts with "Set key C-x C-f to command: "instead of printing
581 event objects in there.
583 #define PROMPT() callint_prompt ((const Bufbyte *) prompt_start, prompt_length, visargs, argnum)
584 switch (prompt_data[prompt_index])
586 case 'a': /* Symbol defined as a function */
588 Lisp_Object tem = call1 (Qread_function, PROMPT ());
593 case 'b': /* Name of existing buffer */
595 Lisp_Object def = Fcurrent_buffer ();
596 if (EQ (Fselected_window (Qnil), minibuf_window))
597 def = Fother_buffer (def, Qnil, Qnil);
598 /* read-buffer returns a buffer name, not a buffer! */
599 args[argnum] = call3 (Qread_buffer, PROMPT (), def,
604 case 'B': /* Name of buffer, possibly nonexistent */
606 /* read-buffer returns a buffer name, not a buffer! */
607 args[argnum] = call2 (Qread_buffer, PROMPT (),
608 Fother_buffer (Fcurrent_buffer (), Qnil,
613 case 'c': /* Character */
616 int shadowing_speccount = specpdl_depth ();
618 specbind (Qcursor_in_echo_area, Qt);
619 message ("%s", XSTRING_DATA (PROMPT ()));
620 tem = (call0 (Qread_char));
622 /* visargs[argnum] = Fsingle_key_description (tem); */
623 /* FSF has visargs[argnum] = Fchar_to_string (tem); */
625 unbind_to (shadowing_speccount, Qnil);
627 /* #### `C-x / a' should not leave the prompt in the minibuffer.
628 This isn't the right fix, because (message ...) (read-char)
629 shouldn't leave the message there either... */
635 case 'C': /* Command: symbol with interactive function */
637 Lisp_Object tem = call1 (Qread_command, PROMPT ());
642 case 'd': /* Value of point. Does not do I/O. */
644 args[argnum] = Fcopy_marker (current_buffer->point_marker, Qt);
645 varies[argnum] = Qpoint;
653 event = extract_vector_nth_mouse_event (keys,
657 /* This doesn't quite work because this-command-keys
658 behaves in utterly counterintuitive ways. Sometimes
659 it retrieves an event back in the future, e.g. when
660 one command invokes another command and both are
661 invoked with the mouse. */
662 event = (extract_this_command_keys_nth_mouse_event
663 (mouse_event_count));
665 event = Vcurrent_mouse_event;
669 error ("%s must be bound to a mouse or misc-user event",
671 ? (char *) string_data (XSYMBOL (function)->name)
673 args[argnum] = event;
677 case 'D': /* Directory name. */
679 args[argnum] = call4 (Qread_directory_name, PROMPT (),
681 current_buffer->directory, /* default */
687 case 'f': /* Existing file name. */
689 Lisp_Object tem = call4 (Qread_file_name, PROMPT (),
692 Qzero /* must-match */
698 case 'F': /* Possibly nonexistent file name. */
700 args[argnum] = call4 (Qread_file_name, PROMPT (),
703 Qnil /* must-match */
708 case 'i': /* Ignore: always nil. Use to skip arguments. */
713 case 'k': /* Key sequence (vector of events) */
715 struct gcpro ngcpro1;
717 Lisp_Object key_prompt = PROMPT ();
720 tem = Fread_key_sequence (key_prompt, Qnil, Qnil);
723 visargs[argnum] = Fkey_description (tem);
724 /* The following makes `describe-key' not work with
725 extent-local keymaps and such; and anyway, it's
726 contrary to the documentation. */
727 /* args[argnum] = call1 (Qevents_to_keys, tem); */
732 case 'K': /* Key sequence (vector of events),
733 no automatic downcasing */
735 struct gcpro ngcpro1;
737 Lisp_Object key_prompt = PROMPT ();
740 tem = Fread_key_sequence (key_prompt, Qnil, Qt);
743 visargs[argnum] = Fkey_description (tem);
744 /* The following makes `describe-key' not work with
745 extent-local keymaps and such; and anyway, it's
746 contrary to the documentation. */
747 /* args[argnum] = call1 (Qevents_to_keys, tem); */
753 case 'm': /* Value of mark. Does not do I/O. */
755 args[argnum] = current_buffer->mark;
756 varies[argnum] = Qmark;
759 case 'n': /* Read number from minibuffer. */
762 args[argnum] = call2 (Qread_number, PROMPT (), Qnil);
763 /* numbers are too boring to go on command history */
764 /* arg_from_tty = 1; */
767 case 'N': /* Prefix arg, else number from minibuffer */
774 case 'P': /* Prefix arg in raw form. Does no I/O. */
776 args[argnum] = prefix;
779 case 'p': /* Prefix arg converted to number. No I/O. */
783 Lisp_Object tem = Fprefix_numeric_value (prefix);
788 case 'r': /* Region, point and mark as 2 args. */
790 Bufpos tem = check_mark ();
791 args[argnum] = (BUF_PT (current_buffer) < tem
792 ? Fcopy_marker (current_buffer->point_marker, Qt)
793 : current_buffer->mark);
794 varies[argnum] = Qregion_beginning;
795 args[++argnum] = (BUF_PT (current_buffer) > tem
796 ? Fcopy_marker (current_buffer->point_marker,
798 : current_buffer->mark);
799 varies[argnum] = Qregion_end;
802 case 's': /* String read via minibuffer. */
804 args[argnum] = call1 (Qread_string, PROMPT ());
808 case 'S': /* Any symbol. */
810 #if 0 /* Historical crock */
811 Lisp_Object tem = intern ("minibuffer-local-ns-map");
812 tem = find_symbol_value (tem);
813 if (UNBOUNDP (tem)) tem = Qnil;
814 tem = call3 (Qread_from_minibuffer, PROMPT (), Qnil,
816 args[argnum] = Fintern (tem, Qnil);
818 visargs[argnum] = Qnil;
821 Lisp_Object tem = call5 (Qcompleting_read,
826 /* nil, or prev attempt */
828 visargs[argnum] = tem;
829 /* I could use condition-case with this loser, but why bother?
830 * tem = Fread (tem); check-symbol-p;
832 tem = Fintern (tem, Qnil);
834 if (string_length (XSYMBOL (tem)->name) > 0)
835 /* Don't accept the empty-named symbol. If the loser
836 really wants this s/he can call completing-read
844 case 'v': /* Variable name: user-variable-p symbol */
846 Lisp_Object tem = call1 (Qread_variable, PROMPT ());
851 case 'x': /* Lisp expression read but not evaluated */
853 args[argnum] = call1 (Qread_expression, PROMPT ());
854 /* visargs[argnum] = Fprin1_to_string (args[argnum], Qnil); */
858 case 'X': /* Lisp expression read and evaluated */
860 Lisp_Object tem = call1 (Qread_expression, PROMPT ());
861 /* visargs[argnum] = Fprin1_to_string (tem, Qnil); */
862 args[argnum] = Feval (tem);
866 case 'Z': /* Coding-system symbol or nil if no prefix */
868 #if defined(MULE) || defined(FILE_CODING)
876 call1 (Qread_non_nil_coding_system, PROMPT ());
884 case 'z': /* Coding-system symbol */
886 #if defined(MULE) || defined(FILE_CODING)
887 args[argnum] = call1 (Qread_coding_system, PROMPT ());
895 /* We have a case for `+' so we get an error
896 if anyone tries to define one here. */
900 error ("Invalid `interactive' control letter \"%c\" (#o%03o).",
901 prompt_data[prompt_index],
902 prompt_data[prompt_index]);
906 if (NILP (visargs[argnum]))
907 visargs[argnum] = args[argnum];
912 prompt_data = (const char *) XSTRING_DATA (specs);
913 prompt_index += prompt_length + 1 + 1; /* +1 to skip spec, +1 for \n */
915 unbind_to (speccount, Qnil);
919 if (EQ (record_flag, Qlambda))
921 RETURN_UNGCPRO (Flist (argcount, args));
924 if (arg_from_tty || !NILP (record_flag))
926 /* Reuse visargs as a temporary for constructing the command history */
927 for (argnum = 0; argnum < argcount; argnum++)
929 if (!NILP (varies[argnum]))
930 visargs[argnum] = list1 (varies[argnum]);
932 visargs[argnum] = Fquote_maybe (args[argnum]);
934 Vcommand_history = Fcons (Fcons (args[-1], Flist (argcount, visargs)),
938 /* If we used a marker to hold point, mark, or an end of the region,
939 temporarily, convert it to an integer now. */
940 for (argnum = 0; argnum < argcount; argnum++)
941 if (!NILP (varies[argnum]))
942 XSETINT (args[argnum], marker_position (args[argnum]));
944 single_console_state ();
945 specbind (Qcommand_debug_status, Qnil);
946 fun = Ffuncall (argcount + 1, args - 1);
948 if (set_zmacs_region_stays)
949 zmacs_region_stays = 1;
950 return unbind_to (speccount, fun);
954 DEFUN ("prefix-numeric-value", Fprefix_numeric_value, 1, 1, 0, /*
955 Return numeric meaning of raw prefix argument ARG.
956 A raw prefix argument is what you get from `(interactive "P")'.
957 Its numeric meaning is what you would get from `(interactive "p")'.
963 if (EQ (raw, Qminus))
964 return make_int (-1);
967 if (CONSP (raw) && INTP (XCAR (raw)))
974 syms_of_callint (void)
976 defsymbol (&Qcall_interactively, "call-interactively");
977 defsymbol (&Qread_from_minibuffer, "read-from-minibuffer");
978 defsymbol (&Qcompleting_read, "completing-read");
979 defsymbol (&Qread_file_name, "read-file-name");
980 defsymbol (&Qread_directory_name, "read-directory-name");
981 defsymbol (&Qread_string, "read-string");
982 defsymbol (&Qread_buffer, "read-buffer");
983 defsymbol (&Qread_variable, "read-variable");
984 defsymbol (&Qread_function, "read-function");
985 defsymbol (&Qread_command, "read-command");
986 defsymbol (&Qread_number, "read-number");
987 defsymbol (&Qread_expression, "read-expression");
988 #if defined(MULE) || defined(FILE_CODING)
989 defsymbol (&Qread_coding_system, "read-coding-system");
990 defsymbol (&Qread_non_nil_coding_system, "read-non-nil-coding-system");
992 defsymbol (&Qevents_to_keys, "events-to-keys");
993 defsymbol (&Qcommand_debug_status, "command-debug-status");
994 defsymbol (&Qenable_recursive_minibuffers, "enable-recursive-minibuffers");
996 defsymbol (&QletX, "let*");
997 defsymbol (&Qsave_excursion, "save-excursion");
998 #if 0 /* ill-conceived */
999 defsymbol (&Qmouse_leave_buffer_hook, "mouse-leave-buffer-hook");
1002 DEFSUBR (Finteractive);
1003 DEFSUBR (Fquote_maybe);
1004 DEFSUBR (Fcall_interactively);
1005 DEFSUBR (Fprefix_numeric_value);
1009 vars_of_callint (void)
1011 DEFVAR_LISP ("current-prefix-arg", &Vcurrent_prefix_arg /*
1012 The value of the prefix argument for this editing command.
1013 It may be a number, or the symbol `-' for just a minus sign as arg,
1014 or a list whose car is a number for just one or more C-U's
1015 or nil if no argument has been specified.
1016 This is what `(interactive "P")' returns.
1018 Vcurrent_prefix_arg = Qnil;
1020 DEFVAR_LISP ("command-history", &Vcommand_history /*
1021 List of recent commands that read arguments from terminal.
1022 Each command is represented as a form to evaluate.
1024 Vcommand_history = Qnil;
1026 DEFVAR_LISP ("command-debug-status", &Vcommand_debug_status /*
1027 Debugging status of current interactive command.
1028 Bound each time `call-interactively' is called;
1029 may be set by the debugger as a reminder for itself.
1031 Vcommand_debug_status = Qnil;
1034 xxDEFVAR_LISP ("mark-even-if-inactive", &Vmark_even_if_inactive /*
1035 *Non-nil means you can use the mark even when inactive.
1036 This option makes a difference in Transient Mark mode.
1037 When the option is non-nil, deactivation of the mark
1038 turns off region highlighting, but commands that use the mark
1039 behave as if the mark were still active.
1041 Vmark_even_if_inactive = Qnil;
1044 #if 0 /* Doesn't work and is totally ill-conceived anyway. */
1045 xxDEFVAR_LISP ("mouse-leave-buffer-hook", &Vmouse_leave_buffer_hook /*
1046 Hook to run when about to switch windows with a mouse command.
1047 Its purpose is to give temporary modes such as Isearch mode
1048 a way to turn themselves off when a mouse command switches windows.
1050 Vmouse_leave_buffer_hook = Qnil;