changeset 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 a8fd93a515a2
children 42f4a247dac2
files src/minibuf.c
diffstat 1 files changed, 23 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/minibuf.c	Wed Feb 07 23:02:12 2007 +0000
+++ b/src/minibuf.c	Thu Feb 08 00:06:43 2007 +0000
@@ -472,7 +472,6 @@
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   Lisp_Object enable_multibyte;
   int pos = INTEGERP (backup_n) ? XINT (backup_n) : 0;
-
   /* String to add to the history.  */
   Lisp_Object histstring;
 
@@ -484,6 +483,14 @@
 
   specbind (Qminibuffer_default, defalt);
 
+  /* If Vminibuffer_completing_file_name is `lambda' on entry, it was t
+     in previous recursive minibuffer, but was not set explicitly
+     to t for this invocation, so set it to nil in this minibuffer.
+     Save the old value now, before we change it.  */
+  specbind (intern ("minibuffer-completing-file-name"), Vminibuffer_completing_file_name);
+  if (EQ (Vminibuffer_completing_file_name, Qlambda))
+    Vminibuffer_completing_file_name = Qnil;
+
   single_kboard_state ();
 #ifdef HAVE_X_WINDOWS
   if (display_hourglass_p)
@@ -577,8 +584,7 @@
   minibuf_save_list
     = Fcons (Voverriding_local_map,
 	     Fcons (minibuf_window,
-		    Fcons (Vminibuffer_completing_file_name,
-			   minibuf_save_list)));
+		    minibuf_save_list));
   minibuf_save_list
     = Fcons (minibuf_prompt,
 	     Fcons (make_number (minibuf_prompt_width),
@@ -604,9 +610,13 @@
   Vminibuffer_history_position = histpos;
   Vminibuffer_history_variable = histvar;
   Vhelp_form = Vminibuffer_help_form;
-  /* If this minibuffer is reading a file name,
-     that doesn't mean recursive ones are.  */
-  Vminibuffer_completing_file_name = Qnil;
+  /* If this minibuffer is reading a file name, that doesn't mean
+     recursive ones are.  But we cannot set it to nil, because
+     completion code still need to know the minibuffer is completing a
+     file name.  So use `lambda' as intermediate value meaning
+     "t" in this minibuffer, but "nil" in next minibuffer.  */
+  if (!NILP (Vminibuffer_completing_file_name))
+    Vminibuffer_completing_file_name = Qlambda;
 
   if (inherit_input_method)
     {
@@ -928,8 +938,6 @@
     minibuf_window = temp;
 #endif
   minibuf_save_list = Fcdr (minibuf_save_list);
-  Vminibuffer_completing_file_name = Fcar (minibuf_save_list);
-  minibuf_save_list = Fcdr (minibuf_save_list);
 
   /* Erase the minibuffer we were using at this level.  */
   {
@@ -1793,9 +1801,11 @@
 
   val = read_minibuf (NILP (require_match)
 		      ? (NILP (Vminibuffer_completing_file_name)
+			 || EQ (Vminibuffer_completing_file_name, Qlambda)
 			 ? Vminibuffer_local_completion_map
 			 : Vminibuffer_local_filename_completion_map)
 		      : (NILP (Vminibuffer_completing_file_name)
+			 || EQ (Vminibuffer_completing_file_name, Qlambda)
 			 ? Vminibuffer_local_must_match_map
 			 : Vminibuffer_local_must_match_filename_map),
 		      init, prompt, make_number (pos), 0,
@@ -2002,6 +2012,7 @@
       /* Some completion happened */
 
       if (! NILP (Vminibuffer_completing_file_name)
+	  && ! EQ (Vminibuffer_completing_file_name, Qlambda)
 	  && SREF (completion, SBYTES (completion) - 1) == '/'
 	  && PT < ZV
 	  && FETCH_CHAR (PT_BYTE) == '/')
@@ -2291,7 +2302,8 @@
     GCPRO2 (completion, tem);
     /* If reading a file name,
        expand any $ENVVAR refs in the buffer and in TEM.  */
-    if (! NILP (Vminibuffer_completing_file_name))
+    if (! NILP (Vminibuffer_completing_file_name)
+	&& ! EQ (Vminibuffer_completing_file_name, Qlambda))
       {
 	Lisp_Object substituted;
 	substituted = Fsubstitute_in_file_name (tem);
@@ -2406,6 +2418,7 @@
   /* Otherwise insert in minibuffer the chars we got */
 
   if (! NILP (Vminibuffer_completing_file_name)
+      && ! EQ (Vminibuffer_completing_file_name, Qlambda)
       && SREF (completion, SBYTES (completion) - 1) == '/'
       && PT < ZV
       && FETCH_CHAR (PT_BYTE) == '/')
@@ -2910,7 +2923,7 @@
 
   DEFVAR_LISP ("minibuffer-completing-file-name",
 	       &Vminibuffer_completing_file_name,
-	       doc: /* Non-nil means completing file names.  */);
+	       doc: /* Non-nil and non-`lambda' means completing file names.  */);
   Vminibuffer_completing_file_name = Qnil;
 
   DEFVAR_LISP ("minibuffer-help-form", &Vminibuffer_help_form,