/* Call a Lisp function interactively.
- Copyright (C) 1985, 1986, 1993, 1994, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1985, 86, 93, 94, 95, 1997 Free Software Foundation, Inc.
This file is part of GNU Emacs.
This skips events that are integers or symbols.\n\
f -- Existing file name.\n\
F -- Possibly nonexistent file name.\n\
+i -- Ignored, i.e. always nil. Does not do I/O.\n\
k -- Key sequence (downcase the last event if needed to get a definition).\n\
K -- Key sequence to be redefined (do not downcase the last event).\n\
m -- Value of mark as number. Does not do I/O.\n\
+M -- Any string. Inherits the current input method.\n\
n -- Number read using minibuffer.\n\
N -- Raw prefix arg, or if none, do like code `n'.\n\
p -- Prefix arg converted to number. Does not do I/O.\n\
P -- Prefix arg in raw form. Does not do I/O.\n\
r -- Region: point and mark as 2 numeric args, smallest first. Does no I/O.\n\
-s -- Any string.\n\
+s -- Any string. Does not inherit the current input method.\n\
S -- Any symbol.\n\
v -- Variable name: symbol that is user-variable-p.\n\
x -- Lisp expression read but not evaluated.\n\
X -- Lisp expression read and evaluated.\n\
+z -- Coding system.\n\
+Z -- Coding system, nil if no prefix arg.\n\
In addition, if the string begins with `*'\n\
then an error is signaled if the buffer is read-only.\n\
This happens before reading any arguments.\n\
{
/* Make a copy of string so that if a GC relocates specs,
`string' will still be valid. */
- string = (unsigned char *) alloca (XSTRING (specs)->size + 1);
- bcopy (XSTRING (specs)->data, string, XSTRING (specs)->size + 1);
+ string = (unsigned char *) alloca (STRING_BYTES (XSTRING (specs)) + 1);
+ bcopy (XSTRING (specs)->data, string,
+ STRING_BYTES (XSTRING (specs)) + 1);
}
else if (string == 0)
{
Lisp_Object input;
- i = num_input_chars;
+ i = num_input_events;
input = specs;
/* Compute the arg values using the user's expression. */
specs = Feval (specs);
- if (i != num_input_chars || !NILP (record_flag))
+ if (i != num_input_events || !NILP (record_flag))
{
/* We should record this command on the command history. */
Lisp_Object values, car;
corresponding to the Lisp strings in visargs. */
for (j = 1; j < i; j++)
argstrings[j]
- = EQ (visargs[j], Qnil)
- ? (unsigned char *) ""
- : XSTRING (visargs[j])->data;
+ = (EQ (visargs[j], Qnil)
+ ? (unsigned char *) ""
+ : XSTRING (visargs[j])->data);
/* Process the format-string in prompt1, putting the output
into callint_message. Make callint_message bigger if necessary.
{
int nchars = doprnt (callint_message, callint_message_size,
prompt1, (char *)0,
- j - 1, argstrings + 1);
+ j - 1, (char **) argstrings + 1);
if (nchars < callint_message_size)
break;
callint_message_size *= 2;
{
case 'a': /* Symbol defined as a function */
visargs[i] = Fcompleting_read (build_string (callint_message),
- Vobarray, Qfboundp, Qt, Qnil, Qnil);
+ Vobarray, Qfboundp, Qt,
+ Qnil, Qnil, Qnil, Qnil);
/* Passing args[i] directly stimulates compiler bug */
teml = visargs[i];
args[i] = Fintern (teml, Qnil);
break;
case 'c': /* Character */
- /* Use message_nolog rather than message1_nolog here,
+ /* Use message_with_string rather than message1_nolog here,
so that nothing bad happens if callint_message is changed
within Fread_char (by a timer, for example). */
- message_nolog ("%s", callint_message);
+ message_with_string ("%s", build_string (callint_message), 0);
args[i] = Fread_char ();
message1_nolog ((char *) 0);
/* Passing args[i] directly stimulates compiler bug */
case 'C': /* Command: symbol with interactive function */
visargs[i] = Fcompleting_read (build_string (callint_message),
- Vobarray, Qcommandp, Qt, Qnil, Qnil);
+ Vobarray, Qcommandp,
+ Qt, Qnil, Qnil, Qnil, Qnil);
/* Passing args[i] directly stimulates compiler bug */
teml = visargs[i];
args[i] = Fintern (teml, Qnil);
break;
case 'd': /* Value of point. Does not do I/O. */
- Fset_marker (point_marker, make_number (PT), Qnil);
+ set_marker_both (point_marker, Qnil, PT, PT_BYTE);
args[i] = point_marker;
/* visargs[i] = Qnil; */
varies[i] = 1;
Qnil, Qnil, Qnil, Qnil);
break;
+ case 'i': /* Ignore an argument -- Does not do I/O */
+ varies[i] = -1;
+ break;
+
case 'k': /* Key sequence. */
{
int speccount1 = specpdl_ptr - specpdl;
varies[i] = 2;
break;
+ case 'M': /* String read via minibuffer with
+ inheriting the current input method. */
+ args[i] = Fread_string (build_string (callint_message),
+ Qnil, Qnil, Qnil, Qt);
+ break;
+
case 'N': /* Prefix arg, else number from minibuffer */
if (!NILP (prefix_arg))
goto have_prefix_arg;
if (! first)
{
message ("Please enter a number.");
- sit_for (1, 0, 0, 0);
+ sit_for (1, 0, 0, 0, 0);
}
first = 0;
tem = Fread_from_minibuffer (build_string (callint_message),
- Qnil, Qnil, Qnil, Qnil);
+ Qnil, Qnil, Qnil, Qnil, Qnil,
+ Qnil);
if (! STRINGP (tem) || XSTRING (tem)->size == 0)
args[i] = Qnil;
else
case 'r': /* Region, point and mark as 2 args. */
check_mark ();
- Fset_marker (point_marker, make_number (PT), Qnil);
+ set_marker_both (point_marker, Qnil, PT, PT_BYTE);
/* visargs[i+1] = Qnil; */
foo = marker_position (current_buffer->mark);
/* visargs[i] = Qnil; */
varies[i] = 4;
break;
- case 's': /* String read via minibuffer. */
- args[i] = Fread_string (build_string (callint_message), Qnil, Qnil);
+ case 's': /* String read via minibuffer without
+ inheriting the current input method. */
+ args[i] = Fread_string (build_string (callint_message),
+ Qnil, Qnil, Qnil, Qnil);
break;
case 'S': /* Any symbol. */
visargs[i] = Fread_string (build_string (callint_message),
- Qnil, Qnil);
+ Qnil, Qnil, Qnil, Qnil);
/* Passing args[i] directly stimulates compiler bug */
teml = visargs[i];
args[i] = Fintern (teml, Qnil);
case 'v': /* Variable name: symbol that is
user-variable-p. */
- args[i] = Fread_variable (build_string (callint_message));
+ args[i] = Fread_variable (build_string (callint_message), Qnil);
visargs[i] = last_minibuf_string;
break;
visargs[i] = last_minibuf_string;
break;
+ case 'Z': /* Coding-system symbol, or ignore the
+ argument if no prefix */
+ if (NILP (prefix_arg))
+ {
+ args[i] = Qnil;
+ varies[i] = -1;
+ }
+ else
+ {
+ args[i]
+ = Fread_non_nil_coding_system (build_string (callint_message));
+ visargs[i] = last_minibuf_string;
+ }
+ break;
+
+ case 'z': /* Coding-system symbol or nil */
+ args[i] = Fread_coding_system (build_string (callint_message), Qnil);
+ visargs[i] = last_minibuf_string;
+ break;
+
/* We have a case for `+' so we get an error
if anyone tries to define one here. */
case '+':
return val;
}
+void
syms_of_callint ()
{
point_marker = Fmake_marker ();