Mercurial > hg > xemacs-beta
comparison src/minibuf.c @ 16:0293115a14e9 r19-15b91
Import from CVS: tag r19-15b91
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:49:20 +0200 |
parents | 9ee227acff29 |
children | 859a2309aef8 |
comparison
equal
deleted
inserted
replaced
15:ad457d5f7d04 | 16:0293115a14e9 |
---|---|
378 | 378 |
379 if (STRINGP (eltstring)) | 379 if (STRINGP (eltstring)) |
380 { | 380 { |
381 Charcount eltlength = string_char_length (XSTRING (eltstring)); | 381 Charcount eltlength = string_char_length (XSTRING (eltstring)); |
382 if (slength <= eltlength | 382 if (slength <= eltlength |
383 && (0 > scmp (string_data (XSTRING (eltstring)), | 383 && (0 > scmp (XSTRING_DATA (eltstring), |
384 string_data (XSTRING (string)), | 384 XSTRING_DATA (string), |
385 slength))) | 385 slength))) |
386 { | 386 { |
387 { | 387 { |
388 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 388 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
389 int loser; | 389 int loser; |
406 } | 406 } |
407 else | 407 else |
408 { | 408 { |
409 Charcount compare = min (bestmatchsize, eltlength); | 409 Charcount compare = min (bestmatchsize, eltlength); |
410 Charcount matchsize = | 410 Charcount matchsize = |
411 scmp (string_data (XSTRING (bestmatch)), | 411 scmp (XSTRING_DATA (bestmatch), |
412 string_data (XSTRING (eltstring)), | 412 XSTRING_DATA (eltstring), |
413 compare); | 413 compare); |
414 if (matchsize < 0) | 414 if (matchsize < 0) |
415 matchsize = compare; | 415 matchsize = compare; |
416 if (completion_ignore_case) | 416 if (completion_ignore_case) |
417 { | 417 { |
429 prefer a match that does not change the case | 429 prefer a match that does not change the case |
430 of the input. */ | 430 of the input. */ |
431 ((matchsize == eltlength) | 431 ((matchsize == eltlength) |
432 == | 432 == |
433 (matchsize == blength) | 433 (matchsize == blength) |
434 && 0 > scmp_1 (string_data (XSTRING (eltstring)), | 434 && 0 > scmp_1 (XSTRING_DATA (eltstring), |
435 string_data (XSTRING (string)), | 435 XSTRING_DATA (string), |
436 slength, 0) | 436 slength, 0) |
437 && 0 <= scmp_1 (string_data (XSTRING (bestmatch)), | 437 && 0 <= scmp_1 (XSTRING_DATA (bestmatch), |
438 string_data (XSTRING (string)), | 438 XSTRING_DATA (string), |
439 slength, 0))) | 439 slength, 0))) |
440 { | 440 { |
441 bestmatch = eltstring; | 441 bestmatch = eltstring; |
442 blength = eltlength; | 442 blength = eltlength; |
443 } | 443 } |
460 | 460 |
461 /* Return t if the supplied string is an exact match (counting case); | 461 /* Return t if the supplied string is an exact match (counting case); |
462 it does not require any change to be made. */ | 462 it does not require any change to be made. */ |
463 if (matchcount == 1 | 463 if (matchcount == 1 |
464 && bestmatchsize == slength | 464 && bestmatchsize == slength |
465 && 0 > scmp_1 (string_data (XSTRING (bestmatch)), | 465 && 0 > scmp_1 (XSTRING_DATA (bestmatch), |
466 string_data (XSTRING (string)), | 466 XSTRING_DATA (string), |
467 bestmatchsize, 0)) | 467 bestmatchsize, 0)) |
468 return Qt; | 468 return Qt; |
469 | 469 |
470 /* Else extract the part in which all completions agree */ | 470 /* Else extract the part in which all completions agree */ |
471 return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize)); | 471 return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize)); |
574 /* Reject alternatives that start with space | 574 /* Reject alternatives that start with space |
575 unless the input starts with space. */ | 575 unless the input starts with space. */ |
576 && ((string_char_length (XSTRING (string)) > 0 && | 576 && ((string_char_length (XSTRING (string)) > 0 && |
577 string_char (XSTRING (string), 0) == ' ') | 577 string_char (XSTRING (string), 0) == ' ') |
578 || string_char (XSTRING (eltstring), 0) != ' ') | 578 || string_char (XSTRING (eltstring), 0) != ' ') |
579 && (0 > scmp (string_data (XSTRING (eltstring)), | 579 && (0 > scmp (XSTRING_DATA (eltstring), |
580 string_data (XSTRING (string)), | 580 XSTRING_DATA (string), |
581 slength))) | 581 slength))) |
582 { | 582 { |
583 /* Yes. Now check whether predicate likes it. */ | 583 /* Yes. Now check whether predicate likes it. */ |
584 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 584 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
585 int loser; | 585 int loser; |
614 "Return the display width of the minibuffer prompt.") | 614 "Return the display width of the minibuffer prompt.") |
615 () | 615 () |
616 { | 616 { |
617 return (make_int (minibuf_prompt_width)); | 617 return (make_int (minibuf_prompt_width)); |
618 } | 618 } |
619 #endif | 619 #endif /* 0 */ |
620 | 620 |
621 | 621 |
622 /************************************************************************/ | 622 /************************************************************************/ |
623 /* echo area */ | 623 /* echo area */ |
624 /************************************************************************/ | 624 /************************************************************************/ |
638 no_restore ? Qt : Qnil); | 638 no_restore ? Qt : Qnil); |
639 } | 639 } |
640 else | 640 else |
641 { | 641 { |
642 write_string_to_stdio_stream (stderr, 0, (CONST Bufbyte *) "\n", 0, 1, | 642 write_string_to_stdio_stream (stderr, 0, (CONST Bufbyte *) "\n", 0, 1, |
643 FORMAT_DISPLAY); | 643 FORMAT_TERMINAL); |
644 return Qnil; | 644 return Qnil; |
645 } | 645 } |
646 } | 646 } |
647 | 647 |
648 Lisp_Object | 648 Lisp_Object |
678 if (length == 0) | 678 if (length == 0) |
679 return; | 679 return; |
680 | 680 |
681 if (!NILP (Ffboundp (Qappend_message))) | 681 if (!NILP (Ffboundp (Qappend_message))) |
682 { | 682 { |
683 if (STRINGP (reloc) && offset == 0 && | 683 if (STRINGP (reloc) && offset == 0 && length == XSTRING_LENGTH (reloc)) |
684 length == string_length (XSTRING (reloc))) | |
685 obj = reloc; | 684 obj = reloc; |
686 else | 685 else |
687 { | 686 { |
688 if (STRINGP (reloc)) | 687 if (STRINGP (reloc)) |
689 nonreloc = string_data (XSTRING (reloc)); | 688 nonreloc = XSTRING_DATA (reloc); |
690 obj = make_string (nonreloc + offset, length); | 689 obj = make_string (nonreloc + offset, length); |
691 } | 690 } |
692 | 691 |
693 XSETFRAME (frame, f); | 692 XSETFRAME (frame, f); |
694 GCPRO1 (obj); | 693 GCPRO1 (obj); |
697 UNGCPRO; | 696 UNGCPRO; |
698 } | 697 } |
699 else | 698 else |
700 { | 699 { |
701 if (STRINGP (reloc)) | 700 if (STRINGP (reloc)) |
702 nonreloc = string_data (XSTRING (reloc)); | 701 nonreloc = XSTRING_DATA (reloc); |
703 write_string_to_stdio_stream (stderr, 0, nonreloc, offset, length, | 702 write_string_to_stdio_stream (stderr, 0, nonreloc, offset, length, |
704 FORMAT_DISPLAY); | 703 FORMAT_TERMINAL); |
705 } | 704 } |
706 } | 705 } |
707 | 706 |
708 void | 707 void |
709 echo_area_message (struct frame *f, CONST Bufbyte *nonreloc, | 708 echo_area_message (struct frame *f, CONST Bufbyte *nonreloc, |
718 echo_area_active (struct frame *f) | 717 echo_area_active (struct frame *f) |
719 { | 718 { |
720 /* By definition, the echo area is active if the echo-area buffer | 719 /* By definition, the echo area is active if the echo-area buffer |
721 is not empty. No need to call Lisp code. (Anyway, this function | 720 is not empty. No need to call Lisp code. (Anyway, this function |
722 is called from redisplay.) */ | 721 is called from redisplay.) */ |
723 return (BUF_BEGV (XBUFFER (Vecho_area_buffer)) != | 722 struct buffer *echo_buffer = XBUFFER (Vecho_area_buffer); |
724 BUF_ZV (XBUFFER (Vecho_area_buffer))); | 723 return (BUF_BEGV (echo_buffer) != BUF_ZV (echo_buffer)); |
725 } | 724 } |
726 | 725 |
727 Lisp_Object | 726 Lisp_Object |
728 echo_area_status (struct frame *f) | 727 echo_area_status (struct frame *f) |
729 { | 728 { |