aboutsummaryrefslogtreecommitdiffstats
path: root/src/minibuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/minibuf.c')
-rw-r--r--src/minibuf.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index d37f82c9dcd..c5910b1771f 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -66,6 +66,10 @@ Lisp_Object Qhistory_length, Vhistory_length;
66 66
67int history_delete_duplicates; 67int history_delete_duplicates;
68 68
69/* Non-nil means add new input to history. */
70
71Lisp_Object Vhistory_add_new_input;
72
69/* Fread_minibuffer leaves the input here as a string. */ 73/* Fread_minibuffer leaves the input here as a string. */
70 74
71Lisp_Object last_minibuf_string; 75Lisp_Object last_minibuf_string;
@@ -219,7 +223,7 @@ static Lisp_Object read_minibuf P_ ((Lisp_Object, Lisp_Object,
219 Lisp_Object, Lisp_Object, 223 Lisp_Object, Lisp_Object,
220 int, Lisp_Object, 224 int, Lisp_Object,
221 Lisp_Object, Lisp_Object, 225 Lisp_Object, Lisp_Object,
222 int, int, int)); 226 int, int));
223static Lisp_Object read_minibuf_noninteractive P_ ((Lisp_Object, Lisp_Object, 227static Lisp_Object read_minibuf_noninteractive P_ ((Lisp_Object, Lisp_Object,
224 Lisp_Object, Lisp_Object, 228 Lisp_Object, Lisp_Object,
225 int, Lisp_Object, 229 int, Lisp_Object,
@@ -440,8 +444,7 @@ The current buffer must be a minibuffer. */)
440 444
441static Lisp_Object 445static Lisp_Object
442read_minibuf (map, initial, prompt, backup_n, expflag, 446read_minibuf (map, initial, prompt, backup_n, expflag,
443 histvar, histpos, defalt, allow_props, inherit_input_method, 447 histvar, histpos, defalt, allow_props, inherit_input_method)
444 keep_all)
445 Lisp_Object map; 448 Lisp_Object map;
446 Lisp_Object initial; 449 Lisp_Object initial;
447 Lisp_Object prompt; 450 Lisp_Object prompt;
@@ -452,7 +455,6 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
452 Lisp_Object defalt; 455 Lisp_Object defalt;
453 int allow_props; 456 int allow_props;
454 int inherit_input_method; 457 int inherit_input_method;
455 int keep_all;
456{ 458{
457 Lisp_Object val; 459 Lisp_Object val;
458 int count = SPECPDL_INDEX (); 460 int count = SPECPDL_INDEX ();
@@ -747,7 +749,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
747 last_minibuf_string = val; 749 last_minibuf_string = val;
748 750
749 /* Choose the string to add to the history. */ 751 /* Choose the string to add to the history. */
750 if (SCHARS (val) != 0 || keep_all) 752 if (SCHARS (val) != 0)
751 histstring = val; 753 histstring = val;
752 else if (STRINGP (defalt)) 754 else if (STRINGP (defalt))
753 histstring = defalt; 755 histstring = defalt;
@@ -755,7 +757,8 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
755 histstring = Qnil; 757 histstring = Qnil;
756 758
757 /* Add the value to the appropriate history list, if any. */ 759 /* Add the value to the appropriate history list, if any. */
758 if (SYMBOLP (Vminibuffer_history_variable) 760 if (!NILP (Vhistory_add_new_input)
761 && SYMBOLP (Vminibuffer_history_variable)
759 && !NILP (histstring)) 762 && !NILP (histstring))
760 { 763 {
761 /* If the caller wanted to save the value read on a history list, 764 /* If the caller wanted to save the value read on a history list,
@@ -774,8 +777,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
774 if (NILP (histval) 777 if (NILP (histval)
775 || (CONSP (histval) 778 || (CONSP (histval)
776 /* Don't duplicate the most recent entry in the history. */ 779 /* Don't duplicate the most recent entry in the history. */
777 && (keep_all 780 && (NILP (Fequal (histstring, Fcar (histval))))))
778 || NILP (Fequal (histstring, Fcar (histval))))))
779 { 781 {
780 Lisp_Object length; 782 Lisp_Object length;
781 783
@@ -937,7 +939,7 @@ read_minibuf_unwind (data)
937} 939}
938 940
939 941
940DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, 8, 0, 942DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, 7, 0,
941 doc: /* Read a string from the minibuffer, prompting with string PROMPT. 943 doc: /* Read a string from the minibuffer, prompting with string PROMPT.
942The optional second arg INITIAL-CONTENTS is an obsolete alternative to 944The optional second arg INITIAL-CONTENTS is an obsolete alternative to
943 DEFAULT-VALUE. It normally should be nil in new code, except when 945 DEFAULT-VALUE. It normally should be nil in new code, except when
@@ -961,8 +963,6 @@ Sixth arg DEFAULT-VALUE is the default value. If non-nil, it is available
961 the empty string. 963 the empty string.
962Seventh arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits 964Seventh arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits
963 the current input method and the setting of `enable-multibyte-characters'. 965 the current input method and the setting of `enable-multibyte-characters'.
964Eight arg KEEP-ALL, if non-nil, says to put all inputs in the history list,
965 even empty or duplicate inputs.
966If the variable `minibuffer-allow-text-properties' is non-nil, 966If the variable `minibuffer-allow-text-properties' is non-nil,
967 then the string which is returned includes whatever text properties 967 then the string which is returned includes whatever text properties
968 were present in the minibuffer. Otherwise the value has no text properties. 968 were present in the minibuffer. Otherwise the value has no text properties.
@@ -978,9 +978,9 @@ POSITION in the minibuffer. Any integer value less than or equal to
978one puts point at the beginning of the string. *Note* that this 978one puts point at the beginning of the string. *Note* that this
979behavior differs from the way such arguments are used in `completing-read' 979behavior differs from the way such arguments are used in `completing-read'
980and some related functions, which use zero-indexing for POSITION. */) 980and some related functions, which use zero-indexing for POSITION. */)
981 (prompt, initial_contents, keymap, read, hist, default_value, inherit_input_method, keep_all) 981(prompt, initial_contents, keymap, read, hist, default_value, inherit_input_method)
982 Lisp_Object prompt, initial_contents, keymap, read, hist, default_value; 982 Lisp_Object prompt, initial_contents, keymap, read, hist, default_value;
983 Lisp_Object inherit_input_method, keep_all; 983 Lisp_Object inherit_input_method;
984{ 984{
985 Lisp_Object histvar, histpos, val; 985 Lisp_Object histvar, histpos, val;
986 struct gcpro gcpro1; 986 struct gcpro gcpro1;
@@ -1011,8 +1011,7 @@ and some related functions, which use zero-indexing for POSITION. */)
1011 Qnil, !NILP (read), 1011 Qnil, !NILP (read),
1012 histvar, histpos, default_value, 1012 histvar, histpos, default_value,
1013 minibuffer_allow_text_properties, 1013 minibuffer_allow_text_properties,
1014 !NILP (inherit_input_method), 1014 !NILP (inherit_input_method));
1015 !NILP (keep_all));
1016 UNGCPRO; 1015 UNGCPRO;
1017 return val; 1016 return val;
1018} 1017}
@@ -1029,7 +1028,7 @@ arguments are used as in `read-from-minibuffer') */)
1029 CHECK_STRING (prompt); 1028 CHECK_STRING (prompt);
1030 return read_minibuf (Vminibuffer_local_map, initial_contents, 1029 return read_minibuf (Vminibuffer_local_map, initial_contents,
1031 prompt, Qnil, 1, Qminibuffer_history, 1030 prompt, Qnil, 1, Qminibuffer_history,
1032 make_number (0), Qnil, 0, 0, 0); 1031 make_number (0), Qnil, 0, 0);
1033} 1032}
1034 1033
1035DEFUN ("eval-minibuffer", Feval_minibuffer, Seval_minibuffer, 1, 2, 0, 1034DEFUN ("eval-minibuffer", Feval_minibuffer, Seval_minibuffer, 1, 2, 0,
@@ -1067,7 +1066,7 @@ Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits
1067 Lisp_Object val; 1066 Lisp_Object val;
1068 val = Fread_from_minibuffer (prompt, initial_input, Qnil, 1067 val = Fread_from_minibuffer (prompt, initial_input, Qnil,
1069 Qnil, history, default_value, 1068 Qnil, history, default_value,
1070 inherit_input_method, Qnil); 1069 inherit_input_method);
1071 if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (default_value)) 1070 if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (default_value))
1072 val = default_value; 1071 val = default_value;
1073 return val; 1072 return val;
@@ -1089,7 +1088,7 @@ the current input method and the setting of`enable-multibyte-characters'. */)
1089 CHECK_STRING (prompt); 1088 CHECK_STRING (prompt);
1090 return read_minibuf (Vminibuffer_local_ns_map, initial, prompt, Qnil, 1089 return read_minibuf (Vminibuffer_local_ns_map, initial, prompt, Qnil,
1091 0, Qminibuffer_history, make_number (0), Qnil, 0, 1090 0, Qminibuffer_history, make_number (0), Qnil, 0,
1092 !NILP (inherit_input_method), 0); 1091 !NILP (inherit_input_method));
1093} 1092}
1094 1093
1095DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0, 1094DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0,
@@ -1778,7 +1777,7 @@ Completion ignores case if the ambient value of
1778 : Vminibuffer_local_must_match_filename_map), 1777 : Vminibuffer_local_must_match_filename_map),
1779 init, prompt, make_number (pos), 0, 1778 init, prompt, make_number (pos), 0,
1780 histvar, histpos, def, 0, 1779 histvar, histpos, def, 0,
1781 !NILP (inherit_input_method), 0); 1780 !NILP (inherit_input_method));
1782 1781
1783 if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (def)) 1782 if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (def))
1784 val = def; 1783 val = def;
@@ -2797,9 +2796,16 @@ property of a history variable overrides this default. */);
2797 DEFVAR_BOOL ("history-delete-duplicates", &history_delete_duplicates, 2796 DEFVAR_BOOL ("history-delete-duplicates", &history_delete_duplicates,
2798 doc: /* *Non-nil means to delete duplicates in history. 2797 doc: /* *Non-nil means to delete duplicates in history.
2799If set to t when adding a new history element, all previous identical 2798If set to t when adding a new history element, all previous identical
2800elements are deleted. */); 2799elements are deleted from the history list. */);
2801 history_delete_duplicates = 0; 2800 history_delete_duplicates = 0;
2802 2801
2802 DEFVAR_LISP ("history-add-new-input", &Vhistory_add_new_input,
2803 doc: /* *Non-nil means to add new elements in history.
2804If set to nil, minibuffer reading functions don't add new elements to the
2805history list, so it is possible to do this afterwards by calling
2806`add-to-history' explicitly. */);
2807 Vhistory_add_new_input = Qt;
2808
2803 DEFVAR_LISP ("completion-auto-help", &Vcompletion_auto_help, 2809 DEFVAR_LISP ("completion-auto-help", &Vcompletion_auto_help,
2804 doc: /* *Non-nil means automatically provide help for invalid completion input. 2810 doc: /* *Non-nil means automatically provide help for invalid completion input.
2805Under Partial Completion mode, a non-nil, non-t value has a special meaning; 2811Under Partial Completion mode, a non-nil, non-t value has a special meaning;