comparison src/minibuf.c @ 173:8eaf7971accc r20-3b13

Import from CVS: tag r20-3b13
author cvs
date Mon, 13 Aug 2007 09:49:09 +0200
parents 538048ae2ab8
children 262b8bb4a523
comparison
equal deleted inserted replaced
172:a38aed19690b 173:8eaf7971accc
125 Vminibuf_preprompt = Qnil; 125 Vminibuf_preprompt = Qnil;
126 } 126 }
127 else 127 else
128 { 128 {
129 CHECK_STRING (preprompt); 129 CHECK_STRING (preprompt);
130 130
131 Vminibuf_preprompt = LISP_GETTEXT (preprompt); 131 Vminibuf_preprompt = LISP_GETTEXT (preprompt);
132 } 132 }
133 return Qnil; 133 return Qnil;
134 } 134 }
135 135
150 noseeum_cons 150 noseeum_cons
151 (Vminibuf_prompt, 151 (Vminibuf_prompt,
152 noseeum_cons (make_int (minibuf_level), Qnil))); 152 noseeum_cons (make_int (minibuf_level), Qnil)));
153 Vminibuf_prompt = LISP_GETTEXT (prompt); 153 Vminibuf_prompt = LISP_GETTEXT (prompt);
154 154
155 /* NOTE: Here (or somewhere around here), in FSFmacs 19.30, 155 /* NOTE: Here (or somewhere around here), in FSFmacs 19.30,
156 choose_minibuf_frame() is called. This is the only 156 choose_minibuf_frame() is called. This is the only
157 place in FSFmacs that it's called any more -- there's 157 place in FSFmacs that it's called any more -- there's
158 also a call in xterm.c, but commented out, and 19.28 158 also a call in xterm.c, but commented out, and 19.28
159 had the calls in different places. 159 had the calls in different places.
160 160
171 similar, but not identical, to a set-window-buffer call made 171 similar, but not identical, to a set-window-buffer call made
172 in `read-from-minibuffer' in minibuf.el. I hope it's close 172 in `read-from-minibuffer' in minibuf.el. I hope it's close
173 enough, because minibuf_window isn't really exported to Lisp. 173 enough, because minibuf_window isn't really exported to Lisp.
174 174
175 The comment above choose_minibuf_frame() reads: 175 The comment above choose_minibuf_frame() reads:
176 176
177 Put minibuf on currently selected frame's minibuffer. 177 Put minibuf on currently selected frame's minibuffer.
178 We do this whenever the user starts a new minibuffer 178 We do this whenever the user starts a new minibuffer
179 or when a minibuffer exits. */ 179 or when a minibuffer exits. */
180 180
181 minibuf_window = FRAME_MINIBUF_WINDOW (selected_frame ()); 181 minibuf_window = FRAME_MINIBUF_WINDOW (selected_frame ());
182 182
183 run_hook (Qminibuffer_setup_hook); 183 run_hook (Qminibuffer_setup_hook);
184 184
185 minibuf_level++; 185 minibuf_level++;
186 clear_echo_area (selected_frame (), Qnil, 0); 186 clear_echo_area (selected_frame (), Qnil, 0);
187 187
188 val = call_command_loop (Qt); 188 val = call_command_loop (Qt);
189 189
190 return (unbind_to (speccount, val)); 190 return unbind_to (speccount, val);
191 } 191 }
192 192
193 193
194 194
195 /* Completion hair */ 195 /* Completion hair */
258 { 258 {
259 Lisp_Object re = XCAR (regexps); 259 Lisp_Object re = XCAR (regexps);
260 if (STRINGP (re) 260 if (STRINGP (re)
261 && (fast_string_match (re, nonreloc, reloc, offset, 261 && (fast_string_match (re, nonreloc, reloc, offset,
262 length, 0, ERROR_ME, 0) < 0)) 262 length, 0, ERROR_ME, 0) < 0))
263 return (1); 263 return 1;
264 } 264 }
265 } 265 }
266 return (0); 266 return 0;
267 } 267 }
268 268
269 269
270 /* Callers should GCPRO, since this may call eval */ 270 /* Callers should GCPRO, since this may call eval */
271 static int 271 static int
272 ignore_completion_p (Lisp_Object completion_string, 272 ignore_completion_p (Lisp_Object completion_string,
273 Lisp_Object pred, Lisp_Object completion) 273 Lisp_Object pred, Lisp_Object completion)
274 { 274 {
275 if (regexp_ignore_completion_p (0, completion_string, 0, -1)) 275 if (regexp_ignore_completion_p (0, completion_string, 0, -1))
276 return (1); 276 return 1;
277 277
278 /* Ignore this element if there is a predicate 278 /* Ignore this element if there is a predicate
279 and the predicate doesn't like it. */ 279 and the predicate doesn't like it. */
280 if (!NILP (pred)) 280 if (!NILP (pred))
281 { 281 {
282 Lisp_Object tem; 282 Lisp_Object tem;
283 if (EQ (pred, Qcommandp)) 283 if (EQ (pred, Qcommandp))
284 tem = Fcommandp (completion); 284 tem = Fcommandp (completion);
285 else 285 else
286 tem = call1 (pred, completion); 286 tem = call1 (pred, completion);
287 if (NILP (tem)) 287 if (NILP (tem))
288 return (1); 288 return 1;
289 } 289 }
290 return (0); 290 return 0;
291 } 291 }
292 292
293 293
294 294
295 295
318 /* This function can GC */ 318 /* This function can GC */
319 Lisp_Object bestmatch, tail; 319 Lisp_Object bestmatch, tail;
320 Charcount bestmatchsize = 0; 320 Charcount bestmatchsize = 0;
321 int list; 321 int list;
322 int indice = 0; 322 int indice = 0;
323 int obsize = 0;
324 int matchcount = 0; 323 int matchcount = 0;
324 int obsize;
325 Lisp_Object bucket; 325 Lisp_Object bucket;
326 Charcount slength, blength; 326 Charcount slength, blength;
327 327
328 CHECK_STRING (string); 328 CHECK_STRING (string);
329 329
348 348
349 /* If ALIST is not a list, set TAIL just for gc pro. */ 349 /* If ALIST is not a list, set TAIL just for gc pro. */
350 tail = alist; 350 tail = alist;
351 if (!list) 351 if (!list)
352 { 352 {
353 obsize = vector_length (XVECTOR (alist)); 353 obsize = XVECTOR_LENGTH (alist);
354 bucket = vector_data (XVECTOR (alist))[indice]; 354 bucket = XVECTOR_DATA (alist)[indice];
355 }
356 else /* warning suppression */
357 {
358 obsize = 0;
359 bucket = Qnil;
355 } 360 }
356 361
357 while (1) 362 while (1)
358 { 363 {
359 /* Get the next element of the alist or obarray. */ 364 /* Get the next element of the alist or obarray. */
390 } 395 }
391 else if (++indice >= obsize) 396 else if (++indice >= obsize)
392 break; 397 break;
393 else 398 else
394 { 399 {
395 bucket = vector_data (XVECTOR (alist))[indice]; 400 bucket = XVECTOR_DATA (alist)[indice];
396 continue; 401 continue;
397 } 402 }
398 } 403 }
399 404
400 /* Is this element a possible completion? */ 405 /* Is this element a possible completion? */
456 (matchsize == blength) 461 (matchsize == blength)
457 && 0 > scmp_1 (XSTRING_DATA (eltstring), 462 && 0 > scmp_1 (XSTRING_DATA (eltstring),
458 XSTRING_DATA (string), 463 XSTRING_DATA (string),
459 slength, 0) 464 slength, 0)
460 && 0 <= scmp_1 (XSTRING_DATA (bestmatch), 465 && 0 <= scmp_1 (XSTRING_DATA (bestmatch),
461 XSTRING_DATA (string), 466 XSTRING_DATA (string),
462 slength, 0))) 467 slength, 0)))
463 { 468 {
464 bestmatch = eltstring; 469 bestmatch = eltstring;
465 blength = eltlength; 470 blength = eltlength;
466 } 471 }
517 /* This function can GC */ 522 /* This function can GC */
518 Lisp_Object tail; 523 Lisp_Object tail;
519 Lisp_Object allmatches; 524 Lisp_Object allmatches;
520 int list; 525 int list;
521 int indice = 0; 526 int indice = 0;
522 int obsize = 0; 527 int obsize;
523 Lisp_Object bucket; 528 Lisp_Object bucket;
524 Charcount slength; 529 Charcount slength;
525 530
526 CHECK_STRING (string); 531 CHECK_STRING (string);
527 532
545 550
546 /* If ALIST is not a list, set TAIL just for gc pro. */ 551 /* If ALIST is not a list, set TAIL just for gc pro. */
547 tail = alist; 552 tail = alist;
548 if (!list) 553 if (!list)
549 { 554 {
550 obsize = vector_length (XVECTOR (alist)); 555 obsize = XVECTOR_LENGTH (alist);
551 bucket = vector_data (XVECTOR (alist))[indice]; 556 bucket = XVECTOR_DATA (alist)[indice];
557 }
558 else /* warning suppression */
559 {
560 obsize = 0;
561 bucket = Qnil;
552 } 562 }
553 563
554 while (1) 564 while (1)
555 { 565 {
556 /* Get the next element of the alist or obarray. */ 566 /* Get the next element of the alist or obarray. */
582 } 592 }
583 else if (++indice >= obsize) 593 else if (++indice >= obsize)
584 break; 594 break;
585 else 595 else
586 { 596 {
587 bucket = vector_data (XVECTOR (alist))[indice]; 597 bucket = XVECTOR_DATA (alist)[indice];
588 continue; 598 continue;
589 } 599 }
590 } 600 }
591 601
592 /* Is this element a possible completion? */ 602 /* Is this element a possible completion? */
593 603
594 if (STRINGP (eltstring) 604 if (STRINGP (eltstring)
595 && (slength <= string_char_length (XSTRING (eltstring))) 605 && (slength <= string_char_length (XSTRING (eltstring)))
596 /* Reject alternatives that start with space 606 /* Reject alternatives that start with space
597 unless the input starts with space. */ 607 unless the input starts with space. */
598 && ((string_char_length (XSTRING (string)) > 0 && 608 && ((string_char_length (XSTRING (string)) > 0 &&
599 string_char (XSTRING (string), 0) == ' ') 609 string_char (XSTRING (string), 0) == ' ')
627 Return the prompt string of the currently-active minibuffer. 637 Return the prompt string of the currently-active minibuffer.
628 If no minibuffer is active, return nil. 638 If no minibuffer is active, return nil.
629 */ 639 */
630 ()) 640 ())
631 { 641 {
632 return (Fcopy_sequence (Vminibuf_prompt)); 642 return Fcopy_sequence (Vminibuf_prompt);
633 } 643 }
634 644
635 xxDEFUN ("minibuffer-prompt-width", Fminibuffer_prompt_width, 0, 0, 0, /* 645 xxDEFUN ("minibuffer-prompt-width", Fminibuffer_prompt_width, 0, 0, 0, /*
636 Return the display width of the minibuffer prompt. 646 Return the display width of the minibuffer prompt.
637 */ 647 */
638 ()) 648 ())
639 { 649 {
640 return (make_int (minibuf_prompt_width)); 650 return make_int (minibuf_prompt_width);
641 } 651 }
642 #endif /* 0 */ 652 #endif /* 0 */
643 653
644 654
645 /************************************************************************/ 655 /************************************************************************/
656 if (!NILP (Ffboundp (Qclear_message))) 666 if (!NILP (Ffboundp (Qclear_message)))
657 { 667 {
658 Lisp_Object frame; 668 Lisp_Object frame;
659 669
660 XSETFRAME (frame, f); 670 XSETFRAME (frame, f);
661 return call4 (Qclear_message, label, frame, from_print ? Qt : Qnil, 671 return call4 (Qclear_message, label, frame, from_print ? Qt : Qnil,
662 no_restore ? Qt : Qnil); 672 no_restore ? Qt : Qnil);
663 } 673 }
664 else 674 else
665 { 675 {
666 write_string_to_stdio_stream (stderr, 0, (CONST Bufbyte *) "\n", 0, 1, 676 write_string_to_stdio_stream (stderr, 0, (CONST Bufbyte *) "\n", 0, 1,
696 /* some callers pass in a null string as a way of clearing the echo area. 706 /* some callers pass in a null string as a way of clearing the echo area.
697 check for length == 0 now; if this case, neither nonreloc nor reloc 707 check for length == 0 now; if this case, neither nonreloc nor reloc
698 may be valid. */ 708 may be valid. */
699 if (length == 0) 709 if (length == 0)
700 return; 710 return;
701 711
702 fixup_internal_substring (nonreloc, reloc, offset, &length); 712 fixup_internal_substring (nonreloc, reloc, offset, &length);
703 713
704 /* also check it here, in case the string was really blank. */ 714 /* also check it here, in case the string was really blank. */
705 if (length == 0) 715 if (length == 0)
706 return; 716 return;
707 717
708 if (!NILP (Ffboundp (Qappend_message))) 718 if (!NILP (Ffboundp (Qappend_message)))
713 { 723 {
714 if (STRINGP (reloc)) 724 if (STRINGP (reloc))
715 nonreloc = XSTRING_DATA (reloc); 725 nonreloc = XSTRING_DATA (reloc);
716 obj = make_string (nonreloc + offset, length); 726 obj = make_string (nonreloc + offset, length);
717 } 727 }
718 728
719 XSETFRAME (frame, f); 729 XSETFRAME (frame, f);
720 GCPRO1 (obj); 730 GCPRO1 (obj);
721 call4 (Qappend_message, label, obj, frame, 731 call4 (Qappend_message, label, obj, frame,
722 EQ (label, Qprint) ? Qt : Qnil); 732 EQ (label, Qprint) ? Qt : Qnil);
723 UNGCPRO; 733 UNGCPRO;
724 } 734 }
725 else 735 else
726 { 736 {
746 { 756 {
747 /* By definition, the echo area is active if the echo-area buffer 757 /* By definition, the echo area is active if the echo-area buffer
748 is not empty. No need to call Lisp code. (Anyway, this function 758 is not empty. No need to call Lisp code. (Anyway, this function
749 is called from redisplay.) */ 759 is called from redisplay.) */
750 struct buffer *echo_buffer = XBUFFER (Vecho_area_buffer); 760 struct buffer *echo_buffer = XBUFFER (Vecho_area_buffer);
751 return (BUF_BEGV (echo_buffer) != BUF_ZV (echo_buffer)); 761 return BUF_BEGV (echo_buffer) != BUF_ZV (echo_buffer);
752 } 762 }
753 763
754 Lisp_Object 764 Lisp_Object
755 echo_area_status (struct frame *f) 765 echo_area_status (struct frame *f)
756 { 766 {
758 if (!NILP (Ffboundp (Qcurrent_message_label))) 768 if (!NILP (Ffboundp (Qcurrent_message_label)))
759 { 769 {
760 Lisp_Object frame; 770 Lisp_Object frame;
761 771
762 XSETFRAME (frame, f); 772 XSETFRAME (frame, f);
763 return (call1 (Qcurrent_message_label, frame)); 773 return call1 (Qcurrent_message_label, frame);
764 } 774 }
765 else 775 else
766 return stdout_needs_newline ? Qmessage : Qnil; 776 return stdout_needs_newline ? Qmessage : Qnil;
767 } 777 }
768 778
926 Vminibuf_prompt = Qnil; 936 Vminibuf_prompt = Qnil;
927 937
928 /* Added by Jareth Hein (jhod@po.iijnet.or.jp) for input system support */ 938 /* Added by Jareth Hein (jhod@po.iijnet.or.jp) for input system support */
929 staticpro (&Vminibuf_preprompt); 939 staticpro (&Vminibuf_preprompt);
930 Vminibuf_preprompt = Qnil; 940 Vminibuf_preprompt = Qnil;
931 941
932 DEFVAR_LISP ("minibuffer-setup-hook", &Vminibuffer_setup_hook /* 942 DEFVAR_LISP ("minibuffer-setup-hook", &Vminibuffer_setup_hook /*
933 Normal hook run just after entry to minibuffer. 943 Normal hook run just after entry to minibuffer.
934 */ ); 944 */ );
935 Vminibuffer_setup_hook = Qnil; 945 Vminibuffer_setup_hook = Qnil;
936 946