diff options
| author | Richard M. Stallman | 1998-05-12 02:48:51 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-05-12 02:48:51 +0000 |
| commit | 9404446f1e0dca7c10c0f5f2fb45d7f7a94e9bbe (patch) | |
| tree | da2f5e12fed626a151e59456242731022503fed4 /src | |
| parent | 168b2d0d5adf93df7cf07b06844671289e200d0c (diff) | |
| download | emacs-9404446f1e0dca7c10c0f5f2fb45d7f7a94e9bbe.tar.gz emacs-9404446f1e0dca7c10c0f5f2fb45d7f7a94e9bbe.zip | |
(assoc_for_completion): Use Fcompare_strings.
(test_completion): In obarray, try both unibyte and multibyte strings.
(read_minibuf): Convert unibyte prompt to multi if minibuffer is multi.
(Fdisplay_completion_list): Convert unibyte to strings to multibyte
to conform to the buffer.
Diffstat (limited to 'src')
| -rw-r--r-- | src/minibuf.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index f41e03072fe..2e89c610564 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -391,6 +391,10 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 391 | if (inherit_input_method) | 391 | if (inherit_input_method) |
| 392 | current_buffer->enable_multibyte_characters = enable_multibyte; | 392 | current_buffer->enable_multibyte_characters = enable_multibyte; |
| 393 | 393 | ||
| 394 | if (!NILP (current_buffer->enable_multibyte_characters) | ||
| 395 | && ! STRING_MULTIBYTE (minibuf_prompt)) | ||
| 396 | minibuf_prompt = Fstring_make_multibyte (minibuf_prompt); | ||
| 397 | |||
| 394 | /* Run our hook, but not if it is empty. | 398 | /* Run our hook, but not if it is empty. |
| 395 | (run-hooks would do nothing if it is empty, | 399 | (run-hooks would do nothing if it is empty, |
| 396 | but it's important to save time here in the usual case). */ | 400 | but it's important to save time here in the usual case). */ |
| @@ -398,7 +402,6 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 398 | && !NILP (Vrun_hooks)) | 402 | && !NILP (Vrun_hooks)) |
| 399 | call1 (Vrun_hooks, Qminibuffer_setup_hook); | 403 | call1 (Vrun_hooks, Qminibuffer_setup_hook); |
| 400 | 404 | ||
| 401 | /* ??? MCC did redraw_screen here if switching screens. */ | ||
| 402 | recursive_edit_1 (); | 405 | recursive_edit_1 (); |
| 403 | 406 | ||
| 404 | /* If cursor is on the minibuffer line, | 407 | /* If cursor is on the minibuffer line, |
| @@ -415,9 +418,6 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 415 | /* Make minibuffer contents into a string. */ | 418 | /* Make minibuffer contents into a string. */ |
| 416 | Fset_buffer (minibuffer); | 419 | Fset_buffer (minibuffer); |
| 417 | val = make_buffer_string (1, Z, allow_props); | 420 | val = make_buffer_string (1, Z, allow_props); |
| 418 | #if 0 /* make_buffer_string should handle the gap. */ | ||
| 419 | bcopy (GAP_END_ADDR, XSTRING (val)->data + GPT - BEG, Z - GPT); | ||
| 420 | #endif | ||
| 421 | 421 | ||
| 422 | /* VAL is the string of minibuffer text. */ | 422 | /* VAL is the string of minibuffer text. */ |
| 423 | 423 | ||
| @@ -1396,8 +1396,20 @@ test_completion (txt) | |||
| 1396 | XSTRING (txt)->size, | 1396 | XSTRING (txt)->size, |
| 1397 | STRING_BYTES (XSTRING (txt))); | 1397 | STRING_BYTES (XSTRING (txt))); |
| 1398 | if (!SYMBOLP (tem)) | 1398 | if (!SYMBOLP (tem)) |
| 1399 | return Qnil; | 1399 | { |
| 1400 | else if (!NILP (Vminibuffer_completion_predicate)) | 1400 | if (STRING_MULTIBYTE (txt)) |
| 1401 | txt = Fstring_make_unibyte (txt); | ||
| 1402 | else | ||
| 1403 | txt = Fstring_make_multibyte (txt); | ||
| 1404 | |||
| 1405 | tem = oblookup (Vminibuffer_completion_table, | ||
| 1406 | XSTRING (txt)->data, | ||
| 1407 | XSTRING (txt)->size, | ||
| 1408 | STRING_BYTES (XSTRING (txt))); | ||
| 1409 | if (!SYMBOLP (tem)) | ||
| 1410 | return Qnil; | ||
| 1411 | } | ||
| 1412 | if (!NILP (Vminibuffer_completion_predicate)) | ||
| 1401 | return call1 (Vminibuffer_completion_predicate, tem); | 1413 | return call1 (Vminibuffer_completion_predicate, tem); |
| 1402 | else | 1414 | else |
| 1403 | return Qt; | 1415 | return Qt; |
| @@ -1494,9 +1506,6 @@ assoc_for_completion (key, list) | |||
| 1494 | { | 1506 | { |
| 1495 | register Lisp_Object tail; | 1507 | register Lisp_Object tail; |
| 1496 | 1508 | ||
| 1497 | if (completion_ignore_case) | ||
| 1498 | key = Fupcase (key); | ||
| 1499 | |||
| 1500 | for (tail = list; !NILP (tail); tail = Fcdr (tail)) | 1509 | for (tail = list; !NILP (tail); tail = Fcdr (tail)) |
| 1501 | { | 1510 | { |
| 1502 | register Lisp_Object elt, tem, thiscar; | 1511 | register Lisp_Object elt, tem, thiscar; |
| @@ -1505,10 +1514,11 @@ assoc_for_completion (key, list) | |||
| 1505 | thiscar = Fcar (elt); | 1514 | thiscar = Fcar (elt); |
| 1506 | if (!STRINGP (thiscar)) | 1515 | if (!STRINGP (thiscar)) |
| 1507 | continue; | 1516 | continue; |
| 1508 | if (completion_ignore_case) | 1517 | tem = Fcompare_strings (thiscar, make_number (0), Qnil, |
| 1509 | thiscar = Fupcase (thiscar); | 1518 | key, make_number (0), Qnil, |
| 1510 | tem = Fequal (thiscar, key); | 1519 | completion_ignore_case ? Qt : Qnil); |
| 1511 | if (!NILP (tem)) return elt; | 1520 | if (EQ (tem, Qt)) |
| 1521 | return elt; | ||
| 1512 | QUIT; | 1522 | QUIT; |
| 1513 | } | 1523 | } |
| 1514 | return Qnil; | 1524 | return Qnil; |
| @@ -1902,7 +1912,7 @@ It can find the completion buffer in `standard-output'.") | |||
| 1902 | } | 1912 | } |
| 1903 | 1913 | ||
| 1904 | /* Output this element. | 1914 | /* Output this element. |
| 1905 | If necessary, convert it to unibyte first. */ | 1915 | If necessary, convert it to unibyte or to multibyte first. */ |
| 1906 | if (CONSP (elt)) | 1916 | if (CONSP (elt)) |
| 1907 | string = Fcar (elt); | 1917 | string = Fcar (elt); |
| 1908 | else | 1918 | else |
| @@ -1910,6 +1920,9 @@ It can find the completion buffer in `standard-output'.") | |||
| 1910 | if (NILP (current_buffer->enable_multibyte_characters) | 1920 | if (NILP (current_buffer->enable_multibyte_characters) |
| 1911 | && STRING_MULTIBYTE (string)) | 1921 | && STRING_MULTIBYTE (string)) |
| 1912 | string = Fstring_make_unibyte (string); | 1922 | string = Fstring_make_unibyte (string); |
| 1923 | else if (!NILP (current_buffer->enable_multibyte_characters) | ||
| 1924 | && !STRING_MULTIBYTE (string)) | ||
| 1925 | string = Fstring_make_multibyte (string); | ||
| 1913 | Fprinc (string, Qnil); | 1926 | Fprinc (string, Qnil); |
| 1914 | 1927 | ||
| 1915 | /* Output the annotation for this element. */ | 1928 | /* Output the annotation for this element. */ |