comparison runtime/menu.vim @ 18860:ec92ccff5c8b v8.1.2416

patch 8.1.2416: loading menus sets v:errmsg Commit: https://github.com/vim/vim/commit/e24c5b3332b453175e5f73423884087a4aef1247 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Dec 10 22:11:53 2019 +0100 patch 8.1.2416: loading menus sets v:errmsg Problem: Loading menus sets v:errmsg. Solution: Avoid setting v:errmsg and add a test for that. (Jason Franklin)
author Bram Moolenaar <Bram@vim.org>
date Tue, 10 Dec 2019 22:15:04 +0100
parents e9a47bcf7b94
children 8514e8b7e661
comparison
equal deleted inserted replaced
18859:5b30956b26a4 18860:ec92ccff5c8b
1 " Vim support file to define the default menus 1 " Vim support file to define the default menus
2 " You can also use this as a start for your own set of menus. 2 " You can also use this as a start for your own set of menus.
3 " 3 "
4 " Maintainer: Bram Moolenaar <Bram@vim.org> 4 " Maintainer: Bram Moolenaar <Bram@vim.org>
5 " Last Change: 2019 Nov 10 5 " Last Change: 2019 Dec 10
6 6
7 " Note that ":an" (short for ":anoremenu") is often used to make a menu work 7 " Note that ":an" (short for ":anoremenu") is often used to make a menu work
8 " in all modes and avoid side effects from mappings defined by the user. 8 " in all modes and avoid side effects from mappings defined by the user.
9 9
10 " Make sure the '<' and 'C' flags are not included in 'cpoptions', otherwise 10 " Make sure the '<' and 'C' flags are not included in 'cpoptions', otherwise
698 " get new priority, if exists 698 " get new priority, if exists
699 if a:0 == 1 699 if a:0 == 1
700 let g:bmenu_priority = a:1 700 let g:bmenu_priority = a:1
701 endif 701 endif
702 702
703 " remove old menu, if exists; keep one entry to avoid a torn off menu to 703 " Remove old menu, if exists; keep one entry to avoid a torn off menu to
704 " disappear. 704 " disappear. Use try/catch to avoid setting v:errmsg
705 silent! unmenu &Buffers 705 try | unmenu &Buffers | catch | endtry
706 exe 'noremenu ' . g:bmenu_priority . ".1 &Buffers.Dummy l" 706 exe 'noremenu ' . g:bmenu_priority . ".1 &Buffers.Dummy l"
707 silent! unmenu! &Buffers 707 try | unmenu! &Buffers | catch | endtry
708 708
709 " create new menu; set 'cpo' to include the <CR> 709 " create new menu; set 'cpo' to include the <CR>
710 let cpo_save = &cpo 710 let cpo_save = &cpo
711 set cpo&vim 711 set cpo&vim
712 exe 'an <silent> ' . g:bmenu_priority . ".2 &Buffers.&Refresh\\ menu :call <SID>BMShow()<CR>" 712 exe 'an <silent> ' . g:bmenu_priority . ".2 &Buffers.&Refresh\\ menu :call <SID>BMShow()<CR>"