]> git.eshelyaron.com Git - emacs.git/commitdiff
; Simplify recent change in 'read_minibuf' history handling
authorEshel Yaron <me@eshelyaron.com>
Thu, 15 Feb 2024 18:28:47 +0000 (19:28 +0100)
committerEshel Yaron <me@eshelyaron.com>
Thu, 15 Feb 2024 18:28:47 +0000 (19:28 +0100)
* src/minibuf.c (read_minibuf): Simplify.
(syms_of_minibuf): Delete 'Qhistory_add_new_input'.

src/minibuf.c

index 87d75ae10c8ba3fe72c11fb7176dd7b6dac74666..1114e7f773cf9d0a6406bad2e525aeaa34259c8e 100644 (file)
@@ -585,7 +585,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
   /* String to add to the history.  */
   Lisp_Object histstring;
   Lisp_Object histval;
-  bool nohist = false;
 
   Lisp_Object empty_minibuf;
 
@@ -903,9 +902,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
   /* Don't allow the user to undo past this point.  */
   bset_undo_list (current_buffer, Qnil);
 
-  /* Cache the buffer-local value. */
-  nohist = NILP (find_symbol_value (Qhistory_add_new_input));
-
   recursive_edit_1 ();
 
   /* If cursor is on the minibuffer line,
@@ -952,6 +948,12 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
   else
     histstring = Qnil;
 
+  /* Add the value to the appropriate history list, if any.  This is
+     done after the previous buffer has been made current again, in
+     case the history variable is buffer-local.  */
+  if (! (NILP (Vhistory_add_new_input) || NILP (histstring)))
+    call2 (Qadd_to_history, histvar, histstring);
+
   /* The appropriate frame will get selected
      in set-window-configuration.  */
   unbind_to (count, Qnil);
@@ -966,12 +968,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
                      calling_frame))))
     call2 (Qselect_frame_set_input_focus, calling_frame, Qnil);
 
-  /* Add the value to the appropriate history list, if any.  This is
-     done after the previous buffer has been made current again, in
-     case the history variable is buffer-local.  */
-  if (! (nohist || NILP (histstring)))
-    call2 (Qadd_to_history, histvar, histstring);
-
   /* If Lisp form desired instead of string, parse it.  */
   if (expflag)
     val = string_to_object (val, defalt);
@@ -2270,7 +2266,6 @@ syms_of_minibuf (void)
   Fset (Qcustom_variable_history, Qnil);
 
   DEFSYM (Qminibuffer_history, "minibuffer-history");
-  DEFSYM (Qhistory_add_new_input, "history-add-new-input");
   DEFSYM (Qbuffer_name_history, "buffer-name-history");
   Fset (Qbuffer_name_history, Qnil);