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