# HG changeset patch # User Richard M. Stallman # Date 1103628796 0 # Node ID 1ee6d4f5d727bf994703d21b9b86499d5980c1ae # Parent a38c7bcb8e1a924c45a4b236c647c47939996d7b (Fread_file_name): Delete duplicates in file-name-history when history_delete_duplicates is true. diff -r a38c7bcb8e1a -r 1ee6d4f5d727 src/fileio.c --- a/src/fileio.c Tue Dec 21 11:32:07 2004 +0000 +++ b/src/fileio.c Tue Dec 21 11:33:16 2004 +0000 @@ -228,6 +228,8 @@ extern int minibuffer_auto_raise; +extern int history_delete_duplicates; + /* These variables describe handlers that have "already" had a chance to handle the current operation. @@ -6383,7 +6385,13 @@ if (replace_in_history) /* Replace what Fcompleting_read added to the history with what we will actually return. */ - XSETCAR (Fsymbol_value (Qfile_name_history), double_dollars (val)); + { + Lisp_Object val1 = double_dollars (val); + tem = Fsymbol_value (Qfile_name_history); + if (history_delete_duplicates) + XSETCDR (tem, Fdelete (val1, XCDR(tem))); + XSETCAR (tem, val1); + } else if (add_to_history) { /* Add the value to the history--but not if it matches @@ -6391,8 +6399,10 @@ Lisp_Object val1 = double_dollars (val); tem = Fsymbol_value (Qfile_name_history); if (! CONSP (tem) || NILP (Fequal (XCAR (tem), val1))) - Fset (Qfile_name_history, - Fcons (val1, tem)); + { + if (history_delete_duplicates) tem = Fdelete (val1, tem); + Fset (Qfile_name_history, Fcons (val1, tem)); + } } return val;