To: vim-dev@vim.org Subject: Patch 6.2.175 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.175 Problem: Changing 'backupext' in a *WritePre autocommand doesn't work. (William Natter) Solution: Move the use of p_bex to after executing the *WritePre autocommands. Also avoids reading allocated memory after freeing. Files: src/fileio.c *** ../vim-6.2.174/src/fileio.c Wed Nov 12 20:41:45 2003 --- src/fileio.c Thu Jan 8 20:22:41 2004 *************** *** 2502,2517 **** fname = sfname; #endif - /* make sure we have a valid backup extension to use */ - if (*p_bex == NUL) - #ifdef RISCOS - backup_ext = (char_u *)"/bak"; - #else - backup_ext = (char_u *)".bak"; - #endif - else - backup_ext = p_bex; - if (buf->b_ffname != NULL && fnamecmp(ffname, buf->b_ffname) == 0) overwriting = TRUE; else --- 2502,2507 ---- *************** *** 2896,2901 **** --- 2886,2903 ---- } #endif + /* make sure we have a valid backup extension to use */ + if (*p_bex == NUL) + { + #ifdef RISCOS + backup_ext = (char_u *)"/bak"; + #else + backup_ext = (char_u *)".bak"; + #endif + } + else + backup_ext = p_bex; + if (backup_copy && (fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0)) >= 0) { *** ../vim-6.2.174/src/version.c Thu Jan 8 20:54:45 2004 --- src/version.c Fri Jan 9 14:32:03 2004 *************** *** 639,640 **** --- 639,642 ---- { /* Add new patch number below this line */ + /**/ + 175, /**/ -- hundred-and-one symptoms of being an internet addict: 203. You're an active member of more than 20 newsgroups. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///