changeset 9583:99d523cdb0ea

(read_minibuf): Store the object, not the string, into the history variable.
author Karl Heuer <kwzh@gnu.org>
date Tue, 18 Oct 1994 03:05:34 +0000
parents 5005fc6f6c6f
children 88992afb2a16
files src/minibuf.c
diffstat 1 files changed, 19 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/minibuf.c	Tue Oct 18 02:45:12 1994 +0000
+++ b/src/minibuf.c	Tue Oct 18 03:05:34 1994 +0000
@@ -111,11 +111,11 @@
    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 @@
   /* 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 @@
       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.  */
 }