From 4707ed9b02f22c310c34ea9ec9e17248a0727ad1 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Thu, 15 Feb 2024 19:28:47 +0100 Subject: [PATCH] ; Simplify recent change in 'read_minibuf' history handling * src/minibuf.c (read_minibuf): Simplify. (syms_of_minibuf): Delete 'Qhistory_add_new_input'. --- src/minibuf.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/minibuf.c b/src/minibuf.c index 87d75ae10c8..1114e7f773c 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -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); -- 2.39.5