with initial position HISTPOS. (BACKUP_N should be <= 0.)
Normally return the result as a string (the text that was read),
- but if EXPFLAG is non-nil, read it and return the object read.
+ but if EXPFLAG is nonzero, read it and return the object read.
If HISTVAR is given, save the value read on that history only if it doesn't
match the front of that history list exactly. The value is pushed onto
the list as the string that was read, or as the object that resulted iff
- EXPFLAG is non-nil. */
+ EXPFLAG is nonzero. */
Lisp_Object
read_minibuf (map, initial, prompt, backup_n, expflag, histvar, histpos)
/* VAL is the string of minibuffer text. */
last_minibuf_string = val;
- /* Add the value to the appropriate history list unless it is empty. */
- if (XSTRING (val)->size != 0
- && SYMBOLP (Vminibuffer_history_variable)
- && ! EQ (XSYMBOL (Vminibuffer_history_variable)->value, Qunbound))
- {
- /* If the caller wanted to save the value read on a history list,
- then do so if the value is not already the front of the list. */
- Lisp_Object histval;
- histval = Fsymbol_value (Vminibuffer_history_variable);
-
- /* 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 (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)
{
val = Fcar (expr_and_pos);
}
+ /* Add the value to the appropriate history list unless it is empty. */
+ if (XSTRING (last_minibuf_string)->size != 0
+ && SYMBOLP (Vminibuffer_history_variable)
+ && ! EQ (XSYMBOL (Vminibuffer_history_variable)->value, Qunbound))
+ {
+ /* If the caller wanted to save the value read on a history list,
+ then do so if the value is not already the front of the list. */
+ Lisp_Object histval;
+ histval = Fsymbol_value (Vminibuffer_history_variable);
+
+ /* 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));
+ }
+
return unbind_to (count, val); /* The appropriate frame will get selected
in set-window-configuration. */
}