aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog11
-rw-r--r--src/minibuf.c20
2 files changed, 24 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 3df88c6f332..1ed1d3a5d38 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
12007-10-22 Juri Linkov <juri@jurta.org>
2
3 * minibuf.c: Allow minibuffer default to be a list of default values.
4 With empty input use the first element of this list as returned default.
5 (string_to_object):
6 (read_minibuf_noninteractive): If defalt is cons, set val to its car.
7 (read_minibuf): If defalt is cons, set histstring to its car.
8 (Fread_string): If default_value is cons, set val to its car.
9 (Fread_buffer): If def is cons, use its car.
10 (Fcompleting_read): If defalt is cons, set val to its car.
11
12007-10-21 Michael Albinus <michael.albinus@gmx.de> 122007-10-21 Michael Albinus <michael.albinus@gmx.de>
2 13
3 * fileio.c (Fcopy_file): Call file name handler with preserve_uid_gid. 14 * fileio.c (Fcopy_file): Call file name handler with preserve_uid_gid.
diff --git a/src/minibuf.c b/src/minibuf.c
index d3c9eb505b6..377968fab4f 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -257,9 +257,13 @@ string_to_object (val, defalt)
257 257
258 GCPRO2 (val, defalt); 258 GCPRO2 (val, defalt);
259 259
260 if (STRINGP (val) && SCHARS (val) == 0 260 if (STRINGP (val) && SCHARS (val) == 0)
261 && STRINGP (defalt)) 261 {
262 val = defalt; 262 if (STRINGP (defalt))
263 val = defalt;
264 else if (CONSP (defalt) && STRINGP (XCAR (defalt)))
265 val = XCAR (defalt);
266 }
263 267
264 expr_and_pos = Fread_from_string (val, Qnil, Qnil); 268 expr_and_pos = Fread_from_string (val, Qnil, Qnil);
265 pos = XINT (Fcdr (expr_and_pos)); 269 pos = XINT (Fcdr (expr_and_pos));
@@ -337,7 +341,7 @@ read_minibuf_noninteractive (map, initial, prompt, backup_n, expflag,
337 341
338 /* If Lisp form desired instead of string, parse it. */ 342 /* If Lisp form desired instead of string, parse it. */
339 if (expflag) 343 if (expflag)
340 val = string_to_object (val, defalt); 344 val = string_to_object (val, CONSP (defalt) ? XCAR (defalt) : defalt);
341 345
342 return val; 346 return val;
343} 347}
@@ -785,6 +789,8 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
785 histstring = val; 789 histstring = val;
786 else if (STRINGP (defalt)) 790 else if (STRINGP (defalt))
787 histstring = defalt; 791 histstring = defalt;
792 else if (CONSP (defalt) && STRINGP (XCAR (defalt)))
793 histstring = XCAR (defalt);
788 else 794 else
789 histstring = Qnil; 795 histstring = Qnil;
790 796
@@ -1102,7 +1108,7 @@ Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits
1102 Qnil, history, default_value, 1108 Qnil, history, default_value,
1103 inherit_input_method); 1109 inherit_input_method);
1104 if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (default_value)) 1110 if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (default_value))
1105 val = default_value; 1111 val = CONSP (default_value) ? XCAR (default_value) : default_value;
1106 return val; 1112 return val;
1107} 1113}
1108 1114
@@ -1225,7 +1231,7 @@ The argument PROMPT should be a string ending with a colon and a space. */)
1225 1231
1226 args[0] = build_string ("%s (default %s): "); 1232 args[0] = build_string ("%s (default %s): ");
1227 args[1] = prompt; 1233 args[1] = prompt;
1228 args[2] = def; 1234 args[2] = CONSP (def) ? XCAR (def) : def;
1229 prompt = Fformat (3, args); 1235 prompt = Fformat (3, args);
1230 } 1236 }
1231 1237
@@ -1835,7 +1841,7 @@ Completion ignores case if the ambient value of
1835 !NILP (inherit_input_method)); 1841 !NILP (inherit_input_method));
1836 1842
1837 if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (def)) 1843 if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (def))
1838 val = def; 1844 val = CONSP (def) ? XCAR (def) : def;
1839 1845
1840 RETURN_UNGCPRO (unbind_to (count, val)); 1846 RETURN_UNGCPRO (unbind_to (count, val));
1841} 1847}