diff options
| author | Richard M. Stallman | 1998-02-08 21:04:19 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-02-08 21:04:19 +0000 |
| commit | b9a865859a3d592db221e4692925a969c1b91add (patch) | |
| tree | 720a47866605e83a027e66a568e943ae6fd4086f /src | |
| parent | 026f59ce86ab15a2fc5c0a33f8ff77d4a34594d1 (diff) | |
| download | emacs-b9a865859a3d592db221e4692925a969c1b91add.tar.gz emacs-b9a865859a3d592db221e4692925a969c1b91add.zip | |
(read_minibuf): If input is empty, return empty string.
(Fread_string): Return DEFAULT_VALUE here, if input is empty.
(Fcompleting_read): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/minibuf.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index f4e8fc6f886..5e9bfe13b0b 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -421,9 +421,6 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 421 | 421 | ||
| 422 | /* VAL is the string of minibuffer text. */ | 422 | /* VAL is the string of minibuffer text. */ |
| 423 | 423 | ||
| 424 | if (STRINGP (val) && XSTRING (val)->size == 0 && ! NILP (defalt)) | ||
| 425 | val = defalt; | ||
| 426 | |||
| 427 | last_minibuf_string = val; | 424 | last_minibuf_string = val; |
| 428 | 425 | ||
| 429 | /* Add the value to the appropriate history list unless it is empty. */ | 426 | /* Add the value to the appropriate history list unless it is empty. */ |
| @@ -629,9 +626,9 @@ Fifth arg HIST, if non-nil, specifies a history list\n\ | |||
| 629 | and HISTPOS is the initial position (the position in the list\n\ | 626 | and HISTPOS is the initial position (the position in the list\n\ |
| 630 | which INITIAL-CONTENTS corresponds to).\n\ | 627 | which INITIAL-CONTENTS corresponds to).\n\ |
| 631 | Positions are counted starting from 1 at the beginning of the list.\n\ | 628 | Positions are counted starting from 1 at the beginning of the list.\n\ |
| 632 | Sixth arg DEFAULT-VALUE is the default value. If non-nil, it is used\n\ | 629 | Sixth arg DEFAULT-VALUE is the default value. If non-nil, it is available\n\ |
| 633 | for history commands, and as the value to return if the user enters\n\ | 630 | for history commands; but `read-from-minibuffer' does NOT return DEFAULT-VALUE\n\ |
| 634 | the empty string.\n\ | 631 | if the user enters empty input! It returns the empty string.\n\ |
| 635 | Seventh arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits\n\ | 632 | Seventh arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits\n\ |
| 636 | the current input method and the setting of enable-multibyte-characters.\n\ | 633 | the current input method and the setting of enable-multibyte-characters.\n\ |
| 637 | If the variable `minibuffer-allow-text-properties' is non-nil,\n\ | 634 | If the variable `minibuffer-allow-text-properties' is non-nil,\n\ |
| @@ -745,9 +742,13 @@ Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits\n\ | |||
| 745 | Lisp_Object prompt, initial_input, history, default_value; | 742 | Lisp_Object prompt, initial_input, history, default_value; |
| 746 | Lisp_Object inherit_input_method; | 743 | Lisp_Object inherit_input_method; |
| 747 | { | 744 | { |
| 748 | return Fread_from_minibuffer (prompt, initial_input, Qnil, | 745 | Lisp_Object val; |
| 749 | Qnil, history, default_value, | 746 | val = Fread_from_minibuffer (prompt, initial_input, Qnil, |
| 750 | inherit_input_method); | 747 | Qnil, history, default_value, |
| 748 | inherit_input_method); | ||
| 749 | if (STRINGP (val) && XSTRING (val)->size == 0 && ! NILP (default_value)) | ||
| 750 | val = default_value; | ||
| 751 | return val; | ||
| 751 | } | 752 | } |
| 752 | 753 | ||
| 753 | DEFUN ("read-no-blanks-input", Fread_no_blanks_input, Sread_no_blanks_input, 1, 3, 0, | 754 | DEFUN ("read-no-blanks-input", Fread_no_blanks_input, Sread_no_blanks_input, 1, 3, 0, |
| @@ -1325,6 +1326,10 @@ DEFUN ("completing-read", Fcompleting_read, Scompleting_read, 2, 8, 0, | |||
| 1325 | init, prompt, make_number (pos), 0, | 1326 | init, prompt, make_number (pos), 0, |
| 1326 | histvar, histpos, def, 0, | 1327 | histvar, histpos, def, 0, |
| 1327 | !NILP (inherit_input_method)); | 1328 | !NILP (inherit_input_method)); |
| 1329 | |||
| 1330 | if (STRINGP (val) && XSTRING (val)->size == 0 && ! NILP (def)) | ||
| 1331 | val = def; | ||
| 1332 | |||
| 1328 | RETURN_UNGCPRO (unbind_to (count, val)); | 1333 | RETURN_UNGCPRO (unbind_to (count, val)); |
| 1329 | } | 1334 | } |
| 1330 | 1335 | ||