To: vim_dev@googlegroups.com Subject: Patch 8.2.2905 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2905 Problem: No error when defaults.vim cannot be loaded. Solution: Add an error message. (Christian Brabandt, closes #8248) Files: runtime/doc/starting.txt, src/errors.h, src/main.c, src/testdir/test_startup.vim *** ../vim-8.2.2904/runtime/doc/starting.txt 2021-01-31 17:02:06.258490157 +0100 --- runtime/doc/starting.txt 2021-05-29 19:44:07.932370758 +0200 *************** *** 1036,1042 **** Defaults without a .vimrc file ~ ! *defaults.vim* If Vim is started normally and no user vimrc file is found, the $VIMRUNTIME/defaults.vim script is loaded. This will set 'compatible' off, switch on syntax highlighting and a few more things. See the script for --- 1036,1042 ---- Defaults without a .vimrc file ~ ! *defaults.vim* *E1187* If Vim is started normally and no user vimrc file is found, the $VIMRUNTIME/defaults.vim script is loaded. This will set 'compatible' off, switch on syntax highlighting and a few more things. See the script for *** ../vim-8.2.2904/src/errors.h 2021-05-09 23:19:17.089003124 +0200 --- src/errors.h 2021-05-29 19:46:12.972049761 +0200 *************** *** 413,415 **** --- 413,417 ---- INIT(= N_("E1185: Missing :redir END")); EXTERN char e_expression_does_not_result_in_value_str[] INIT(= N_("E1186: Expression does not result in a value: %s")); + EXTERN char e_failed_to_source_defaults[] + INIT(= N_("E1187: Failed to source defaults.vim")); *** ../vim-8.2.2904/src/main.c 2021-05-01 22:40:56.533884767 +0200 --- src/main.c 2021-05-29 19:47:31.011849224 +0200 *************** *** 3128,3134 **** if (parmp->use_vimrc != NULL) { if (STRCMP(parmp->use_vimrc, "DEFAULTS") == 0) ! do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE, NULL); else if (STRCMP(parmp->use_vimrc, "NONE") == 0 || STRCMP(parmp->use_vimrc, "NORC") == 0) { --- 3128,3138 ---- if (parmp->use_vimrc != NULL) { if (STRCMP(parmp->use_vimrc, "DEFAULTS") == 0) ! { ! if (do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE, NULL) ! != OK) ! emsg(e_failed_to_source_defaults); ! } else if (STRCMP(parmp->use_vimrc, "NONE") == 0 || STRCMP(parmp->use_vimrc, "NORC") == 0) { *************** *** 3200,3206 **** && !has_dash_c_arg) { // When no .vimrc file was found: source defaults.vim. ! do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE, NULL); } } --- 3204,3212 ---- && !has_dash_c_arg) { // When no .vimrc file was found: source defaults.vim. ! if (do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE, ! NULL) == FAIL) ! emsg(e_failed_to_source_defaults); } } *** ../vim-8.2.2904/src/testdir/test_startup.vim 2021-05-13 18:32:46.443394721 +0200 --- src/testdir/test_startup.vim 2021-05-29 19:52:02.699256214 +0200 *************** *** 276,281 **** --- 276,294 ---- call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\r\nline 1: \" The default vimrc file\..* verbose=15\n", out) endfunc + " Test that an error is shown when the defaults.vim file could not be read + func Test_defaults_error() + " Can't catch the output of gvim. + CheckNotGui + CheckNotMSWindows + + let out = system('VIMRUNTIME=/tmp ' .. GetVimCommand() .. ' --clean -cq') + call assert_match("E1187: Failed to source defaults.vim", out) + + let out = system('VIMRUNTIME=/tmp ' .. GetVimCommand() .. ' -u DEFAULTS -cq') + call assert_match("E1187: Failed to source defaults.vim", out) + endfunc + " Test the '-q [errorfile]' argument. func Test_q_arg() CheckFeature quickfix *** ../vim-8.2.2904/src/version.c 2021-05-29 19:17:57.716280905 +0200 --- src/version.c 2021-05-29 19:45:38.924137217 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2905, /**/ -- Michael: There is no such thing as a dump question. Bernard: Sure there is. For example "what is a core dump?" /// 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 ///