(read_minibuf): Undo previous change.
authorRichard M. Stallman <rms@gnu.org>
Thu, 20 Oct 1994 04:37:03 +0000 (04:37 +0000)
committerRichard M. Stallman <rms@gnu.org>
Thu, 20 Oct 1994 04:37:03 +0000 (04:37 +0000)
src/minibuf.c

index d63ed47..f83e9ac 100644 (file)
@@ -269,22 +269,8 @@ read_minibuf (map, initial, prompt, backup_n, expflag, histvar, histpos)
   /* VAL is the string of minibuffer text.  */
   last_minibuf_string = val;
 
-  /* If Lisp form desired instead of string, parse it. */
-  if (expflag)
-    {
-      Lisp_Object expr_and_pos;
-      unsigned char *p;
-
-      expr_and_pos = Fread_from_string (val, Qnil, Qnil);
-      /* Ignore trailing whitespace; any other trailing junk is an error.  */
-      for (p = XSTRING (val)->data + XINT (Fcdr (expr_and_pos)); *p; p++)
-       if (*p != ' ' && *p != '\t' && *p != '\n')
-         error ("Trailing garbage following expression");
-      val = Fcar (expr_and_pos);
-    }
-
   /* Add the value to the appropriate history list unless it is empty.  */
-  if (XSTRING (last_minibuf_string)->size != 0
+  if (XSTRING (val)->size != 0
       && SYMBOLP (Vminibuffer_history_variable)
       && ! EQ (XSYMBOL (Vminibuffer_history_variable)->value, Qunbound))
     {
@@ -296,8 +282,24 @@ read_minibuf (map, initial, prompt, backup_n, expflag, histvar, histpos)
       /* The value of the history variable must be a cons or nil.  Other
         values are unacceptable.  We silently ignore these values.  */
       if (NILP (histval)
-         || (CONSP (histval) && NILP (Fequal (val, XCONS (histval)->car))))
-       Fset (Vminibuffer_history_variable, Fcons (val, histval));
+         || (CONSP (histval)
+             && NILP (Fequal (last_minibuf_string, Fcar (histval)))))
+       Fset (Vminibuffer_history_variable,
+             Fcons (last_minibuf_string, histval));
+    }
+
+  /* If Lisp form desired instead of string, parse it. */
+  if (expflag)
+    {
+      Lisp_Object expr_and_pos;
+      unsigned char *p;
+
+      expr_and_pos = Fread_from_string (val, Qnil, Qnil);
+      /* Ignore trailing whitespace; any other trailing junk is an error.  */
+      for (p = XSTRING (val)->data + XINT (Fcdr (expr_and_pos)); *p; p++)
+       if (*p != ' ' && *p != '\t' && *p != '\n')
+         error ("Trailing garbage following expression");
+      val = Fcar (expr_and_pos);
     }
 
   return unbind_to (count, val); /* The appropriate frame will get selected