/* 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))
{
/* 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