summaryrefslogtreecommitdiffstats
path: root/runtime/menu.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-10 22:11:53 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-10 22:11:53 +0100
commite24c5b3332b453175e5f73423884087a4aef1247 (patch)
treeb0786de7591535eda14f17091a9048603779e3f3 /runtime/menu.vim
parent04357fbb87e65e50cc76295aec50114adb5cbd68 (diff)
patch 8.1.2416: loading menus sets v:errmsgv8.1.2416
Problem: Loading menus sets v:errmsg. Solution: Avoid setting v:errmsg and add a test for that. (Jason Franklin)
Diffstat (limited to 'runtime/menu.vim')
-rw-r--r--runtime/menu.vim10
1 files changed, 5 insertions, 5 deletions
diff --git a/runtime/menu.vim b/runtime/menu.vim
index 8a98d49a16..f01ca7719b 100644
--- a/runtime/menu.vim
+++ b/runtime/menu.vim
@@ -2,7 +2,7 @@
" You can also use this as a start for your own set of menus.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2019 Nov 10
+" Last Change: 2019 Dec 10
" Note that ":an" (short for ":anoremenu") is often used to make a menu work
" in all modes and avoid side effects from mappings defined by the user.
@@ -700,11 +700,11 @@ func! s:BMShow(...)
let g:bmenu_priority = a:1
endif
- " remove old menu, if exists; keep one entry to avoid a torn off menu to
- " disappear.
- silent! unmenu &Buffers
+ " Remove old menu, if exists; keep one entry to avoid a torn off menu to
+ " disappear. Use try/catch to avoid setting v:errmsg
+ 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