2003-05-17 Richard M. Stallman <rms@gnu.org>
+ * minibuf.c (read_minibuf): If buffer is empty, record the default
+ in the history.
+ (Fminibuffer_complete_word): When deleting the overlap, take account
+ of its real position.
+
+ * fns.c (map_char_table): Fix previous change.
+
* syntax.c (find_defun_start):
When open_paren_in_column_0_is_defun_start,
return beginning of buffer.
match the front of that history list exactly. The value is pushed onto
the list as the string that was read.
- DEFALT specifies te default value for the sake of history commands.
+ DEFALT specifies the default value for the sake of history commands.
If ALLOW_PROPS is nonzero, we do not throw away text properties.
Lisp_Object mini_frame, ambient_dir, minibuffer, input_method;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
Lisp_Object enable_multibyte;
+
+ /* String to add to the history. */
+ Lisp_Object histstring;
+
extern Lisp_Object Qfront_sticky;
extern Lisp_Object Qrear_nonsticky;
last_minibuf_string = val;
- /* Add the value to the appropriate history list unless it is empty. */
- if (SCHARS (val) != 0
- && SYMBOLP (Vminibuffer_history_variable))
+ /* Choose the string to add to the history. */
+ if (SCHARS (val) != 0)
+ histstring = val;
+ else if (STRINGP (defalt))
+ histstring = defalt;
+ else
+ histstring = Qnil;
+
+ /* Add the value to the appropriate history list, if any. */
+ if (SYMBOLP (Vminibuffer_history_variable)
+ && !NILP (histstring))
{
/* 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. */
/* 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)))))
+ /* Don't duplicate the most recent entry in the history. */
+ && NILP (Fequal (histstring, Fcar (histval)))))
{
Lisp_Object length;
- histval = Fcons (last_minibuf_string, histval);
+ histval = Fcons (histstring, histval);
Fset (Vminibuffer_history_variable, histval);
/* Truncate if requested. */
i++;
buffer_nchars--;
}
- del_range (1, i + 1);
+ del_range (start_pos, start_pos + buffer_nchars);
}
UNGCPRO;
}