diff options
| author | Richard M. Stallman | 2004-12-21 11:33:16 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2004-12-21 11:33:16 +0000 |
| commit | 75fa7206f08d2b34f8e53c681a2423abe12e12c3 (patch) | |
| tree | 7329177ee3d93274689a69ba400c422dbb53884f /src | |
| parent | f10fffca3fb90b39d12f806a1038b12c5b610c84 (diff) | |
| download | emacs-75fa7206f08d2b34f8e53c681a2423abe12e12c3.tar.gz emacs-75fa7206f08d2b34f8e53c681a2423abe12e12c3.zip | |
(Fread_file_name): Delete duplicates in
file-name-history when history_delete_duplicates is true.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/fileio.c b/src/fileio.c index aa37c296eb3..d58c49d2825 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -228,6 +228,8 @@ extern int minibuf_level; | |||
| 228 | 228 | ||
| 229 | extern int minibuffer_auto_raise; | 229 | extern int minibuffer_auto_raise; |
| 230 | 230 | ||
| 231 | extern int history_delete_duplicates; | ||
| 232 | |||
| 231 | /* These variables describe handlers that have "already" had a chance | 233 | /* These variables describe handlers that have "already" had a chance |
| 232 | to handle the current operation. | 234 | to handle the current operation. |
| 233 | 235 | ||
| @@ -6383,7 +6385,13 @@ and `read-file-name-function'. */) | |||
| 6383 | if (replace_in_history) | 6385 | if (replace_in_history) |
| 6384 | /* Replace what Fcompleting_read added to the history | 6386 | /* Replace what Fcompleting_read added to the history |
| 6385 | with what we will actually return. */ | 6387 | with what we will actually return. */ |
| 6386 | XSETCAR (Fsymbol_value (Qfile_name_history), double_dollars (val)); | 6388 | { |
| 6389 | Lisp_Object val1 = double_dollars (val); | ||
| 6390 | tem = Fsymbol_value (Qfile_name_history); | ||
| 6391 | if (history_delete_duplicates) | ||
| 6392 | XSETCDR (tem, Fdelete (val1, XCDR(tem))); | ||
| 6393 | XSETCAR (tem, val1); | ||
| 6394 | } | ||
| 6387 | else if (add_to_history) | 6395 | else if (add_to_history) |
| 6388 | { | 6396 | { |
| 6389 | /* Add the value to the history--but not if it matches | 6397 | /* Add the value to the history--but not if it matches |
| @@ -6391,8 +6399,10 @@ and `read-file-name-function'. */) | |||
| 6391 | Lisp_Object val1 = double_dollars (val); | 6399 | Lisp_Object val1 = double_dollars (val); |
| 6392 | tem = Fsymbol_value (Qfile_name_history); | 6400 | tem = Fsymbol_value (Qfile_name_history); |
| 6393 | if (! CONSP (tem) || NILP (Fequal (XCAR (tem), val1))) | 6401 | if (! CONSP (tem) || NILP (Fequal (XCAR (tem), val1))) |
| 6394 | Fset (Qfile_name_history, | 6402 | { |
| 6395 | Fcons (val1, tem)); | 6403 | if (history_delete_duplicates) tem = Fdelete (val1, tem); |
| 6404 | Fset (Qfile_name_history, Fcons (val1, tem)); | ||
| 6405 | } | ||
| 6396 | } | 6406 | } |
| 6397 | 6407 | ||
| 6398 | return val; | 6408 | return val; |