aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/minibuf.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index 1e87c5044af..bdae01dbc58 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -353,7 +353,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
353 Lisp_Object histvar, Lisp_Object histpos, Lisp_Object defalt, 353 Lisp_Object histvar, Lisp_Object histpos, Lisp_Object defalt,
354 bool allow_props, bool inherit_input_method) 354 bool allow_props, bool inherit_input_method)
355{ 355{
356 Lisp_Object val; 356 Lisp_Object val, previous_buffer = Fcurrent_buffer ();
357 ptrdiff_t count = SPECPDL_INDEX (); 357 ptrdiff_t count = SPECPDL_INDEX ();
358 Lisp_Object mini_frame, ambient_dir, minibuffer, input_method; 358 Lisp_Object mini_frame, ambient_dir, minibuffer, input_method;
359 Lisp_Object enable_multibyte; 359 Lisp_Object enable_multibyte;
@@ -698,7 +698,20 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
698 698
699 /* Add the value to the appropriate history list, if any. */ 699 /* Add the value to the appropriate history list, if any. */
700 if (! (NILP (Vhistory_add_new_input) || NILP (histstring))) 700 if (! (NILP (Vhistory_add_new_input) || NILP (histstring)))
701 call2 (intern ("add-to-history"), Vminibuffer_history_variable, histstring); 701 {
702 ptrdiff_t count2 = SPECPDL_INDEX ();
703
704 /* If possible, switch back to the previous buffer first, in
705 case the history variable is buffer-local. */
706 if (BUFFER_LIVE_P (XBUFFER (previous_buffer)))
707 {
708 record_unwind_current_buffer ();
709 Fset_buffer (previous_buffer);
710 }
711
712 call2 (intern ("add-to-history"), Vminibuffer_history_variable, histstring);
713 unbind_to (count2, Qnil);
714 }
702 715
703 /* If Lisp form desired instead of string, parse it. */ 716 /* If Lisp form desired instead of string, parse it. */
704 if (expflag) 717 if (expflag)
@@ -879,6 +892,9 @@ Fifth arg HIST, if non-nil, specifies a history list and optionally
879 starting from 1 at the beginning of the list. If HIST is the symbol 892 starting from 1 at the beginning of the list. If HIST is the symbol
880 `t', history is not recorded. 893 `t', history is not recorded.
881 894
895 If `history-add-new-input' is non-nil (the default), the result will
896 be added to the history list using `add-to-history'.
897
882Sixth arg DEFAULT-VALUE, if non-nil, should be a string, which is used 898Sixth arg DEFAULT-VALUE, if non-nil, should be a string, which is used
883 as the default to `read' if READ is non-nil and the user enters 899 as the default to `read' if READ is non-nil and the user enters
884 empty input. But if READ is nil, this function does _not_ return 900 empty input. But if READ is nil, this function does _not_ return