To: vim_dev@googlegroups.com Subject: Patch 8.2.4505 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4505 Problem: Vim9: outdated "autocmd nested" still works. Solution: Do not accept the :autocmd argument "nested" without "++" in Vim9 script. Files: src/autocmd.c, src/errors.h, src/testdir/test_autocmd.vim *** ../vim-8.2.4504/src/autocmd.c 2022-02-16 19:24:03.618162413 +0000 --- src/autocmd.c 2022-03-04 20:07:39.452113708 +0000 *************** *** 921,936 **** if ((STRNCMP(cmd, "++nested", 8) == 0 && VIM_ISWHITE(cmd[8]))) { if (nested) semsg(_(e_duplicate_argument_str), "++nested"); nested = TRUE; cmd = skipwhite(cmd + 8); } ! // Check for the old "nested" flag. if (STRNCMP(cmd, "nested", 6) == 0 && VIM_ISWHITE(cmd[6])) { if (nested) semsg(_(e_duplicate_argument_str), "nested"); nested = TRUE; cmd = skipwhite(cmd + 6); } --- 921,950 ---- if ((STRNCMP(cmd, "++nested", 8) == 0 && VIM_ISWHITE(cmd[8]))) { if (nested) + { semsg(_(e_duplicate_argument_str), "++nested"); + return; + } nested = TRUE; cmd = skipwhite(cmd + 8); } ! // Check for the old "nested" flag in legacy script. if (STRNCMP(cmd, "nested", 6) == 0 && VIM_ISWHITE(cmd[6])) { + if (in_vim9script()) + { + // If there ever is a :nested command this error should + // be removed and "nested" accepted as the start of the + // command. + emsg(_(e_invalid_command_nested_did_you_mean_plusplus_nested)); + return; + } if (nested) + { semsg(_(e_duplicate_argument_str), "nested"); + return; + } nested = TRUE; cmd = skipwhite(cmd + 6); } *** ../vim-8.2.4504/src/errors.h 2022-03-03 17:05:17.527121052 +0000 --- src/errors.h 2022-03-04 20:02:38.695197771 +0000 *************** *** 2786,2792 **** # endif EXTERN char e_missing_argument_type_for_str[] INIT(= N_("E1077: Missing argument type for %s")); ! // E1078 unused EXTERN char e_cannot_declare_variable_on_command_line[] INIT(= N_("E1079: Cannot declare a variable on the command line")); EXTERN char e_invalid_assignment[] --- 2786,2795 ---- # endif EXTERN char e_missing_argument_type_for_str[] INIT(= N_("E1077: Missing argument type for %s")); ! #endif ! EXTERN char e_invalid_command_nested_did_you_mean_plusplus_nested[] ! INIT(= N_("E1078: Invalid command \"nested\", did you mean \"++nested\"?")); ! #ifdef FEAT_EVAL EXTERN char e_cannot_declare_variable_on_command_line[] INIT(= N_("E1079: Cannot declare a variable on the command line")); EXTERN char e_invalid_assignment[] *** ../vim-8.2.4504/src/testdir/test_autocmd.vim 2022-02-11 16:30:07.320908533 +0000 --- src/testdir/test_autocmd.vim 2022-03-04 20:06:38.099752066 +0000 *************** *** 2116,2121 **** --- 2116,2124 ---- close bwipe! somefile + " nested without ++ does not work in Vim9 script + call assert_fails('vim9cmd au WinNew * nested echo fails', 'E1078:') + augroup Testing au! augroup END *** ../vim-8.2.4504/src/version.c 2022-03-04 19:22:32.713730341 +0000 --- src/version.c 2022-03-04 19:50:50.084465625 +0000 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 4505, /**/ -- hundred-and-one symptoms of being an internet addict: 166. You have been on your computer soo long that you didn't realize you had grandchildren. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///