Drop entry in Open Previous file list if the file no longer exists If you select an entry in the File -> Open Previous menu list for a file which cannot be found, the entry in the menu list (and history file) will be removed. Otherwise, the only way to remove such entries is by "pushing them out" with other file names until they drop off the history list, meaning that you can often see dead entries in the list. Calls to the new function RemoveFromPrevOpenMenu() could perhaps be made elsewhere, when document windows are closed for lost files. diff -aur nedit_official nedit_mod diff -aur nedit_official/source/file.c nedit_mod/source/file.c --- nedit_official/source/file.c 2006-01-14 12:42:16.000000000 +0100 +++ nedit_mod/source/file.c 2006-02-10 00:37:28.543348800 +0100 @@ -214,6 +214,8 @@ if (!doOpen(window, name, path, flags)) { /* The user may have destroyed the window instead of closing the warning dialog; don't close it twice */ + strcat(strcpy(fullname, path), name); + RemoveFromPrevOpenMenu(fullname); safeClose(window); return NULL; diff -aur nedit_official/source/menu.c nedit_mod/source/menu.c --- nedit_official/source/menu.c 2006-02-02 21:24:34.000000000 +0100 +++ nedit_mod/source/menu.c 2006-02-10 00:01:27.946563200 +0100 @@ -4554,6 +4554,43 @@ WriteNEditDB(); } +/* +** Remove a file from the list of previously opened files for display in the +** File menu. +*/ +void RemoveFromPrevOpenMenu(const char *filename) +{ + int i; + + /* If the Open Previous command is disabled, just return */ + if (GetPrefMaxPrevOpenFiles() < 1) { + return; + } + + /* Refresh list of previously opened files to avoid Big Race Condition, + where two sessions overwrite each other's changes in NEdit's + history file. + Of course there is still Little Race Condition, which occurs if a + Session A reads the list, then Session B reads the list and writes + it before Session A gets a chance to write. */ + ReadNEditDB(); + + /* If the name is already in the list, remove it */ + for (i=0; i