summaryrefslogtreecommitdiff
path: root/src/minibuf.c
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1994-10-18 03:05:34 +0000
committerKarl Heuer <kwzh@gnu.org>1994-10-18 03:05:34 +0000
commitc27017e76fa2957b467d4c57506bba527b3348fa (patch)
treed5728fe35500c8921c281419aa84e4e08594ae37 /src/minibuf.c
parentbf9588afd094b2bca2c4386975d447478d0b8784 (diff)
downloademacs-c27017e76fa2957b467d4c57506bba527b3348fa.tar.gz
(read_minibuf): Store the object, not the string, into the history variable.
Diffstat (limited to 'src/minibuf.c')
-rw-r--r--src/minibuf.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index 7d1721fa4bf..d63ed473161 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -111,11 +111,11 @@ Lisp_Object read_minibuf ();
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)
@@ -269,25 +269,6 @@ 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)
{
@@ -302,6 +283,23 @@ read_minibuf (map, initial, prompt, backup_n, expflag, histvar, histpos)
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. */
}