Greetings,

Found a small bug.

Reproduce:

1. gVim --clean
2. :echo v:errmsg

The error message is due to some missing error checking in menu.vim. I 
updated the test for this script.

I also noticed that delmenu.vim uses :silent! instead of :unlet!.  The 
latter is preferable because it doesn't leave behind an unnecessary 
v:errmsg.

Patch follows:

diff --git a/runtime/delmenu.vim b/runtime/delmenu.vim
index 137218264..d4cb5cf30 100644
--- a/runtime/delmenu.vim
+++ b/runtime/delmenu.vim
@@ -7,25 +7,26 @@
 aunmenu *
 tlunmenu *

-silent! unlet did_install_default_menus
-silent! unlet did_install_syntax_menu
-if exists("did_menu_trans")
+unlet! g:did_install_default_menus
+unlet! g:did_install_syntax_menu
+
+if exists('g:did_menu_trans')
   menutrans clear
-  unlet did_menu_trans
+  unlet g:did_menu_trans
 endif

-silent! unlet find_help_dialog
+unlet! g:find_help_dialog

-silent! unlet menutrans_help_dialog
-silent! unlet menutrans_path_dialog
-silent! unlet menutrans_tags_dialog
-silent! unlet menutrans_textwidth_dialog
-silent! unlet menutrans_fileformat_dialog
-silent! unlet menutrans_fileformat_choices
-silent! unlet menutrans_no_file
-silent! unlet menutrans_set_lang_to
-silent! unlet menutrans_spell_change_ARG_to
-silent! unlet menutrans_spell_add_ARG_to_word_list
-silent! unlet menutrans_spell_ignore_ARG
+unlet! g:menutrans_fileformat_choices
+unlet! g:menutrans_fileformat_dialog
+unlet! g:menutrans_help_dialog
+unlet! g:menutrans_no_file
+unlet! g:menutrans_path_dialog
+unlet! g:menutrans_set_lang_to
+unlet! g:menutrans_spell_add_ARG_to_word_list
+unlet! g:menutrans_spell_change_ARG_to
+unlet! g:menutrans_spell_ignore_ARG
+unlet! g:menutrans_tags_dialog
+unlet! g:menutrans_textwidth_dialog

 " vim: set sw=2 :
diff --git a/runtime/menu.vim b/runtime/menu.vim
index 8a98d49a1..4b893e6fc 100644
--- a/runtime/menu.vim
+++ b/runtime/menu.vim
@@ -702,9 +702,9 @@ func! s:BMShow(...)

   " remove old menu, if exists; keep one entry to avoid a torn off menu to
   " disappear.
-  silent! unmenu &Buffers
+  try | unmenu &Buffers | catch | endtry
   exe 'noremenu ' . g:bmenu_priority . ".1 &Buffers.Dummy l"
-  silent! unmenu! &Buffers
+  try | unmenu! &Buffers | catch | endtry

   " create new menu; set 'cpo' to include the <CR>
   let cpo_save = &cpo
diff --git a/src/testdir/test_menu.vim b/src/testdir/test_menu.vim
index efbb982b0..50155fe28 100644
--- a/src/testdir/test_menu.vim
+++ b/src/testdir/test_menu.vim
@@ -10,7 +10,14 @@ func Test_load_menu()
     call assert_report('error while loading menus: ' . v:exception)
   endtry
   call assert_match('browse confirm w', execute(':menu File.Save'))
+
+  let v:errmsg = ''
+
+  doautocmd LoadBufferMenu VimEnter
+  call assert_true(empty(v:errmsg), v:errmsg)
+
   source $VIMRUNTIME/delmenu.vim
+  call assert_true(empty(v:errmsg), v:errmsg)
 endfunc

 func Test_translate_menu()


-- 
Jason Franklin

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/91eafbc4-419f-4814-9f82-eab024bc5c8f%40googlegroups.com.

Raspunde prin e-mail lui