comparison src/minibuf.c @ 75720:d93f8cf55f80

(read_minibuf): Fix 2007-01-30 change. Use Qlambda as interrim value of Vminibuffer_completing_file_name. (Fcompleting_read, do_completion, Fminibuffer_complete_word): If Vminibuffer_completing_file_name equals Qlambda, treat it as Qnil. (syms_of_minibuf) <minibuffer-completing-file-name>: Document lambda.
author Kim F. Storm <storm@cua.dk>
date Thu, 08 Feb 2007 00:06:43 +0000
parents f7b5b15084ef
children 55bd832be66b
comparison
equal deleted inserted replaced
75719:a8fd93a515a2 75720:d93f8cf55f80
470 int count = SPECPDL_INDEX (); 470 int count = SPECPDL_INDEX ();
471 Lisp_Object mini_frame, ambient_dir, minibuffer, input_method; 471 Lisp_Object mini_frame, ambient_dir, minibuffer, input_method;
472 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 472 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
473 Lisp_Object enable_multibyte; 473 Lisp_Object enable_multibyte;
474 int pos = INTEGERP (backup_n) ? XINT (backup_n) : 0; 474 int pos = INTEGERP (backup_n) ? XINT (backup_n) : 0;
475
476 /* String to add to the history. */ 475 /* String to add to the history. */
477 Lisp_Object histstring; 476 Lisp_Object histstring;
478 477
479 Lisp_Object empty_minibuf; 478 Lisp_Object empty_minibuf;
480 Lisp_Object dummy, frame; 479 Lisp_Object dummy, frame;
481 480
482 extern Lisp_Object Qfront_sticky; 481 extern Lisp_Object Qfront_sticky;
483 extern Lisp_Object Qrear_nonsticky; 482 extern Lisp_Object Qrear_nonsticky;
484 483
485 specbind (Qminibuffer_default, defalt); 484 specbind (Qminibuffer_default, defalt);
485
486 /* If Vminibuffer_completing_file_name is `lambda' on entry, it was t
487 in previous recursive minibuffer, but was not set explicitly
488 to t for this invocation, so set it to nil in this minibuffer.
489 Save the old value now, before we change it. */
490 specbind (intern ("minibuffer-completing-file-name"), Vminibuffer_completing_file_name);
491 if (EQ (Vminibuffer_completing_file_name, Qlambda))
492 Vminibuffer_completing_file_name = Qnil;
486 493
487 single_kboard_state (); 494 single_kboard_state ();
488 #ifdef HAVE_X_WINDOWS 495 #ifdef HAVE_X_WINDOWS
489 if (display_hourglass_p) 496 if (display_hourglass_p)
490 cancel_hourglass (); 497 cancel_hourglass ();
575 We could bind each variable separately, but that would use lots of 582 We could bind each variable separately, but that would use lots of
576 specpdl slots. */ 583 specpdl slots. */
577 minibuf_save_list 584 minibuf_save_list
578 = Fcons (Voverriding_local_map, 585 = Fcons (Voverriding_local_map,
579 Fcons (minibuf_window, 586 Fcons (minibuf_window,
580 Fcons (Vminibuffer_completing_file_name, 587 minibuf_save_list));
581 minibuf_save_list)));
582 minibuf_save_list 588 minibuf_save_list
583 = Fcons (minibuf_prompt, 589 = Fcons (minibuf_prompt,
584 Fcons (make_number (minibuf_prompt_width), 590 Fcons (make_number (minibuf_prompt_width),
585 Fcons (Vhelp_form, 591 Fcons (Vhelp_form,
586 Fcons (Vcurrent_prefix_arg, 592 Fcons (Vcurrent_prefix_arg,
602 minibuf_prompt_width = 0; 608 minibuf_prompt_width = 0;
603 minibuf_prompt = Fcopy_sequence (prompt); 609 minibuf_prompt = Fcopy_sequence (prompt);
604 Vminibuffer_history_position = histpos; 610 Vminibuffer_history_position = histpos;
605 Vminibuffer_history_variable = histvar; 611 Vminibuffer_history_variable = histvar;
606 Vhelp_form = Vminibuffer_help_form; 612 Vhelp_form = Vminibuffer_help_form;
607 /* If this minibuffer is reading a file name, 613 /* If this minibuffer is reading a file name, that doesn't mean
608 that doesn't mean recursive ones are. */ 614 recursive ones are. But we cannot set it to nil, because
609 Vminibuffer_completing_file_name = Qnil; 615 completion code still need to know the minibuffer is completing a
616 file name. So use `lambda' as intermediate value meaning
617 "t" in this minibuffer, but "nil" in next minibuffer. */
618 if (!NILP (Vminibuffer_completing_file_name))
619 Vminibuffer_completing_file_name = Qlambda;
610 620
611 if (inherit_input_method) 621 if (inherit_input_method)
612 { 622 {
613 /* `current-input-method' is buffer local. So, remember it in 623 /* `current-input-method' is buffer local. So, remember it in
614 INPUT_METHOD before changing the current buffer. */ 624 INPUT_METHOD before changing the current buffer. */
925 #if 0 935 #if 0
926 temp = Fcar (minibuf_save_list); 936 temp = Fcar (minibuf_save_list);
927 if (FRAME_LIVE_P (XFRAME (WINDOW_FRAME (XWINDOW (temp))))) 937 if (FRAME_LIVE_P (XFRAME (WINDOW_FRAME (XWINDOW (temp)))))
928 minibuf_window = temp; 938 minibuf_window = temp;
929 #endif 939 #endif
930 minibuf_save_list = Fcdr (minibuf_save_list);
931 Vminibuffer_completing_file_name = Fcar (minibuf_save_list);
932 minibuf_save_list = Fcdr (minibuf_save_list); 940 minibuf_save_list = Fcdr (minibuf_save_list);
933 941
934 /* Erase the minibuffer we were using at this level. */ 942 /* Erase the minibuffer we were using at this level. */
935 { 943 {
936 int count = SPECPDL_INDEX (); 944 int count = SPECPDL_INDEX ();
1791 if (NILP (histpos)) 1799 if (NILP (histpos))
1792 XSETFASTINT (histpos, 0); 1800 XSETFASTINT (histpos, 0);
1793 1801
1794 val = read_minibuf (NILP (require_match) 1802 val = read_minibuf (NILP (require_match)
1795 ? (NILP (Vminibuffer_completing_file_name) 1803 ? (NILP (Vminibuffer_completing_file_name)
1804 || EQ (Vminibuffer_completing_file_name, Qlambda)
1796 ? Vminibuffer_local_completion_map 1805 ? Vminibuffer_local_completion_map
1797 : Vminibuffer_local_filename_completion_map) 1806 : Vminibuffer_local_filename_completion_map)
1798 : (NILP (Vminibuffer_completing_file_name) 1807 : (NILP (Vminibuffer_completing_file_name)
1808 || EQ (Vminibuffer_completing_file_name, Qlambda)
1799 ? Vminibuffer_local_must_match_map 1809 ? Vminibuffer_local_must_match_map
1800 : Vminibuffer_local_must_match_filename_map), 1810 : Vminibuffer_local_must_match_filename_map),
1801 init, prompt, make_number (pos), 0, 1811 init, prompt, make_number (pos), 0,
1802 histvar, histpos, def, 0, 1812 histvar, histpos, def, 0,
1803 !NILP (inherit_input_method)); 1813 !NILP (inherit_input_method));
2000 { 2010 {
2001 int prompt_end = XINT (Fminibuffer_prompt_end ()); 2011 int prompt_end = XINT (Fminibuffer_prompt_end ());
2002 /* Some completion happened */ 2012 /* Some completion happened */
2003 2013
2004 if (! NILP (Vminibuffer_completing_file_name) 2014 if (! NILP (Vminibuffer_completing_file_name)
2015 && ! EQ (Vminibuffer_completing_file_name, Qlambda)
2005 && SREF (completion, SBYTES (completion) - 1) == '/' 2016 && SREF (completion, SBYTES (completion) - 1) == '/'
2006 && PT < ZV 2017 && PT < ZV
2007 && FETCH_CHAR (PT_BYTE) == '/') 2018 && FETCH_CHAR (PT_BYTE) == '/')
2008 { 2019 {
2009 del_range (prompt_end, PT + 1); 2020 del_range (prompt_end, PT + 1);
2289 CHECK_STRING (completion); 2300 CHECK_STRING (completion);
2290 tem = Fminibuffer_completion_contents (); 2301 tem = Fminibuffer_completion_contents ();
2291 GCPRO2 (completion, tem); 2302 GCPRO2 (completion, tem);
2292 /* If reading a file name, 2303 /* If reading a file name,
2293 expand any $ENVVAR refs in the buffer and in TEM. */ 2304 expand any $ENVVAR refs in the buffer and in TEM. */
2294 if (! NILP (Vminibuffer_completing_file_name)) 2305 if (! NILP (Vminibuffer_completing_file_name)
2306 && ! EQ (Vminibuffer_completing_file_name, Qlambda))
2295 { 2307 {
2296 Lisp_Object substituted; 2308 Lisp_Object substituted;
2297 substituted = Fsubstitute_in_file_name (tem); 2309 substituted = Fsubstitute_in_file_name (tem);
2298 if (! EQ (substituted, tem)) 2310 if (! EQ (substituted, tem))
2299 { 2311 {
2404 } 2416 }
2405 2417
2406 /* Otherwise insert in minibuffer the chars we got */ 2418 /* Otherwise insert in minibuffer the chars we got */
2407 2419
2408 if (! NILP (Vminibuffer_completing_file_name) 2420 if (! NILP (Vminibuffer_completing_file_name)
2421 && ! EQ (Vminibuffer_completing_file_name, Qlambda)
2409 && SREF (completion, SBYTES (completion) - 1) == '/' 2422 && SREF (completion, SBYTES (completion) - 1) == '/'
2410 && PT < ZV 2423 && PT < ZV
2411 && FETCH_CHAR (PT_BYTE) == '/') 2424 && FETCH_CHAR (PT_BYTE) == '/')
2412 { 2425 {
2413 del_range (prompt_end_charpos, PT + 1); 2426 del_range (prompt_end_charpos, PT + 1);
2908 doc: /* Non-nil means to demand confirmation of completion before exiting minibuffer. */); 2921 doc: /* Non-nil means to demand confirmation of completion before exiting minibuffer. */);
2909 Vminibuffer_completion_confirm = Qnil; 2922 Vminibuffer_completion_confirm = Qnil;
2910 2923
2911 DEFVAR_LISP ("minibuffer-completing-file-name", 2924 DEFVAR_LISP ("minibuffer-completing-file-name",
2912 &Vminibuffer_completing_file_name, 2925 &Vminibuffer_completing_file_name,
2913 doc: /* Non-nil means completing file names. */); 2926 doc: /* Non-nil and non-`lambda' means completing file names. */);
2914 Vminibuffer_completing_file_name = Qnil; 2927 Vminibuffer_completing_file_name = Qnil;
2915 2928
2916 DEFVAR_LISP ("minibuffer-help-form", &Vminibuffer_help_form, 2929 DEFVAR_LISP ("minibuffer-help-form", &Vminibuffer_help_form,
2917 doc: /* Value that `help-form' takes on inside the minibuffer. */); 2930 doc: /* Value that `help-form' takes on inside the minibuffer. */);
2918 Vminibuffer_help_form = Qnil; 2931 Vminibuffer_help_form = Qnil;