comparison src/minibuf.c @ 22034:430908755560

(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.
author Richard M. Stallman <rms@gnu.org>
date Tue, 12 May 1998 02:48:51 +0000
parents 547e4c0a42c0
children bc29c7cef66a
comparison
equal deleted inserted replaced
22033:aa1d105f0d67 22034:430908755560
389 389
390 /* If appropriate, copy enable-multibyte-characters into the minibuffer. */ 390 /* If appropriate, copy enable-multibyte-characters into the minibuffer. */
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). */
397 if (!NILP (Vminibuffer_setup_hook) && !EQ (Vminibuffer_setup_hook, Qunbound) 401 if (!NILP (Vminibuffer_setup_hook) && !EQ (Vminibuffer_setup_hook, Qunbound)
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,
405 show the user we have exited by putting it in column 0. */ 408 show the user we have exited by putting it in column 0. */
406 if ((FRAME_CURSOR_Y (selected_frame) 409 if ((FRAME_CURSOR_Y (selected_frame)
413 } 416 }
414 417
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
424 last_minibuf_string = val; 424 last_minibuf_string = val;
425 425
1394 tem = oblookup (Vminibuffer_completion_table, 1394 tem = oblookup (Vminibuffer_completion_table,
1395 XSTRING (txt)->data, 1395 XSTRING (txt)->data,
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;
1404 } 1416 }
1405 else 1417 else
1492 register Lisp_Object key; 1504 register Lisp_Object key;
1493 Lisp_Object list; 1505 Lisp_Object 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;
1503 elt = Fcar (tail); 1512 elt = Fcar (tail);
1504 if (!CONSP (elt)) continue; 1513 if (!CONSP (elt)) continue;
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;
1515 } 1525 }
1516 1526
1900 Fset_text_properties (startpos, endpos, 1910 Fset_text_properties (startpos, endpos,
1901 Qnil, Vstandard_output); 1911 Qnil, Vstandard_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
1909 string = elt; 1919 string = elt;
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. */
1916 if (CONSP (elt)) 1929 if (CONSP (elt))
1917 Fprinc (Fcar (Fcdr (elt)), Qnil); 1930 Fprinc (Fcar (Fcdr (elt)), Qnil);