comparison src/minibuf.c @ 94528:ea7a33f062ae

(Fread_from_minibuffer, Fread_string, Fread_command) (Fread_variable, Fread_buffer, Fcompleting_read): Document the DEFAULT argument as a list of default values in docstrings.
author Juri Linkov <juri@jurta.org>
date Fri, 02 May 2008 01:02:26 +0000
parents c1b4e330f616
children fa335e247f6b
comparison
equal deleted inserted replaced
94527:207661f84875 94528:ea7a33f062ae
972 (HISTVAR . HISTPOS). In that case, HISTVAR is the history list variable 972 (HISTVAR . HISTPOS). In that case, HISTVAR is the history list variable
973 to use, and HISTPOS is the initial position for use by the minibuffer 973 to use, and HISTPOS is the initial position for use by the minibuffer
974 history commands. For consistency, you should also specify that 974 history commands. For consistency, you should also specify that
975 element of the history as the value of INITIAL-CONTENTS. Positions 975 element of the history as the value of INITIAL-CONTENTS. Positions
976 are counted starting from 1 at the beginning of the list. 976 are counted starting from 1 at the beginning of the list.
977 Sixth arg DEFAULT-VALUE is the default value. If non-nil, it is available 977 Sixth arg DEFAULT-VALUE is the default value or the list of default values.
978 for history commands; but, unless READ is non-nil, `read-from-minibuffer' 978 If non-nil, it is available for history commands, and as the value
979 does NOT return DEFAULT-VALUE if the user enters empty input! It returns 979 (or the first element of the list of default values) to return
980 the empty string. 980 if the user enters the empty string. But, unless READ is non-nil,
981 `read-from-minibuffer' does NOT return DEFAULT-VALUE if the user enters
982 empty input! It returns the empty string.
981 Seventh arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits 983 Seventh arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits
982 the current input method and the setting of `enable-multibyte-characters'. 984 the current input method and the setting of `enable-multibyte-characters'.
983 If the variable `minibuffer-allow-text-properties' is non-nil, 985 If the variable `minibuffer-allow-text-properties' is non-nil,
984 then the string which is returned includes whatever text properties 986 then the string which is returned includes whatever text properties
985 were present in the minibuffer. Otherwise the value has no text properties. 987 were present in the minibuffer. Otherwise the value has no text properties.
1071 be nil in new code. It behaves as in `read-from-minibuffer'. See the 1073 be nil in new code. It behaves as in `read-from-minibuffer'. See the
1072 documentation string of that function for details. 1074 documentation string of that function for details.
1073 The third arg HISTORY, if non-nil, specifies a history list 1075 The third arg HISTORY, if non-nil, specifies a history list
1074 and optionally the initial position in the list. 1076 and optionally the initial position in the list.
1075 See `read-from-minibuffer' for details of HISTORY argument. 1077 See `read-from-minibuffer' for details of HISTORY argument.
1076 Fourth arg DEFAULT-VALUE is the default value. If non-nil, it is used 1078 Fourth arg DEFAULT-VALUE is the default value or the list of default values.
1077 for history commands, and as the value to return if the user enters 1079 If non-nil, it is used for history commands, and as the value (or the first
1078 the empty string. 1080 element of the list of default values) to return if the user enters the
1081 empty string.
1079 Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits 1082 Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits
1080 the current input method and the setting of `enable-multibyte-characters'. */) 1083 the current input method and the setting of `enable-multibyte-characters'. */)
1081 (prompt, initial_input, history, default_value, inherit_input_method) 1084 (prompt, initial_input, history, default_value, inherit_input_method)
1082 Lisp_Object prompt, initial_input, history, default_value; 1085 Lisp_Object prompt, initial_input, history, default_value;
1083 Lisp_Object inherit_input_method; 1086 Lisp_Object inherit_input_method;
1110 !NILP (inherit_input_method)); 1113 !NILP (inherit_input_method));
1111 } 1114 }
1112 1115
1113 DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0, 1116 DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0,
1114 doc: /* Read the name of a command and return as a symbol. 1117 doc: /* Read the name of a command and return as a symbol.
1115 Prompt with PROMPT. By default, return DEFAULT-VALUE. */) 1118 Prompt with PROMPT. By default, return DEFAULT-VALUE or its first element
1119 if it is a list. */)
1116 (prompt, default_value) 1120 (prompt, default_value)
1117 Lisp_Object prompt, default_value; 1121 Lisp_Object prompt, default_value;
1118 { 1122 {
1119 Lisp_Object name, default_string; 1123 Lisp_Object name, default_string;
1120 1124
1144 } 1148 }
1145 #endif /* NOTDEF */ 1149 #endif /* NOTDEF */
1146 1150
1147 DEFUN ("read-variable", Fread_variable, Sread_variable, 1, 2, 0, 1151 DEFUN ("read-variable", Fread_variable, Sread_variable, 1, 2, 0,
1148 doc: /* Read the name of a user variable and return it as a symbol. 1152 doc: /* Read the name of a user variable and return it as a symbol.
1149 Prompt with PROMPT. By default, return DEFAULT-VALUE. 1153 Prompt with PROMPT. By default, return DEFAULT-VALUE or its first element
1154 if it is a list.
1150 A user variable is one for which `user-variable-p' returns non-nil. */) 1155 A user variable is one for which `user-variable-p' returns non-nil. */)
1151 (prompt, default_value) 1156 (prompt, default_value)
1152 Lisp_Object prompt, default_value; 1157 Lisp_Object prompt, default_value;
1153 { 1158 {
1154 Lisp_Object name, default_string; 1159 Lisp_Object name, default_string;
1170 1175
1171 DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1, 3, 0, 1176 DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1, 3, 0,
1172 doc: /* Read the name of a buffer and return as a string. 1177 doc: /* Read the name of a buffer and return as a string.
1173 Prompt with PROMPT. 1178 Prompt with PROMPT.
1174 Optional second arg DEF is value to return if user enters an empty line. 1179 Optional second arg DEF is value to return if user enters an empty line.
1180 If DEF is a list of default values, return its first element.
1175 If optional third arg REQUIRE-MATCH is non-nil, 1181 If optional third arg REQUIRE-MATCH is non-nil,
1176 only existing buffer names are allowed. 1182 only existing buffer names are allowed.
1177 The argument PROMPT should be a string ending with a colon and a space. */) 1183 The argument PROMPT should be a string ending with a colon and a space. */)
1178 (prompt, def, require_match) 1184 (prompt, def, require_match)
1179 Lisp_Object prompt, def, require_match; 1185 Lisp_Object prompt, def, require_match;
1721 - `confirm-only' means that the user can exit with any input, but she will 1727 - `confirm-only' means that the user can exit with any input, but she will
1722 need to confirm her choice if the input is not an element of COLLECTION. 1728 need to confirm her choice if the input is not an element of COLLECTION.
1723 - anything else behaves like t except that typing RET does not exit if it 1729 - anything else behaves like t except that typing RET does not exit if it
1724 does non-null completion. 1730 does non-null completion.
1725 1731
1726 If the input is null, `completing-read' returns DEF, or an empty string 1732 If the input is null, `completing-read' returns DEF, or the first element
1727 if DEF is nil, regardless of the value of REQUIRE-MATCH. 1733 of the list of default values, or an empty string if DEF is nil,
1734 regardless of the value of REQUIRE-MATCH.
1728 1735
1729 If INITIAL-INPUT is non-nil, insert it in the minibuffer initially, 1736 If INITIAL-INPUT is non-nil, insert it in the minibuffer initially,
1730 with point positioned at the end. 1737 with point positioned at the end.
1731 If it is (STRING . POSITION), the initial input is STRING, but point 1738 If it is (STRING . POSITION), the initial input is STRING, but point
1732 is placed at _zero-indexed_ position POSITION in STRING. (*Note* 1739 is placed at _zero-indexed_ position POSITION in STRING. (*Note*
1746 INITIAL-INPUT. (This is the only case in which you should use 1753 INITIAL-INPUT. (This is the only case in which you should use
1747 INITIAL-INPUT instead of DEF.) Positions are counted starting from 1754 INITIAL-INPUT instead of DEF.) Positions are counted starting from
1748 1 at the beginning of the list. The variable `history-length' 1755 1 at the beginning of the list. The variable `history-length'
1749 controls the maximum length of a history list. 1756 controls the maximum length of a history list.
1750 1757
1751 DEF, if non-nil, is the default value. 1758 DEF, if non-nil, is the default value or the list of default values.
1752 1759
1753 If INHERIT-INPUT-METHOD is non-nil, the minibuffer inherits 1760 If INHERIT-INPUT-METHOD is non-nil, the minibuffer inherits
1754 the current input method and the setting of `enable-multibyte-characters'. 1761 the current input method and the setting of `enable-multibyte-characters'.
1755 1762
1756 Completion ignores case if the ambient value of 1763 Completion ignores case if the ambient value of