21 |
|
|
22 |
|
|
23 |
#include <config.h> |
#include <config.h> |
24 |
|
|
25 |
#include "lisp.h" |
#include "lisp.h" |
26 |
#include "buffer.h" |
#include "buffer.h" |
27 |
#include "commands.h" |
#include "commands.h" |
63 |
/* Allocated length of that buffer. */ |
/* Allocated length of that buffer. */ |
64 |
static int callint_message_size; |
static int callint_message_size; |
65 |
|
|
|
/* This comment supplies the doc string for interactive, |
|
|
for make-docfile to see. We cannot put this in the real DEFUN |
|
|
due to limits in the Unix cpp. |
|
|
|
|
|
DEFUN ("interactive", Ffoo, Sfoo, 0, 0, 0, |
|
|
"Specify a way of parsing arguments for interactive use of a function.\n\ |
|
|
For example, write\n\ |
|
|
(defun foo (arg) \"Doc string\" (interactive \"p\") ...use arg...)\n\ |
|
|
to make ARG be the prefix argument when `foo' is called as a command.\n\ |
|
|
The \"call\" to `interactive' is actually a declaration rather than a function;\n\ |
|
|
it tells `call-interactively' how to read arguments\n\ |
|
|
to pass to the function.\n\ |
|
|
When actually called, `interactive' just returns nil.\n\ |
|
|
\n\ |
|
|
The argument of `interactive' is usually a string containing a code letter\n\ |
|
|
followed by a prompt. (Some code letters do not use I/O to get\n\ |
|
|
the argument and do not need prompts.) To prompt for multiple arguments,\n\ |
|
|
give a code letter, its prompt, a newline, and another code letter, etc.\n\ |
|
|
Prompts are passed to format, and may use % escapes to print the\n\ |
|
|
arguments that have already been read.\n\ |
|
|
If the argument is not a string, it is evaluated to get a list of\n\ |
|
|
arguments to pass to the function.\n\ |
|
|
Just `(interactive)' means pass no args when calling interactively.\n\ |
|
|
\nCode letters available are:\n\ |
|
|
a -- Function name: symbol with a function definition.\n\ |
|
|
b -- Name of existing buffer.\n\ |
|
|
B -- Name of buffer, possibly nonexistent.\n\ |
|
|
c -- Character (no input method is used).\n\ |
|
|
C -- Command name: symbol with interactive function definition.\n\ |
|
|
d -- Value of point as number. Does not do I/O.\n\ |
|
|
D -- Directory name.\n\ |
|
|
e -- Parametrized event (i.e., one that's a list) that invoked this command.\n\ |
|
|
If used more than once, the Nth `e' returns the Nth parameterized event.\n\ |
|
|
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. 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\ |
|
|
If the string begins with `@', then Emacs searches the key sequence\n\ |
|
|
which invoked the command for its first mouse click (or any other\n\ |
|
|
event which specifies a window), and selects that window before\n\ |
|
|
reading any arguments. You may use both `@' and `*'; they are\n\ |
|
|
processed in the order that they appear." */ |
|
|
|
|
66 |
/* ARGSUSED */ |
/* ARGSUSED */ |
67 |
DEFUN ("interactive", Finteractive, Sinteractive, 0, UNEVALLED, 0, |
DEFUN ("interactive", Finteractive, Sinteractive, 0, UNEVALLED, 0, |
68 |
0 /* See immediately above */) |
doc: /* Specify a way of parsing arguments for interactive use of a function. |
69 |
(args) |
For example, write |
70 |
|
(defun foo (arg) "Doc string" (interactive "p") ...use arg...) |
71 |
|
to make ARG be the prefix argument when `foo' is called as a command. |
72 |
|
The "call" to `interactive' is actually a declaration rather than a function; |
73 |
|
it tells `call-interactively' how to read arguments |
74 |
|
to pass to the function. |
75 |
|
When actually called, `interactive' just returns nil. |
76 |
|
|
77 |
|
The argument of `interactive' is usually a string containing a code letter |
78 |
|
followed by a prompt. (Some code letters do not use I/O to get |
79 |
|
the argument and do not need prompts.) To prompt for multiple arguments, |
80 |
|
give a code letter, its prompt, a newline, and another code letter, etc. |
81 |
|
Prompts are passed to format, and may use % escapes to print the |
82 |
|
arguments that have already been read. |
83 |
|
If the argument is not a string, it is evaluated to get a list of |
84 |
|
arguments to pass to the function. |
85 |
|
Just `(interactive)' means pass no args when calling interactively. |
86 |
|
|
87 |
|
Code letters available are: |
88 |
|
a -- Function name: symbol with a function definition. |
89 |
|
b -- Name of existing buffer. |
90 |
|
B -- Name of buffer, possibly nonexistent. |
91 |
|
c -- Character (no input method is used). |
92 |
|
C -- Command name: symbol with interactive function definition. |
93 |
|
d -- Value of point as number. Does not do I/O. |
94 |
|
D -- Directory name. |
95 |
|
e -- Parametrized event (i.e., one that's a list) that invoked this command. |
96 |
|
If used more than once, the Nth `e' returns the Nth parameterized event. |
97 |
|
This skips events that are integers or symbols. |
98 |
|
f -- Existing file name. |
99 |
|
F -- Possibly nonexistent file name. |
100 |
|
i -- Ignored, i.e. always nil. Does not do I/O. |
101 |
|
k -- Key sequence (downcase the last event if needed to get a definition). |
102 |
|
K -- Key sequence to be redefined (do not downcase the last event). |
103 |
|
m -- Value of mark as number. Does not do I/O. |
104 |
|
M -- Any string. Inherits the current input method. |
105 |
|
n -- Number read using minibuffer. |
106 |
|
N -- Raw prefix arg, or if none, do like code `n'. |
107 |
|
p -- Prefix arg converted to number. Does not do I/O. |
108 |
|
P -- Prefix arg in raw form. Does not do I/O. |
109 |
|
r -- Region: point and mark as 2 numeric args, smallest first. Does no I/O. |
110 |
|
s -- Any string. Does not inherit the current input method. |
111 |
|
S -- Any symbol. |
112 |
|
v -- Variable name: symbol that is user-variable-p. |
113 |
|
x -- Lisp expression read but not evaluated. |
114 |
|
X -- Lisp expression read and evaluated. |
115 |
|
z -- Coding system. |
116 |
|
Z -- Coding system, nil if no prefix arg. |
117 |
|
In addition, if the string begins with `*' |
118 |
|
then an error is signaled if the buffer is read-only. |
119 |
|
This happens before reading any arguments. |
120 |
|
If the string begins with `@', then Emacs searches the key sequence |
121 |
|
which invoked the command for its first mouse click (or any other |
122 |
|
event which specifies a window), and selects that window before |
123 |
|
reading any arguments. You may use both `@' and `*'; they are |
124 |
|
processed in the order that they appear. */) |
125 |
|
(args) |
126 |
Lisp_Object args; |
Lisp_Object args; |
127 |
{ |
{ |
128 |
return Qnil; |
return Qnil; |
173 |
|
|
174 |
|
|
175 |
DEFUN ("call-interactively", Fcall_interactively, Scall_interactively, 1, 3, 0, |
DEFUN ("call-interactively", Fcall_interactively, Scall_interactively, 1, 3, 0, |
176 |
"Call FUNCTION, reading args according to its interactive calling specs.\n\ |
doc: /* Call FUNCTION, reading args according to its interactive calling specs. |
177 |
Return the value FUNCTION returns.\n\ |
Return the value FUNCTION returns. |
178 |
The function contains a specification of how to do the argument reading.\n\ |
The function contains a specification of how to do the argument reading. |
179 |
In the case of user-defined functions, this is specified by placing a call\n\ |
In the case of user-defined functions, this is specified by placing a call |
180 |
to the function `interactive' at the top level of the function body.\n\ |
to the function `interactive' at the top level of the function body. |
181 |
See `interactive'.\n\ |
See `interactive'. |
182 |
\n\ |
|
183 |
Optional second arg RECORD-FLAG non-nil\n\ |
Optional second arg RECORD-FLAG non-nil |
184 |
means unconditionally put this command in the command-history.\n\ |
means unconditionally put this command in the command-history. |
185 |
Otherwise, this is done only if an arg is read using the minibuffer.\n\ |
Otherwise, this is done only if an arg is read using the minibuffer. |
186 |
Optional third arg KEYS, if given, specifies the sequence of events to\n\ |
Optional third arg KEYS, if given, specifies the sequence of events to |
187 |
supply if the command inquires which events were used to invoke it.") |
supply if the command inquires which events were used to invoke it. */) |
188 |
(function, record_flag, keys) |
(function, record_flag, keys) |
189 |
Lisp_Object function, record_flag, keys; |
Lisp_Object function, record_flag, keys; |
190 |
{ |
{ |
191 |
Lisp_Object *args, *visargs; |
Lisp_Object *args, *visargs; |
794 |
} |
} |
795 |
|
|
796 |
DEFUN ("prefix-numeric-value", Fprefix_numeric_value, Sprefix_numeric_value, |
DEFUN ("prefix-numeric-value", Fprefix_numeric_value, Sprefix_numeric_value, |
797 |
1, 1, 0, |
1, 1, 0, |
798 |
"Return numeric meaning of raw prefix argument RAW.\n\ |
doc: /* Return numeric meaning of raw prefix argument RAW. |
799 |
A raw prefix argument is what you get from `(interactive \"P\")'.\n\ |
A raw prefix argument is what you get from `(interactive "P")'. |
800 |
Its numeric meaning is what you would get from `(interactive \"p\")'.") |
Its numeric meaning is what you would get from `(interactive "p")'. */) |
801 |
(raw) |
(raw) |
802 |
Lisp_Object raw; |
Lisp_Object raw; |
803 |
{ |
{ |
804 |
Lisp_Object val; |
Lisp_Object val; |
861 |
|
|
862 |
|
|
863 |
DEFVAR_KBOARD ("prefix-arg", Vprefix_arg, |
DEFVAR_KBOARD ("prefix-arg", Vprefix_arg, |
864 |
"The value of the prefix argument for the next editing command.\n\ |
doc: /* The value of the prefix argument for the next editing command. |
865 |
It may be a number, or the symbol `-' for just a minus sign as arg,\n\ |
It may be a number, or the symbol `-' for just a minus sign as arg, |
866 |
or a list whose car is a number for just one or more C-u's\n\ |
or a list whose car is a number for just one or more C-u's |
867 |
or nil if no argument has been specified.\n\ |
or nil if no argument has been specified. |
868 |
\n\ |
|
869 |
You cannot examine this variable to find the argument for this command\n\ |
You cannot examine this variable to find the argument for this command |
870 |
since it has been set to nil by the time you can look.\n\ |
since it has been set to nil by the time you can look. |
871 |
Instead, you should use the variable `current-prefix-arg', although\n\ |
Instead, you should use the variable `current-prefix-arg', although |
872 |
normally commands can get this prefix argument with (interactive \"P\")."); |
normally commands can get this prefix argument with (interactive "P"). */); |
873 |
|
|
874 |
DEFVAR_KBOARD ("last-prefix-arg", Vlast_prefix_arg, |
DEFVAR_KBOARD ("last-prefix-arg", Vlast_prefix_arg, |
875 |
"The value of the prefix argument for the previous editing command.\n\ |
doc: /* The value of the prefix argument for the previous editing command. |
876 |
See `prefix-arg' for the meaning of the value."); |
See `prefix-arg' for the meaning of the value. */); |
877 |
|
|
878 |
DEFVAR_LISP ("current-prefix-arg", &Vcurrent_prefix_arg, |
DEFVAR_LISP ("current-prefix-arg", &Vcurrent_prefix_arg, |
879 |
"The value of the prefix argument for this editing command.\n\ |
doc: /* The value of the prefix argument for this editing command. |
880 |
It may be a number, or the symbol `-' for just a minus sign as arg,\n\ |
It may be a number, or the symbol `-' for just a minus sign as arg, |
881 |
or a list whose car is a number for just one or more C-u's\n\ |
or a list whose car is a number for just one or more C-u's |
882 |
or nil if no argument has been specified.\n\ |
or nil if no argument has been specified. |
883 |
This is what `(interactive \"P\")' returns."); |
This is what `(interactive \"P\")' returns. */); |
884 |
Vcurrent_prefix_arg = Qnil; |
Vcurrent_prefix_arg = Qnil; |
885 |
|
|
886 |
DEFVAR_LISP ("command-history", &Vcommand_history, |
DEFVAR_LISP ("command-history", &Vcommand_history, |
887 |
"List of recent commands that read arguments from terminal.\n\ |
doc: /* List of recent commands that read arguments from terminal. |
888 |
Each command is represented as a form to evaluate."); |
Each command is represented as a form to evaluate. */); |
889 |
Vcommand_history = Qnil; |
Vcommand_history = Qnil; |
890 |
|
|
891 |
DEFVAR_LISP ("command-debug-status", &Vcommand_debug_status, |
DEFVAR_LISP ("command-debug-status", &Vcommand_debug_status, |
892 |
"Debugging status of current interactive command.\n\ |
doc: /* Debugging status of current interactive command. |
893 |
Bound each time `call-interactively' is called;\n\ |
Bound each time `call-interactively' is called; |
894 |
may be set by the debugger as a reminder for itself."); |
may be set by the debugger as a reminder for itself. */); |
895 |
Vcommand_debug_status = Qnil; |
Vcommand_debug_status = Qnil; |
896 |
|
|
897 |
DEFVAR_LISP ("mark-even-if-inactive", &Vmark_even_if_inactive, |
DEFVAR_LISP ("mark-even-if-inactive", &Vmark_even_if_inactive, |
898 |
"*Non-nil means you can use the mark even when inactive.\n\ |
doc: /* *Non-nil means you can use the mark even when inactive. |
899 |
This option makes a difference in Transient Mark mode.\n\ |
This option makes a difference in Transient Mark mode. |
900 |
When the option is non-nil, deactivation of the mark\n\ |
When the option is non-nil, deactivation of the mark |
901 |
turns off region highlighting, but commands that use the mark\n\ |
turns off region highlighting, but commands that use the mark |
902 |
behave as if the mark were still active."); |
behave as if the mark were still active. */); |
903 |
Vmark_even_if_inactive = Qnil; |
Vmark_even_if_inactive = Qnil; |
904 |
|
|
905 |
DEFVAR_LISP ("mouse-leave-buffer-hook", &Vmouse_leave_buffer_hook, |
DEFVAR_LISP ("mouse-leave-buffer-hook", &Vmouse_leave_buffer_hook, |
906 |
"Hook to run when about to switch windows with a mouse command.\n\ |
doc: /* Hook to run when about to switch windows with a mouse command. |
907 |
Its purpose is to give temporary modes such as Isearch mode\n\ |
Its purpose is to give temporary modes such as Isearch mode |
908 |
a way to turn themselves off when a mouse command switches windows."); |
a way to turn themselves off when a mouse command switches windows. */); |
909 |
Vmouse_leave_buffer_hook = Qnil; |
Vmouse_leave_buffer_hook = Qnil; |
910 |
|
|
911 |
defsubr (&Sinteractive); |
defsubr (&Sinteractive); |